mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
1. Fix primary-secondary replication switchover blocking by delete replicate pchannel meta using modRevision. 2. Stop channel replicator(scanner) when cluster role changes to prevent continued message consumption and replication. 3. Close Milvus client to prevent goroutine leak. 4. Create Milvus client once for a channel replicator. 5. Simplify CDC controller and resources. issue: https://github.com/milvus-io/milvus/issues/44123 --------- Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
24 lines
1.0 KiB
Go
24 lines
1.0 KiB
Go
package util
|
|
|
|
import (
|
|
"github.com/milvus-io/milvus/pkg/v2/proto/streamingpb"
|
|
"github.com/milvus-io/milvus/pkg/v2/streaming/util/message"
|
|
"github.com/milvus-io/milvus/pkg/v2/util/paramtable"
|
|
"github.com/milvus-io/milvus/pkg/v2/util/replicateutil"
|
|
)
|
|
|
|
func IsReplicationRemovedByAlterReplicateConfigMessage(msg message.ImmutableMessage, replicateInfo *streamingpb.ReplicatePChannelMeta) (replicationRemoved bool) {
|
|
prcMsg := message.MustAsImmutableAlterReplicateConfigMessageV2(msg)
|
|
replicateConfig := prcMsg.Header().ReplicateConfiguration
|
|
currentClusterID := paramtable.Get().CommonCfg.ClusterPrefix.GetValue()
|
|
currentCluster := replicateutil.MustNewConfigHelper(currentClusterID, replicateConfig).GetCurrentCluster()
|
|
_, err := currentCluster.GetTargetChannel(replicateInfo.GetSourceChannelName(),
|
|
replicateInfo.GetTargetCluster().GetClusterId())
|
|
if err != nil {
|
|
// Cannot find the target channel, it means that the `current->target` topology edge is removed,
|
|
// it means that the replication is removed.
|
|
return true
|
|
}
|
|
return false
|
|
}
|