handover_tracker.go ×6

Frontier kind: Joint frontier

unlabeled · c_c40a89bb2e39

1 test · 4105 LOC · 176 files · introduces 1 test · 42 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges42 lines · 2 files
Tests
1 test

Contains — complete concept membership

All code (extent)
634 ranges4105 lines · 176 files · Browse complete extent
All tests (intent)
1 testBrowse 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.

1 test introduced at this concept.

Introduced code

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

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

go.temporal.io/server/service/history/shard/handover_tracker.go 33 introduced LOC · 6 ranges

Open complete file

76 }
77
78 > func (t *defaultHandoverTracker) UpdateHandoverState(newNs *namespace.Namespace, deletedFromDB bool) { handover_tracker.go
79 > nsName := newNs.Name()
80 > // NOTE: replication state field won't be replicated and currently we only update a namespace
81 > // to handover state from active cluster, so the second condition will always be true. Adding
82 > // it here to be more safe in case above assumption no longer holds in the future.
83 > isHandoverNamespace := newNs.IsGlobalNamespace() &&
84 > //nolint:forbidigo // namespace-wide handover tracking; ReplicationState("") below is also ns-level
85 > newNs.ActiveInCluster(t.clusterMetadata.GetCurrentClusterName()) &&
86 > newNs.ReplicationState("") == enumspb.REPLICATION_STATE_HANDOVER
87 >
88 > if deletedFromDB || !isHandoverNamespace {
89 > delete(t.handoverNamespaces, nsName)
90 > return
91 > }
92
93 > maxReplicationTaskID := t.getMaxReplicationTaskID() handover_tracker.go
94 > if t.errorByStateFn() != nil {
95 > maxReplicationTaskID = PendingMaxReplicationTaskID
96 > }
97
98 > if handover, ok := t.handoverNamespaces[nsName]; ok { handover_tracker.go
99 > if handover.NotificationVersion < newNs.NotificationVersion() {
100 handover.NotificationVersion = newNs.NotificationVersion()
101 handover.MaxReplicationTaskID = maxReplicationTaskID
102 }
103 > } else { handover_tracker.go
104 > t.handoverNamespaces[nsName] = &namespaceHandOverInfo{
105 > NotificationVersion: newNs.NotificationVersion(),
106 > MaxReplicationTaskID: maxReplicationTaskID,
107 > }
108 > }
109
110 > if maxReplicationTaskID != PendingMaxReplicationTaskID { handover_tracker.go
111 > t.notifyReplicationFn(maxReplicationTaskID)
112 > }
113 }
114
121 result := make(map[string]*historyservice.HandoverNamespaceInfo, len(t.handoverNamespaces))
122 for k, v := range t.handoverNamespaces {
123 > result[k.String()] = &historyservice.HandoverNamespaceInfo{ handover_tracker.go
124 > HandoverReplicationTaskId: v.MaxReplicationTaskID,
125 > }
126 > }
127 return result
128 }
go.temporal.io/server/service/history/shard/context_impl.go 9 introduced LOC · 3 ranges

Open complete file

477 }
478
479 > func (s *ContextImpl) UpdateHandoverNamespace(ns *namespace.Namespace, deletedFromDB bool) { context_impl.go
480 > s.wLock()
481 > s.handoverTracker.UpdateHandoverState(ns, deletedFromDB)
482 > s.wUnlock()
483 > }
484
485 func (s *ContextImpl) AddTasks(
1865
1866 if len(clusterNames) == 0 {
1867 > for clusterName := range clusterInfo { context_impl.go
1868 > clusterNames = append(clusterNames, clusterName)
1869 > }
1870 }
1871
1876 v, ok := s.remoteClusterInfos[clusterName]
1877 if !ok {
1878 > continue context_impl.go
1879 }
1880