}
// If workflow is paused, return query rejected with PAUSED status.
return &historyservice.QueryWorkflowResponse{
Response: &workflowservice.QueryWorkflowResponse{
Frontier kind: Code frontier
unlabeled · c_de5c62c26dd4
5 tests · 8366 LOC · 252 files · introduces 0 tests · 23 LOC · 1 file
The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.
Introduced files, introduced tests, and structurally relevant concept specialization
In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.
Graph controls are ready.
Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.
Every exact file and test below is linked only from the concept that introduces it.
go.temporal.io/server/service/history/historybuilder/TestHistoryBuilder_AddDifferentEvents/When_WorkflowTaskCompletedEvent_added_it_will_be_placed_in_memLatestBatchgo.temporal.io/server/service/history/historybuilder/TestHistoryBuilder_AddDifferentEvents_WorkflowFinishEvents/When_WorkflowTaskCompletedEvent_added_it_will_be_placed_in_memLatestBatchgo.temporal.io/server/service/history/historybuilder/TestHistoryBuilder_AddDifferentEvents/When_WorkflowTaskScheduledEvent_added_it_will_be_placed_in_memLatestBatchgo.temporal.io/server/service/history/historybuilder/TestHistoryBuilder_AddDifferentEvents_AssignmentEventId/Adding_batched_event_will_set_event_id_to_next_event_id_allocated_by_HistoryBuildergo.temporal.io/server/service/history/historybuilder/TestHistoryBuilder_AddDifferentEvents_WorkflowFinishEvents/When_WorkflowTaskScheduledEvent_added_go.temporal.io/server/service/history/historybuilder/TestHistoryBuilder_AddDifferentEvents/When_WorkflowTaskStartedEvent_added_it_will_be_placed_in_memLatestBatchgo.temporal.io/server/service/history/historybuilder/TestHistoryBuilder_AddDifferentEvents_WorkflowFinishEvents/When_WorkflowTaskStartedEvent_added_go.temporal.io/server/common/contextutil/TestContextMetadataGet/retrieves_existing_valuego.temporal.io/server/common/contextutil/TestContextMetadataGet/retrieves_nil_value_correctlygo.temporal.io/server/common/contextutil/TestContextMetadataGet/retrieves_various_value_typesgo.temporal.io/server/common/contextutil/TestMetadataContextIsolation/adding_metadata_context_twice_creates_new_isolated_contextgo.temporal.io/server/common/contextutil/TestMetadataContextIsolation/child_context_does_not_inherit_parent_metadatago.temporal.io/server/common/contextutil/TestMetadataContextIsolation/contexts_with_different_metadata_are_isolatedgo.temporal.io/server/common/contextutil/TestMetadataContextWithContextCancellation/metadata_survives_context_cancellationEvery collected test enters the hierarchy at exactly one concept.
No tests are introduced at this concept. Its intent tests are introduced by other concepts.
Every collected source range enters the hierarchy at exactly one concept.
1 file ranked by introduced lines: 23 introduced LOC across 5 ranges. Expand a file to inspect source; the > gutter marks introduced lines.
}
// If workflow is paused, return query rejected with PAUSED status.
return &historyservice.QueryWorkflowResponse{
Response: &workflowservice.QueryWorkflowResponse{
}
if !mutableState.IsWorkflowExecutionRunning() && !mutableState.HasCompletedAnyWorkflowTask() {
// Workflow was closed before WorkflowTaskStarted event. In this case query will fail.
return nil, consts.ErrWorkflowClosedBeforeWorkflowTaskStarted
}
// Workflow has no workflow task scheduled.
// This can be due to firstWorkflowTaskBackoff (cron / retry)
}
if mutableState.GetExecutionInfo().WorkflowTaskAttempt >= failQueryWorkflowTaskAttemptCount {
api.go
// while workflow task is failing, the query to that workflow will also fail. Failing fast here to prevent wasting
// resources to load history for a query that will fail.
}
// There are two ways in which queries get dispatched to workflow worker. First, queries can be dispatched on workflow tasks.
// These workflow tasks potentially contain new events and queries. The events are treated as coming before the query in time.
// The second way in which queries are dispatched to workflow worker is directly through matching; in this approach queries can be
// dispatched to workflow worker immediately even if there are outstanding events that came before the query. The following logic
// is used to determine if a query can be safely dispatched directly through matching or must be dispatched on a workflow task.
//
// Precondition to dispatch query directly to matching is workflow has at least one WorkflowTaskStarted event. Otherwise, sdk would panic.
if mutableState.HasCompletedAnyWorkflowTask() {
// There are three cases in which a query can be dispatched directly through matching safely, without violating strong consistency level:
// 1. the namespace is not active, in this case history is immutable so a query dispatched at any time is consistent
// 2. the workflow is not running, whenever a workflow is not running dispatching query directly is consistent
// 3. if there is no pending or started workflow tasks it means no events came before query arrived, so its safe to dispatch directly
safeToDispatchDirectly := nsEntry.ActiveClusterName(namespace.RoutingKey{ID: workflowKey.WorkflowID}) != shardContext.GetClusterMetadata().GetCurrentClusterName() ||
!mutableState.IsWorkflowExecutionRunning() ||
(!mutableState.HasPendingWorkflowTask() && !mutableState.HasStartedWorkflowTask())
if safeToDispatchDirectly {
msResp, err := api.MutableStateToGetResponse(mutableState)
if err != nil {