mutable_state_impl.go ×20

Frontier kind: Code frontier

unlabeled · c_1062099b2f0a

361 tests · 3922 LOC · 167 files · introduces 0 tests · 66 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
21 ranges66 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
604 ranges3922 lines · 167 files · Browse complete extent
All tests (intent)
361 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: 66 introduced LOC across 21 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/workflow/mutable_state_impl.go 65 introduced LOC · 20 ranges

Open complete file

446 dbRecord *persistencespb.WorkflowMutableState,
447 dbRecordVersion int64,
448 > ) (*MutableStateImpl, error) { mutable_state_impl.go
449 > // startTime will be overridden by DB record
450 > startTime := time.Time{}
451 >
452 > mutableState := NewMutableState(
453 > shard,
454 > eventsCache,
455 > logger,
456 > namespaceEntry,
457 > dbRecord.ExecutionInfo.WorkflowId,
458 > dbRecord.ExecutionState.RunId,
459 > startTime,
460 > )
461 >
462 > if dbRecord.ActivityInfos != nil {
463 mutableState.pendingActivityInfoIDs = dbRecord.ActivityInfos
464 mutableState.approximateSize += int64SizeBytes * len(mutableState.pendingActivityInfoIDs)
465 }
466 > for _, activityInfo := range dbRecord.ActivityInfos { mutable_state_impl.go
467 mutableState.pendingActivityIDToEventID[activityInfo.ActivityId] = activityInfo.ScheduledEventId
468 mutableState.approximateSize += activityInfo.Size()
474 }
475
476 > if dbRecord.TimerInfos != nil { mutable_state_impl.go
477 mutableState.pendingTimerInfoIDs = dbRecord.TimerInfos
478 }
479 > for timerID, timerInfo := range dbRecord.TimerInfos { mutable_state_impl.go
480 mutableState.pendingTimerEventIDToID[timerInfo.GetStartedEventId()] = timerInfo.GetTimerId()
481 mutableState.approximateSize += timerInfo.Size()
483 }
484
485 > if dbRecord.ChildExecutionInfos != nil { mutable_state_impl.go
486 mutableState.pendingChildExecutionInfoIDs = dbRecord.ChildExecutionInfos
487 mutableState.approximateSize += int64SizeBytes * len(mutableState.pendingChildExecutionInfoIDs)
488 }
489 > for _, childInfo := range dbRecord.ChildExecutionInfos { mutable_state_impl.go
490 mutableState.approximateSize += childInfo.Size()
491 }
492
493 > if dbRecord.RequestCancelInfos != nil { mutable_state_impl.go
494 mutableState.pendingRequestCancelInfoIDs = dbRecord.RequestCancelInfos
495 mutableState.approximateSize += int64SizeBytes * len(mutableState.pendingRequestCancelInfoIDs)
496 }
497 > for _, cancelInfo := range dbRecord.RequestCancelInfos { mutable_state_impl.go
498 mutableState.approximateSize += cancelInfo.Size()
499 }
500
501 > if dbRecord.SignalInfos != nil { mutable_state_impl.go
502 mutableState.pendingSignalInfoIDs = dbRecord.SignalInfos
503 mutableState.approximateSize += int64SizeBytes * len(mutableState.pendingSignalInfoIDs)
504 }
505 > for _, signalInfo := range dbRecord.SignalInfos { mutable_state_impl.go
506 mutableState.approximateSize += signalInfo.Size()
507 }
508
509 > mutableState.pendingSignalRequestedIDs = convert.StringSliceToSet(dbRecord.SignalRequestedIds) mutable_state_impl.go
510 > for requestID := range mutableState.pendingSignalRequestedIDs {
511 mutableState.approximateSize += len(requestID)
512 }
513
514 > for _, tombstoneBatch := range dbRecord.ExecutionInfo.SubStateMachineTombstoneBatches { mutable_state_impl.go
515 mutableState.totalTombstones += len(tombstoneBatch.StateMachineTombstones)
516 }
519 // conflict path can surface it without loading ExecutionInfo. Backfill in memory for records
520 // written before that change so the next persist writes it through.
521 > if dbRecord.ExecutionState.FirstExecutionRunId == "" && dbRecord.ExecutionInfo.FirstExecutionRunId != "" { mutable_state_impl.go
522 dbRecord.ExecutionState.FirstExecutionRunId = dbRecord.ExecutionInfo.FirstExecutionRunId
523 }
524
525 > mutableState.approximateSize += dbRecord.ExecutionState.Size() - mutableState.executionState.Size() mutable_state_impl.go
526 > mutableState.executionState = dbRecord.ExecutionState
527 > mutableState.approximateSize += dbRecord.ExecutionInfo.Size() - mutableState.executionInfo.Size()
528 > mutableState.executionInfo = dbRecord.ExecutionInfo
529 >
530 > // StartTime was moved from ExecutionInfo to executionState
531 > if mutableState.executionState.StartTime == nil && dbRecord.ExecutionInfo.StartTime != nil {
532 mutableState.executionState.StartTime = dbRecord.ExecutionInfo.StartTime
533 }
534
535 > mutableState.hBuilder = historybuilder.New( mutable_state_impl.go
536 > mutableState.timeSource,
537 > mutableState.shard.GenerateTaskIDs,
538 > common.EmptyVersion,
539 > dbRecord.NextEventId,
540 > dbRecord.BufferedEvents,
541 > mutableState.metricsHandler,
542 > mutableState.config.MaximumEventBatchSizeInBytes,
543 > )
544 > mutableState.currentVersion = common.EmptyVersion
545 > mutableState.bufferEventsInDB = dbRecord.BufferedEvents
546 > mutableState.stateInDB = dbRecord.ExecutionState.State
547 > mutableState.nextEventIDInDB = dbRecord.NextEventId
548 > mutableState.dbRecordVersion = dbRecordVersion
549 > mutableState.checksum = dbRecord.Checksum
550 > mutableState.initVersionedTransitionInDB()
551 >
552 > if len(dbRecord.Checksum.GetValue()) > 0 {
553 switch {
554 case mutableState.shouldInvalidateCheckum():
566 }
567
568 > mutableState.mustInitHSM() mutable_state_impl.go
569 >
570 > // Track chasm node size even if chasm is not enabled,
571 > // because those nodes are still stored in the mutable state,
572 > // and should be taken into account when deciding if execution
573 > // should be terminated based on mutable state size.
574 > for key, node := range dbRecord.ChasmNodes {
575 nodeSize := len(key) + node.Size()
576 mutableState.approximateSize += nodeSize
579
580 // TODO@time-skipping: support time skipping for chasm
581 > if shard.GetConfig().EnableChasm(namespaceEntry.Name().String()) { mutable_state_impl.go
582 var err error
583 mutableState.chasmTree, err = chasm.NewTreeFromDB(
594 }
595 }
596 > if mutableState.executionInfo.GetTimeSkippingInfo() != nil { mutable_state_impl.go
597 mutableState.wrapTimeSourceWithTimeSkipping()
598 }
599 > return mutableState, nil mutable_state_impl.go
600 }
601
9586 }
9587
9588 > func (ms *MutableStateImpl) initVersionedTransitionInDB() { mutable_state_impl.go
9589 > if len(ms.executionInfo.TransitionHistory) != 0 {
9590 ms.versionedTransitionInDB = ms.CurrentVersionedTransition()
9591 }
go.temporal.io/server/api/persistence/v1/executions.pb.go 1 introduced LOC · 1 range

Open complete file