mutable_state_impl.go ×10

Frontier kind: Code frontier

unlabeled · c_1663a81b618d

332 tests · 4004 LOC · 170 files · introduces 0 tests · 31 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges31 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
628 ranges4004 lines · 170 files · Browse complete extent
All tests (intent)
332 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.

1 file ranked by introduced lines: 31 introduced LOC across 10 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/workflow/mutable_state_impl.go 31 introduced LOC · 10 ranges

Open complete file

1287 }
1288
1289 > func (ms *MutableStateImpl) GetLastWriteVersion() (int64, error) { mutable_state_impl.go
1290 > if ms.transitionHistoryEnabled && len(ms.executionInfo.TransitionHistory) != 0 {
1291 lastVersionedTransition := ms.CurrentVersionedTransition()
1292 return lastVersionedTransition.NamespaceFailoverVersion, nil
7407 // However, certain in-memory changes (e.g. speculative workflow task) won't be cleared before releasing
7408 // the lock and have to be excluded from the check.
7409 > func (ms *MutableStateImpl) IsDirty() bool { mutable_state_impl.go
7410 > return ms.hBuilder.IsDirty() ||
7411 > len(ms.InsertTasks) > 0 ||
7412 > (ms.stateMachineNode != nil && ms.stateMachineNode.Dirty()) ||
7413 > ms.chasmTree.IsDirty()
7414 > }
7415
7416 // isStateDirty is used upon closing transaction to determine if application data has been updated, and
7449 func (ms *MutableStateImpl) StartTransaction(
7450 namespaceEntry *namespace.Namespace,
7451 > ) (bool, error) { mutable_state_impl.go
7452 > if ms.IsDirty() {
7453 ms.logger.Error("MutableState encountered dirty transaction",
7454 tag.WorkflowNamespaceID(ms.executionInfo.NamespaceId),
7461 }
7462
7463 > ms.transitionHistoryEnabled = ms.config.EnableTransitionHistory(namespaceEntry.Name().String()) mutable_state_impl.go
7464 >
7465 > namespaceEntry, err := ms.startTransactionHandleNamespaceMigration(namespaceEntry)
7466 > if err != nil {
7467 return false, err
7468 }
7469 > ms.namespaceEntry = namespaceEntry mutable_state_impl.go
7470 > if err := ms.UpdateCurrentVersion(namespaceEntry.FailoverVersion(ms.executionInfo.WorkflowId), false); err != nil {
7471 return false, err
7472 }
7473
7474 > flushBeforeReady, err := ms.startTransactionHandleWorkflowTaskFailover() mutable_state_impl.go
7475 > if err != nil {
7476 return false, err
7477 }
7478
7479 > return flushBeforeReady, nil mutable_state_impl.go
7480 }
7481
8685 func (ms *MutableStateImpl) startTransactionHandleNamespaceMigration(
8686 namespaceEntry *namespace.Namespace,
8687 > ) (*namespace.Namespace, error) { mutable_state_impl.go
8688 > // NOTE:
8689 > // the main idea here is to guarantee that buffered events & namespace migration works
8690 > // e.g. handle buffered events during version 0 => version > 0 by postponing namespace migration
8691 > // * flush buffered events as if namespace is still local
8692 > // * use updated namespace for actual call
8693 >
8694 > lastWriteVersion, err := ms.GetLastWriteVersion()
8695 > if err != nil {
8696 return nil, err
8697 }
8698
8699 // local namespace -> global namespace && with started workflow task
8700 > if lastWriteVersion == common.EmptyVersion && namespaceEntry.FailoverVersion(ms.executionInfo.WorkflowId) > common.EmptyVersion && ms.HasStartedWorkflowTask() { mutable_state_impl.go
8701 localNamespaceMutation := namespace.WithPretendLocalNamespace(
8702 ms.clusterMetadata.GetCurrentClusterName(),
8707 }
8708
8709 > func (ms *MutableStateImpl) startTransactionHandleWorkflowTaskFailover() (bool, error) { mutable_state_impl.go
8710 > if !ms.IsWorkflowExecutionRunning() {
8711 return false, nil
8712 }