execution_manager.go ×1

Frontier kind: Code frontier

unlabeled · c_5ec83baebede

7 tests · 5270 LOC · 172 files · introduces 0 tests · 165 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
2 ranges165 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
987 ranges5270 lines · 172 files · Browse complete extent
All tests (intent)
7 testsBrowse complete intent

Neighbourhood graph

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.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 165 introduced LOC across 2 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/persistence/tests/execution_mutable_state.go 159 introduced LOC · 1 range

Open complete file

2445 }
2446
2447 > func (s *ExecutionMutableStateSuite) TestArchetypeSeparateIDSpace() { execution_mutable_state.go
2448 > // Create workflow execution.
2449 > workflowBranchToken, workflowSnapshot, _ := s.CreateWorkflow(
2450 > rand.Int63(),
2451 > enumsspb.WORKFLOW_EXECUTION_STATE_CREATED,
2452 > enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
2453 > rand.Int63(),
2454 > )
2455 >
2456 > // Create CHASM execution with same ID.
2457 > // Do NOT use CreateCHASMExecution() here, which uses the runID as CreateWorkflow().
2458 > chasmRunID := uuid.New().String()
2459 > chasmArchetypeID := rand.Uint32()
2460 > chasmSnapshot, events := RandomSnapshot(
2461 > s.T(),
2462 > s.NamespaceID,
2463 > s.WorkflowID,
2464 > chasmRunID,
2465 > common.FirstEventID,
2466 > rand.Int63(),
2467 > enumsspb.WORKFLOW_EXECUTION_STATE_CREATED,
2468 > enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
2469 > rand.Int63(),
2470 > nil,
2471 > )
2472 > _, err := s.ExecutionManager.CreateWorkflowExecution(s.Ctx, &p.CreateWorkflowExecutionRequest{
2473 > ShardID: s.ShardID,
2474 > RangeID: s.RangeID,
2475 > Mode: p.CreateWorkflowModeBrandNew,
2476 >
2477 > PreviousRunID: "",
2478 > PreviousLastWriteVersion: 0,
2479 >
2480 > ArchetypeID: chasmArchetypeID,
2481 >
2482 > NewWorkflowSnapshot: *chasmSnapshot,
2483 > NewWorkflowEvents: events,
2484 > })
2485 > s.NoError(err)
2486 >
2487 > // Update Workflow execution.
2488 > workflowMutation, workflowEvents := RandomMutation(
2489 > s.T(),
2490 > s.NamespaceID,
2491 > s.WorkflowID,
2492 > s.RunID,
2493 > workflowSnapshot.NextEventID,
2494 > rand.Int63(),
2495 > enumsspb.WORKFLOW_EXECUTION_STATE_RUNNING,
2496 > enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
2497 > workflowSnapshot.DBRecordVersion+1,
2498 > workflowBranchToken,
2499 > )
2500 > _, err = s.ExecutionManager.UpdateWorkflowExecution(s.Ctx, &p.UpdateWorkflowExecutionRequest{
2501 > ShardID: s.ShardID,
2502 > RangeID: s.RangeID,
2503 > Mode: p.UpdateWorkflowModeUpdateCurrent,
2504 >
2505 > ArchetypeID: chasm.WorkflowArchetypeID,
2506 >
2507 > UpdateWorkflowMutation: *workflowMutation,
2508 > UpdateWorkflowEvents: workflowEvents,
2509 >
2510 > NewWorkflowSnapshot: nil,
2511 > NewWorkflowEvents: nil,
2512 > })
2513 > s.NoError(err)
2514 >
2515 > // Update CHASM execution.
2516 > chasmMutation, chasmEvents := RandomMutation(
2517 > s.T(),
2518 > s.NamespaceID,
2519 > s.WorkflowID,
2520 > chasmRunID,
2521 > chasmSnapshot.NextEventID,
2522 > rand.Int63(),
2523 > enumsspb.WORKFLOW_EXECUTION_STATE_RUNNING,
2524 > enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
2525 > chasmSnapshot.DBRecordVersion+1,
2526 > nil, // No branch token for CHASM
2527 > )
2528 > _, err = s.ExecutionManager.UpdateWorkflowExecution(s.Ctx, &p.UpdateWorkflowExecutionRequest{
2529 > ShardID: s.ShardID,
2530 > RangeID: s.RangeID,
2531 > Mode: p.UpdateWorkflowModeUpdateCurrent,
2532 >
2533 > ArchetypeID: chasmArchetypeID,
2534 >
2535 > UpdateWorkflowMutation: *chasmMutation,
2536 > UpdateWorkflowEvents: chasmEvents,
2537 >
2538 > NewWorkflowSnapshot: nil,
2539 > NewWorkflowEvents: nil,
2540 > })
2541 > s.NoError(err)
2542 >
2543 > // Validate current execution for both archetypes.
2544 > resp, err := s.ExecutionManager.GetCurrentExecution(s.Ctx, &p.GetCurrentExecutionRequest{
2545 > ShardID: s.ShardID,
2546 > NamespaceID: s.NamespaceID,
2547 > WorkflowID: s.WorkflowID,
2548 > ArchetypeID: chasm.WorkflowArchetypeID,
2549 > })
2550 > s.NoError(err)
2551 > s.Equal(s.RunID, resp.RunID)
2552 > resp, err = s.ExecutionManager.GetCurrentExecution(s.Ctx, &p.GetCurrentExecutionRequest{
2553 > ShardID: s.ShardID,
2554 > NamespaceID: s.NamespaceID,
2555 > WorkflowID: s.WorkflowID,
2556 > ArchetypeID: chasmArchetypeID,
2557 > })
2558 > s.NoError(err)
2559 > s.Equal(chasmRunID, resp.RunID)
2560 >
2561 > // Validate concrete execution for both archetypes.
2562 > s.AssertMSEqualWithDB(chasm.WorkflowArchetypeID, workflowSnapshot, workflowMutation)
2563 > s.AssertMSEqualWithDB(chasmArchetypeID, chasmSnapshot, chasmMutation)
2564 >
2565 > // Delete workflow execution.
2566 > err = s.ExecutionManager.DeleteCurrentWorkflowExecution(s.Ctx, &p.DeleteCurrentWorkflowExecutionRequest{
2567 > ShardID: s.ShardID,
2568 > NamespaceID: s.NamespaceID,
2569 > WorkflowID: s.WorkflowID,
2570 > RunID: s.RunID,
2571 > ArchetypeID: chasm.WorkflowArchetypeID,
2572 > })
2573 > s.NoError(err)
2574 > err = s.ExecutionManager.DeleteWorkflowExecution(s.Ctx, &p.DeleteWorkflowExecutionRequest{
2575 > ShardID: s.ShardID,
2576 > NamespaceID: s.NamespaceID,
2577 > WorkflowID: s.WorkflowID,
2578 > RunID: s.RunID,
2579 > ArchetypeID: chasm.WorkflowArchetypeID,
2580 > })
2581 > s.NoError(err)
2582 >
2583 > s.AssertMissingFromDB(s.NamespaceID, s.WorkflowID, s.RunID, chasm.WorkflowArchetypeID)
2584 > s.AssertMSEqualWithDB(chasmArchetypeID, chasmSnapshot, chasmMutation)
2585 >
2586 > // Delete CHASM execution.
2587 > err = s.ExecutionManager.DeleteCurrentWorkflowExecution(s.Ctx, &p.DeleteCurrentWorkflowExecutionRequest{
2588 > ShardID: s.ShardID,
2589 > NamespaceID: s.NamespaceID,
2590 > WorkflowID: s.WorkflowID,
2591 > RunID: chasmRunID,
2592 > ArchetypeID: chasmArchetypeID,
2593 > })
2594 > s.NoError(err)
2595 > err = s.ExecutionManager.DeleteWorkflowExecution(s.Ctx, &p.DeleteWorkflowExecutionRequest{
2596 > ShardID: s.ShardID,
2597 > NamespaceID: s.NamespaceID,
2598 > WorkflowID: s.WorkflowID,
2599 > RunID: chasmRunID,
2600 > ArchetypeID: chasmArchetypeID,
2601 > })
2602 > s.NoError(err)
2603 >
2604 > s.AssertMissingFromDB(s.NamespaceID, s.WorkflowID, chasmRunID, chasmArchetypeID)
2605 > }
2606
2607 func (s *ExecutionMutableStateSuite) CreateWorkflow(
go.temporal.io/server/common/persistence/execution_manager.go 6 introduced LOC · 1 range

Open complete file

905 }
906
907 > return &GetCurrentExecutionResponse{ execution_manager.go
908 > RunID: response.RunID,
909 > StartRequestID: response.ExecutionState.CreateRequestId,
910 > State: response.ExecutionState.State,
911 > Status: response.ExecutionState.Status,
912 > }, respErr
913 }
914