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
94
>
if t.errorByStateFn() != nil {
95
>
maxReplicationTaskID = PendingMaxReplicationTaskID
96
>
}
97
99
>
if handover.NotificationVersion < newNs.NotificationVersion() {
100
handover.NotificationVersion = newNs.NotificationVersion()
101
handover.MaxReplicationTaskID = maxReplicationTaskID
102
}
104
>
t.handoverNamespaces[nsName] = &namespaceHandOverInfo{
105
>
NotificationVersion: newNs.NotificationVersion(),
106
>
MaxReplicationTaskID: maxReplicationTaskID,
107
>
}
108
>
}
109
111
>
t.notifyReplicationFn(maxReplicationTaskID)
112
>
}
113
}
114