Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove lock on current workflow ID #2872

Merged
merged 1 commit into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions service/history/historyEngine.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,17 +387,6 @@ func (e *historyEngineImpl) StartWorkflowExecution(

workflowID := request.GetWorkflowId()
runID := uuid.New()
// grab the current context as a Lock, nothing more
_, currentRelease, err := e.historyCache.GetOrCreateCurrentWorkflowExecution(
ctx,
namespaceID,
workflowID,
)
if err != nil {
return nil, err
}
defer func() { currentRelease(retError) }()

workflowContext, err := api.NewWorkflowWithSignal(
e.shard,
namespaceEntry,
Expand Down
34 changes: 0 additions & 34 deletions service/history/workflow/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ type (
ReleaseCacheFunc func(err error)

Cache interface {
GetOrCreateCurrentWorkflowExecution(
ctx context.Context,
namespaceID namespace.ID,
workflowID string,
) (Context, ReleaseCacheFunc, error)

GetOrCreateWorkflowExecution(
ctx context.Context,
namespaceID namespace.ID,
Expand Down Expand Up @@ -101,34 +95,6 @@ func NewCache(shard shard.Context) Cache {
}
}

func (c *CacheImpl) GetOrCreateCurrentWorkflowExecution(
ctx context.Context,
namespaceID namespace.ID,
workflowID string,
) (Context, ReleaseCacheFunc, error) {

scope := metrics.HistoryCacheGetOrCreateCurrentScope
c.metricsClient.IncCounter(scope, metrics.CacheRequests)
sw := c.metricsClient.StartTimer(scope, metrics.CacheLatency)
defer sw.Stop()

// using empty run ID as current workflow run ID
runID := ""
execution := commonpb.WorkflowExecution{
WorkflowId: workflowID,
RunId: runID,
}

return c.getOrCreateWorkflowExecutionInternal(
ctx,
namespaceID,
execution,
scope,
true,
CallerTypeAPI,
)
}

func (c *CacheImpl) GetOrCreateWorkflowExecution(
ctx context.Context,
namespaceID namespace.ID,
Expand Down
16 changes: 0 additions & 16 deletions service/history/workflow/cache_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.