1130
1131
// Check if remote cluster has caught up on all shards on replication tasks from target replica.
1132
>
func (a *activities) getTargetClusterReplicationStatus(ctx context.Context, waitRequest waitCatchupRequest) (map[int32]int64, error) {
activities.go
1133
>
targetAckIDOnShard := make(map[int32]int64)
1134
>
1135
>
resp, err := a.HistoryClient.GetReplicationStatus(ctx, &historyservice.GetReplicationStatusRequest{
1136
>
RemoteClusters: []string{waitRequest.TargetCluster}, // only the specified remote cluster
1137
>
})
1138
>
if err != nil {
1139
return targetAckIDOnShard, err
1140
}
1141
1142
// record the acked task id from active for each shard
1144
>
activeInfo, hasActiveInfo := shard.RemoteClusters[waitRequest.TargetCluster]
1145
>
if hasActiveInfo {
1146
>
targetAckIDOnShard[shard.ShardId] = activeInfo.AckedTaskId
1147
>
}
1148
}
1149
1151
}
1152
1153
// Check if remote cluster has caught up on all shards on replication tasks from target replica.
1154
>
func (a *activities) checkReplicationOnRemoteCluster(ctx context.Context, waitRequest waitCatchupRequest, requiredMinTaskIDPerShard map[int32]int64) (bool, error) {
activities.go
1155
>
resp, err := a.HistoryClient.GetReplicationStatus(ctx, &historyservice.GetReplicationStatusRequest{
1156
>
RemoteClusters: []string{waitRequest.CatchupCluster}, // only the specified remote cluster
1157
>
})
1158
>
if err != nil {
1159
return false, err
1160
}
1161
1163
>
1164
>
shardStatuses := make([]shardStatus, 0, len(localShards))
1165
>
1166
>
// check that on every shard, all source clusters have caught up with target cluster
1167
>
for _, localShard := range localShards {
1168
>
remoteShardProgress, hasRemoteShardProgress := localShard.RemoteClusters[waitRequest.CatchupCluster]
1169
>
if !hasRemoteShardProgress {
1170
a.Logger.Info("GetReplicationStatus response missing expected remote cluster for shard during remote cluster replication catchup",
1171
tag.ShardID(localShard.ShardId),