Skip to content

Commit

Permalink
More functional tests for worker versioning (#4446)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnr authored and mindaugasrukas committed Jun 8, 2023
1 parent 7608a0c commit f19e1ee
Show file tree
Hide file tree
Showing 3 changed files with 329 additions and 17 deletions.
4 changes: 2 additions & 2 deletions service/frontend/workflow_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ func (wh *WorkflowHandler) PollWorkflowTaskQueue(ctx context.Context, request *w
return &workflowservice.PollWorkflowTaskQueueResponse{}, nil
}

// For newer build error, return silently.
// These errors are expected based on certain client behavior. We should not log them, it'd be too noisy.
var newerBuild *serviceerror.NewerBuildExists
if errors.As(err, &newerBuild) {
return nil, err
Expand Down Expand Up @@ -1114,7 +1114,7 @@ func (wh *WorkflowHandler) PollActivityTaskQueue(ctx context.Context, request *w
return &workflowservice.PollActivityTaskQueueResponse{}, nil
}

// For newer build error, return silently.
// These errors are expected based on certain client behavior. We should not log them, it'd be too noisy.
var newerBuild *serviceerror.NewerBuildExists
if errors.As(err, &newerBuild) {
return nil, err
Expand Down
17 changes: 8 additions & 9 deletions service/matching/taskQueueManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,12 @@ func (c *taskQueueManagerImpl) Stop() {
c.unloadFromEngine()
}

// isVersioned returns true if this is a tqm for a "versioned [low-level] task queue". Note
// that this is a different concept from the overall [high-level] task queue having versioning
// data associated with it, which is the usual meaning of "versioned task queue". In this case,
// it means whether this is a tqm processing a specific version set id. Unlike non-root
// partitions which are known (at some level) by other services, [low-level] task queues with a
// version set should not be interacted with outside of the matching service.
func (c *taskQueueManagerImpl) isVersioned() bool {
// managesSpecificVersionSet returns true if this is a tqm for a specific version set in the
// build-id-based versioning feature. Note that this is a different concept from the overall
// task queue having versioning data associated with it, which is the usual meaning of
// "versioned task queue". These task queues are not interacted with directly outside outside
// of a single matching node.
func (c *taskQueueManagerImpl) managesSpecificVersionSet() bool {
return c.taskQueueID.VersionSet() != ""
}

Expand All @@ -362,7 +361,7 @@ func (c *taskQueueManagerImpl) isVersioned() bool {
func (c *taskQueueManagerImpl) shouldFetchUserData() bool {
// 1. If the db stores it, then we definitely should not be fetching.
// 2. Additionally, we should not fetch for "versioned" tqms.
return !c.db.DbStoresUserData() && !c.isVersioned()
return !c.db.DbStoresUserData() && !c.managesSpecificVersionSet()
}

func (c *taskQueueManagerImpl) WaitUntilInitialized(ctx context.Context) error {
Expand Down Expand Up @@ -510,7 +509,7 @@ func (c *taskQueueManagerImpl) DispatchQueryTask(
// GetUserData returns the user data for the task queue if any.
// Note: can return nil value with no error.
func (c *taskQueueManagerImpl) GetUserData(ctx context.Context) (*persistencespb.VersionedTaskQueueUserData, chan struct{}, error) {
if c.isVersioned() {
if c.managesSpecificVersionSet() {
return nil, nil, errNoUserDataOnVersionedTQM
}
return c.db.GetUserData(ctx)
Expand Down
Loading

0 comments on commit f19e1ee

Please sign in to comment.