From 151779b0f2b13efcab964efa1da02dcc8a55ba38 Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Wed, 4 Dec 2024 08:29:36 -0500 Subject: [PATCH 1/4] =?UTF-8?q?Don=E2=80=99t=20mongos-refresh=20on=20desti?= =?UTF-8?q?nation=20clusters.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/verifier/uri.go | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/internal/verifier/uri.go b/internal/verifier/uri.go index abd71e18..5d91e0c1 100644 --- a/internal/verifier/uri.go +++ b/internal/verifier/uri.go @@ -57,20 +57,8 @@ func (verifier *Verifier) SetDstURI(ctx context.Context, uri string) error { verifier.dstClusterInfo = &clusterInfo - if clusterInfo.Topology == util.TopologySharded { - err := RefreshAllMongosInstances( - ctx, - verifier.logger, - opts, - ) - - if err != nil { - return errors.Wrap( - err, - "failed to refresh source mongos instances", - ) - } - } + // NB: Destination clusters don’t need mongoses refreshed + // as source clusters do. return checkURIAgainstServerVersion(uri, clusterInfo) } From 2bd86d0fa63812f702ea95317c72beb508a74942 Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Wed, 4 Dec 2024 08:32:22 -0500 Subject: [PATCH 2/4] mongos refresh only on pre-v5 --- internal/verifier/uri.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/internal/verifier/uri.go b/internal/verifier/uri.go index 5d91e0c1..1d132687 100644 --- a/internal/verifier/uri.go +++ b/internal/verifier/uri.go @@ -24,7 +24,7 @@ func (verifier *Verifier) SetSrcURI(ctx context.Context, uri string) error { verifier.srcClusterInfo = &clusterInfo - if clusterInfo.Topology == util.TopologySharded { + if clusterInfo.VersionArray[0] < 5 && clusterInfo.Topology == util.TopologySharded { err := RefreshAllMongosInstances( ctx, verifier.logger, @@ -57,8 +57,20 @@ func (verifier *Verifier) SetDstURI(ctx context.Context, uri string) error { verifier.dstClusterInfo = &clusterInfo - // NB: Destination clusters don’t need mongoses refreshed - // as source clusters do. + if clusterInfo.VersionArray[0] < 5 && clusterInfo.Topology == util.TopologySharded { + err := RefreshAllMongosInstances( + ctx, + verifier.logger, + opts, + ) + + if err != nil { + return errors.Wrap( + err, + "failed to refresh destination mongos instances", + ) + } + } return checkURIAgainstServerVersion(uri, clusterInfo) } From 52c07de6a68417f1b299b7f4c6a61983ad1399c2 Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Wed, 4 Dec 2024 08:33:51 -0500 Subject: [PATCH 3/4] trim --- internal/verifier/uri.go | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/internal/verifier/uri.go b/internal/verifier/uri.go index 1d132687..e28d3a35 100644 --- a/internal/verifier/uri.go +++ b/internal/verifier/uri.go @@ -57,20 +57,8 @@ func (verifier *Verifier) SetDstURI(ctx context.Context, uri string) error { verifier.dstClusterInfo = &clusterInfo - if clusterInfo.VersionArray[0] < 5 && clusterInfo.Topology == util.TopologySharded { - err := RefreshAllMongosInstances( - ctx, - verifier.logger, - opts, - ) - - if err != nil { - return errors.Wrap( - err, - "failed to refresh destination mongos instances", - ) - } - } + // We needn't refresh mongoses on the destination, + // regardless of server version. return checkURIAgainstServerVersion(uri, clusterInfo) } From beb94a28b7cce28655eb2d1fada15106f5a6c63b Mon Sep 17 00:00:00 2001 From: Felipe Gasper Date: Wed, 4 Dec 2024 08:35:55 -0500 Subject: [PATCH 4/4] restore --- internal/verifier/uri.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/internal/verifier/uri.go b/internal/verifier/uri.go index e28d3a35..1d132687 100644 --- a/internal/verifier/uri.go +++ b/internal/verifier/uri.go @@ -57,8 +57,20 @@ func (verifier *Verifier) SetDstURI(ctx context.Context, uri string) error { verifier.dstClusterInfo = &clusterInfo - // We needn't refresh mongoses on the destination, - // regardless of server version. + if clusterInfo.VersionArray[0] < 5 && clusterInfo.Topology == util.TopologySharded { + err := RefreshAllMongosInstances( + ctx, + verifier.logger, + opts, + ) + + if err != nil { + return errors.Wrap( + err, + "failed to refresh destination mongos instances", + ) + } + } return checkURIAgainstServerVersion(uri, clusterInfo) }