history_v2_persistence.go ×7

Frontier kind: Code frontier

unlabeled · c_1d192d3ff2f4

27 tests · 4211 LOC · 182 files · introduces 0 tests · 91 LOC · 4 files

Introduces — evidence that enters the hierarchy at this concept

Code
16 ranges91 lines · 4 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
754 ranges4211 lines · 182 files · Browse complete extent
All tests (intent)
27 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.

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

go.temporal.io/server/common/persistence/persistence-tests/history_v2_persistence.go 46 introduced LOC · 7 ranges

Open complete file

665 }
666
667 > func (s *HistoryV2PersistenceSuite) genRandomEvents(eventIDs []int64, version int64) []*historypb.HistoryEvent { history_v2_persistence.go
668 > var events []*historypb.HistoryEvent
669 >
670 > now := time.Date(2020, 8, 22, 0, 0, 0, 0, time.UTC)
671 > for _, eid := range eventIDs {
672 > e := &historypb.HistoryEvent{EventId: eid, Version: version, EventTime: timestamppb.New(now)}
673 > events = append(events, e)
674 > }
675
676 > return events history_v2_persistence.go
677 }
678
679 // persistence helper
680 > func (s *HistoryV2PersistenceSuite) newHistoryBranch(treeID string) ([]byte, error) { history_v2_persistence.go
681 > return s.ExecutionManager.GetHistoryBranchUtil().NewHistoryBranch(
682 > uuid.NewString(),
683 > uuid.NewString(),
684 > uuid.NewString(),
685 > treeID,
686 > nil,
687 > []*persistencespb.HistoryBranchRange{},
688 > 0,
689 > 0,
690 > 0,
691 > )
692 > }
693
694 // persistence helper
784 }
785
786 > func (s *HistoryV2PersistenceSuite) appendNewBranchAndFirstNode(branch []byte, events []*historypb.HistoryEvent, txnID int64, branchInfo string) error { history_v2_persistence.go
787 > return s.append(branch, events, txnID, true, branchInfo)
788 > }
789
790 // persistence helper
791 > func (s *HistoryV2PersistenceSuite) append(branch []byte, events []*historypb.HistoryEvent, txnID int64, isNewBranch bool, branchInfo string) error { history_v2_persistence.go
792 >
793 > var resp *p.AppendHistoryNodesResponse
794 >
795 > op := func() error {
796 > var err error
797 > resp, err = s.ExecutionManager.AppendHistoryNodes(s.ctx, &p.AppendHistoryNodesRequest{
798 > IsNewBranch: isNewBranch,
799 > Info: branchInfo,
800 > BranchToken: branch,
801 > Events: events,
802 > TransactionID: txnID,
803 > ShardID: s.ShardInfo.GetShardId(),
804 > })
805 > return err
806 > }
807
808 > err := backoff.ThrottleRetry(op, historyTestRetryPolicy, isConditionFail) history_v2_persistence.go
809 > if err != nil {
810 return err
811 }
812 > s.True(resp.Size > 0) history_v2_persistence.go
813 >
814 > return err
815 }
816
go.temporal.io/server/common/persistence/persistence_metric_clients.go 18 introduced LOC · 2 ranges

Open complete file

914 ctx context.Context,
915 request *AppendHistoryNodesRequest,
916 > ) (_ *AppendHistoryNodesResponse, retErr error) { persistence_metric_clients.go
917 > caller := headers.GetCallerInfo(ctx).CallerName
918 > startTime := time.Now().UTC()
919 > defer func() {
920 > p.healthSignals.Record(CallerSegmentMissing, time.Since(startTime), retErr)
921 > p.recordRequestMetrics(metrics.PersistenceAppendHistoryNodesScope, caller, time.Since(startTime), retErr)
922 > p.recordDataLossMetrics(metrics.PersistenceAppendHistoryNodesScope, caller, retErr, "", "")
923 > }()
924 > return p.persistence.AppendHistoryNodes(ctx, request)
925 }
926
1041 ctx context.Context,
1042 request *GetAllHistoryTreeBranchesRequest,
1043 > ) (_ *GetAllHistoryTreeBranchesResponse, retErr error) { persistence_metric_clients.go
1044 > caller := headers.GetCallerInfo(ctx).CallerName
1045 > startTime := time.Now().UTC()
1046 > defer func() {
1047 > p.healthSignals.Record(CallerSegmentMissing, time.Since(startTime), retErr)
1048 > p.recordRequestMetrics(metrics.PersistenceGetAllHistoryTreeBranchesScope, caller, time.Since(startTime), retErr)
1049 > p.recordDataLossMetrics(metrics.PersistenceGetAllHistoryTreeBranchesScope, caller, retErr, "", "")
1050 > }()
1051 > return p.persistence.GetAllHistoryTreeBranches(ctx, request)
1052 }
1053
go.temporal.io/server/common/persistence/persistence_retryable_clients.go 18 introduced LOC · 4 ranges

Open complete file

447 ctx context.Context,
448 request *AppendHistoryNodesRequest,
449 > ) (*AppendHistoryNodesResponse, error) { persistence_retryable_clients.go
450 > var response *AppendHistoryNodesResponse
451 > op := func(ctx context.Context) error {
452 > var err error
453 > response, err = p.persistence.AppendHistoryNodes(ctx, request)
454 > return err
455 > }
456
457 > err := backoff.ThrottleRetryContext(ctx, op, p.policy, p.isRetryable) persistence_retryable_clients.go
458 > return response, err
459 }
460
586 ctx context.Context,
587 request *GetAllHistoryTreeBranchesRequest,
588 > ) (*GetAllHistoryTreeBranchesResponse, error) { persistence_retryable_clients.go
589 > var response *GetAllHistoryTreeBranchesResponse
590 > op := func(ctx context.Context) error {
591 > var err error
592 > response, err = p.persistence.GetAllHistoryTreeBranches(ctx, request)
593 > return err
594 > }
595
596 > err := backoff.ThrottleRetryContext(ctx, op, p.policy, p.isRetryable) persistence_retryable_clients.go
597 > return response, err
598 }
599
go.temporal.io/server/common/persistence/history_manager.go 9 introduced LOC · 3 ranges

Open complete file

581 ctx context.Context,
582 request *GetAllHistoryTreeBranchesRequest,
583 > ) (*GetAllHistoryTreeBranchesResponse, error) { history_manager.go
584 > resp, err := m.persistence.GetAllHistoryTreeBranches(ctx, request)
585 > if err != nil {
586 return nil, err
587 }
588 > branches := make([]HistoryBranchDetail, 0, len(resp.Branches)) history_manager.go
589 > for _, branch := range resp.Branches {
590 treeInfo, err := m.serializer.HistoryTreeInfoFromBlob(NewDataBlob(branch.Data, branch.Encoding))
591 if err != nil {
600 }
601
602 > return &GetAllHistoryTreeBranchesResponse{ history_manager.go
603 > NextPageToken: resp.NextPageToken,
604 > Branches: branches,
605 > }, nil
606 }
607