From 474804f7d50694d2be665bde57d2fabb213dc486 Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Mon, 19 Feb 2024 22:39:03 -0500 Subject: [PATCH 1/7] Handle case where there's no IDs in target shard's backing table. Signed-off-by: Matt Lord --- go/vt/vtctl/workflow/traffic_switcher.go | 12 ++++++++---- go/vt/wrangler/traffic_switcher.go | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/go/vt/vtctl/workflow/traffic_switcher.go b/go/vt/vtctl/workflow/traffic_switcher.go index 2a593cfb1db..0f1ada38e85 100644 --- a/go/vt/vtctl/workflow/traffic_switcher.go +++ b/go/vt/vtctl/workflow/traffic_switcher.go @@ -1435,10 +1435,14 @@ func (ts *trafficSwitcher) initializeTargetSequences(ctx context.Context, sequen return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s in order to initialize the backing sequence table: %v", ts.targetKeyspace, sequenceMetadata.usingTableName, terr) } - maxID, terr := sqltypes.Proto3ToResult(qr).Rows[0][0].ToInt64() - if terr != nil { - return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s in order to initialize the backing sequence table: %v", - ts.targetKeyspace, sequenceMetadata.usingTableName, terr) + rawVal := sqltypes.Proto3ToResult(qr).Rows[0][0] + maxID := int64(0) + if !rawVal.IsNull() { // If it's NULL then there are no rows and 0 remains the max + maxID, terr = rawVal.ToInt64() + if terr != nil { + return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s in order to initialize the backing sequence table: %v", + ts.targetKeyspace, sequenceMetadata.usingTableName, terr) + } } srMu.Lock() defer srMu.Unlock() diff --git a/go/vt/wrangler/traffic_switcher.go b/go/vt/wrangler/traffic_switcher.go index 9e7e133cd1f..f21dbd12ee1 100644 --- a/go/vt/wrangler/traffic_switcher.go +++ b/go/vt/wrangler/traffic_switcher.go @@ -2200,10 +2200,14 @@ func (ts *trafficSwitcher) initializeTargetSequences(ctx context.Context, sequen return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s in order to initialize the backing sequence table: %v", ts.targetKeyspace, sequenceMetadata.usingTableName, terr) } - maxID, terr := sqltypes.Proto3ToResult(qr).Rows[0][0].ToInt64() - if terr != nil { - return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s in order to initialize the backing sequence table: %v", - ts.targetKeyspace, sequenceMetadata.usingTableName, terr) + rawVal := sqltypes.Proto3ToResult(qr).Rows[0][0] + maxID := int64(0) + if !rawVal.IsNull() { // If it's NULL then there are no rows and 0 remains the max + maxID, terr = rawVal.ToInt64() + if terr != nil { + return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s in order to initialize the backing sequence table: %v", + ts.targetKeyspace, sequenceMetadata.usingTableName, terr) + } } srMu.Lock() defer srMu.Unlock() From 767840ea6285fed78703a3449782d951b58f2364 Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Mon, 19 Feb 2024 23:11:36 -0500 Subject: [PATCH 2/7] Move target sequence init before point of no return Signed-off-by: Matt Lord --- go/vt/vtctl/workflow/server.go | 25 ++++++++++++++----------- go/vt/wrangler/traffic_switcher.go | 25 ++++++++++++++----------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/go/vt/vtctl/workflow/server.go b/go/vt/vtctl/workflow/server.go index e298d3f64f3..496a4650d3e 100644 --- a/go/vt/vtctl/workflow/server.go +++ b/go/vt/vtctl/workflow/server.go @@ -3301,6 +3301,20 @@ func (s *Server) switchWrites(ctx context.Context, req *vtctldatapb.WorkflowSwit sw.cancelMigration(ctx, sm) return handleError("failed to create the reverse vreplication streams", err) } + + // Initialize any target sequences, if there are any, before allowing new writes. + if req.InitializeTargetSequences && len(sequenceMetadata) > 0 { + ts.Logger().Infof("Initializing target sequences") + // Writes are blocked so we can safely initialize the sequence tables but + // we also want to use a shorter timeout than the parent context. + // We use up at most half of the overall timeout. + initSeqCtx, cancel := context.WithTimeout(ctx, timeout/2) + defer cancel() + if err := sw.initializeTargetSequences(initSeqCtx, sequenceMetadata); err != nil { + sw.cancelMigration(ctx, sm) + return handleError(fmt.Sprintf("failed to initialize the sequences used in the %s keyspace", ts.TargetKeyspaceName()), err) + } + } } else { if cancel { return handleError("invalid cancel", vterrors.Errorf(vtrpcpb.Code_FAILED_PRECONDITION, "traffic switching has reached the point of no return, cannot cancel")) @@ -3317,17 +3331,6 @@ func (s *Server) switchWrites(ctx context.Context, req *vtctldatapb.WorkflowSwit if err := sw.createJournals(ctx, sourceWorkflows); err != nil { return handleError("failed to create the journal", err) } - // Initialize any target sequences, if there are any, before allowing new writes. - if req.InitializeTargetSequences && len(sequenceMetadata) > 0 { - // Writes are blocked so we can safely initialize the sequence tables but - // we also want to use a shorter timeout than the parent context. - // We use up at most half of the overall timeout. - initSeqCtx, cancel := context.WithTimeout(ctx, timeout/2) - defer cancel() - if err := sw.initializeTargetSequences(initSeqCtx, sequenceMetadata); err != nil { - return handleError(fmt.Sprintf("failed to initialize the sequences used in the %s keyspace", ts.TargetKeyspaceName()), err) - } - } if err := sw.allowTargetWrites(ctx); err != nil { return handleError(fmt.Sprintf("failed to allow writes in the %s keyspace", ts.TargetKeyspaceName()), err) } diff --git a/go/vt/wrangler/traffic_switcher.go b/go/vt/wrangler/traffic_switcher.go index f21dbd12ee1..ff25384f5cf 100644 --- a/go/vt/wrangler/traffic_switcher.go +++ b/go/vt/wrangler/traffic_switcher.go @@ -619,6 +619,20 @@ func (wr *Wrangler) SwitchWrites(ctx context.Context, targetKeyspace, workflowNa sw.cancelMigration(ctx, sm) return handleError("failed to create the reverse vreplication streams", err) } + + // Initialize any target sequences, if there are any, before allowing new writes. + if initializeTargetSequences && len(sequenceMetadata) > 0 { + ts.Logger().Infof("Initializing target sequences") + // Writes are blocked so we can safely initialize the sequence tables but + // we also want to use a shorter timeout than the parent context. + // We use up at most half of the overall timeout. + initSeqCtx, cancel := context.WithTimeout(ctx, timeout/2) + defer cancel() + if err := sw.initializeTargetSequences(initSeqCtx, sequenceMetadata); err != nil { + sw.cancelMigration(ctx, sm) + return handleError(fmt.Sprintf("failed to initialize the sequences used in the %s keyspace", ts.TargetKeyspaceName()), err) + } + } } else { if cancel { return handleError("invalid cancel", fmt.Errorf("traffic switching has reached the point of no return, cannot cancel")) @@ -635,17 +649,6 @@ func (wr *Wrangler) SwitchWrites(ctx context.Context, targetKeyspace, workflowNa if err := sw.createJournals(ctx, sourceWorkflows); err != nil { return handleError("failed to create the journal", err) } - // Initialize any target sequences, if there are any, before allowing new writes. - if initializeTargetSequences && len(sequenceMetadata) > 0 { - // Writes are blocked so we can safely initialize the sequence tables but - // we also want to use a shorter timeout than the parent context. - // We use up at most half of the overall timeout. - initSeqCtx, cancel := context.WithTimeout(ctx, timeout/2) - defer cancel() - if err := sw.initializeTargetSequences(initSeqCtx, sequenceMetadata); err != nil { - return handleError(fmt.Sprintf("failed to initialize the sequences used in the %s keyspace", ts.TargetKeyspaceName()), err) - } - } if err := sw.allowTargetWrites(ctx); err != nil { return handleError(fmt.Sprintf("failed to allow writes in the %s keyspace", ts.TargetKeyspaceName()), err) } From 99275eb738a4b3b06df9ba3000eb0ac7890eb836 Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Mon, 19 Feb 2024 23:56:11 -0500 Subject: [PATCH 3/7] Update tests Signed-off-by: Matt Lord --- go/vt/wrangler/traffic_switcher_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/vt/wrangler/traffic_switcher_test.go b/go/vt/wrangler/traffic_switcher_test.go index df1eebc013a..e1ae1ce908f 100644 --- a/go/vt/wrangler/traffic_switcher_test.go +++ b/go/vt/wrangler/traffic_switcher_test.go @@ -1011,8 +1011,8 @@ func TestTableMigrateOneToManyDryRun(t *testing.T) { "\tKeyspace ks1, Shard 0 at Position MariaDB/5-456-892", "Wait for VReplication on stopped streams to catchup for up to 1s", "Create reverse replication workflow test_reverse", - "Create journal entries on source databases", "The following sequence backing tables used by tables being moved will be initialized: t1_seq,t2_seq", + "Create journal entries on source databases", "Enable writes on keyspace ks2 tables [t1,t2]", "Switch routing from keyspace ks1 to keyspace ks2", "Routing rules for tables [t1,t2] will be updated", From f7fc807f45b09791b728863cccc6f02f69f88fff Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Tue, 20 Feb 2024 00:22:57 -0500 Subject: [PATCH 4/7] Improve error message Signed-off-by: Matt Lord --- go/vt/vtctl/workflow/traffic_switcher.go | 8 ++++---- go/vt/wrangler/traffic_switcher.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/go/vt/vtctl/workflow/traffic_switcher.go b/go/vt/vtctl/workflow/traffic_switcher.go index 0f1ada38e85..bbfeb0c79ad 100644 --- a/go/vt/vtctl/workflow/traffic_switcher.go +++ b/go/vt/vtctl/workflow/traffic_switcher.go @@ -1432,16 +1432,16 @@ func (ts *trafficSwitcher) initializeTargetSequences(ctx context.Context, sequen MaxRows: 1, }) if terr != nil || len(qr.Rows) != 1 { - return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s in order to initialize the backing sequence table: %v", - ts.targetKeyspace, sequenceMetadata.usingTableName, terr) + return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s on tablet %v in order to initialize the backing sequence table: %v", + ts.targetKeyspace, sequenceMetadata.usingTableName, primary.Alias, terr) } rawVal := sqltypes.Proto3ToResult(qr).Rows[0][0] maxID := int64(0) if !rawVal.IsNull() { // If it's NULL then there are no rows and 0 remains the max maxID, terr = rawVal.ToInt64() if terr != nil { - return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s in order to initialize the backing sequence table: %v", - ts.targetKeyspace, sequenceMetadata.usingTableName, terr) + return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s on tablet %v in order to initialize the backing sequence table: %v", + ts.targetKeyspace, sequenceMetadata.usingTableName, primary.Alias, terr) } } srMu.Lock() diff --git a/go/vt/wrangler/traffic_switcher.go b/go/vt/wrangler/traffic_switcher.go index ff25384f5cf..ee9b0ebd9be 100644 --- a/go/vt/wrangler/traffic_switcher.go +++ b/go/vt/wrangler/traffic_switcher.go @@ -2200,16 +2200,16 @@ func (ts *trafficSwitcher) initializeTargetSequences(ctx context.Context, sequen ) qr, terr := ts.wr.ExecuteFetchAsApp(ictx, primary.GetAlias(), true, query.Query, 1) if terr != nil || len(qr.Rows) != 1 { - return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s in order to initialize the backing sequence table: %v", - ts.targetKeyspace, sequenceMetadata.usingTableName, terr) + return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s on tablet %v in order to initialize the backing sequence table: %v", + ts.targetKeyspace, sequenceMetadata.usingTableName, primary.Alias, terr) } rawVal := sqltypes.Proto3ToResult(qr).Rows[0][0] maxID := int64(0) if !rawVal.IsNull() { // If it's NULL then there are no rows and 0 remains the max maxID, terr = rawVal.ToInt64() if terr != nil { - return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s in order to initialize the backing sequence table: %v", - ts.targetKeyspace, sequenceMetadata.usingTableName, terr) + return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s on tablet %v in order to initialize the backing sequence table: %v", + ts.targetKeyspace, sequenceMetadata.usingTableName, primary.Alias, terr) } } srMu.Lock() From ee99551f6a2dc435eb3332e85641b41c27648ccc Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Tue, 20 Feb 2024 07:42:05 -0500 Subject: [PATCH 5/7] Update unit test to catch failure Signed-off-by: Matt Lord --- go/sqltypes/testing.go | 2 +- go/vt/wrangler/traffic_switcher_env_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go/sqltypes/testing.go b/go/sqltypes/testing.go index 63589ee9567..649462333c7 100644 --- a/go/sqltypes/testing.go +++ b/go/sqltypes/testing.go @@ -76,7 +76,7 @@ func MakeTestResult(fields []*querypb.Field, rows ...string) *Result { for i, row := range rows { result.Rows[i] = make([]Value, len(fields)) for j, col := range split(row) { - if col == "null" { + if strings.ToLower(col) == "null" { result.Rows[i][j] = NULL continue } diff --git a/go/vt/wrangler/traffic_switcher_env_test.go b/go/vt/wrangler/traffic_switcher_env_test.go index 9134bb8917e..3838ded0669 100644 --- a/go/vt/wrangler/traffic_switcher_env_test.go +++ b/go/vt/wrangler/traffic_switcher_env_test.go @@ -258,7 +258,7 @@ func newTestTableMigraterCustom(ctx context.Context, t *testing.T, sourceShards, "maxval", "int64", ), - "5", + "NULL", ), ) tme.tmeDB.AddQuery(fmt.Sprintf(maxValForSequence, "ks2", "t2"), @@ -274,7 +274,7 @@ func newTestTableMigraterCustom(ctx context.Context, t *testing.T, sourceShards, // Now tell the fakesqldb used by the global keyspace tablets to expect // the sequence management related queries against the target keyspace. gfdb.AddQuery( - sqlparser.BuildParsedQuery(sqlInitSequenceTable, sqlescape.EscapeID("vt_global"), sqlescape.EscapeID("t1_seq"), 6, 6, 6).Query, + sqlparser.BuildParsedQuery(sqlInitSequenceTable, sqlescape.EscapeID("vt_global"), sqlescape.EscapeID("t1_seq"), 1, 1, 1).Query, &sqltypes.Result{RowsAffected: 0}, ) gfdb.AddQuery( From 05e049b0a7a9da14dc58b9be28a10a97da9f562c Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Tue, 20 Feb 2024 12:38:47 -0500 Subject: [PATCH 6/7] Address review comments Signed-off-by: Matt Lord --- go/vt/vtctl/workflow/server.go | 2 +- go/vt/vtctl/workflow/traffic_switcher.go | 5 +++-- go/vt/wrangler/traffic_switcher.go | 7 ++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/go/vt/vtctl/workflow/server.go b/go/vt/vtctl/workflow/server.go index 496a4650d3e..5e9f3fc9300 100644 --- a/go/vt/vtctl/workflow/server.go +++ b/go/vt/vtctl/workflow/server.go @@ -3307,7 +3307,7 @@ func (s *Server) switchWrites(ctx context.Context, req *vtctldatapb.WorkflowSwit ts.Logger().Infof("Initializing target sequences") // Writes are blocked so we can safely initialize the sequence tables but // we also want to use a shorter timeout than the parent context. - // We use up at most half of the overall timeout. + // We use at most half of the overall timeout. initSeqCtx, cancel := context.WithTimeout(ctx, timeout/2) defer cancel() if err := sw.initializeTargetSequences(initSeqCtx, sequenceMetadata); err != nil { diff --git a/go/vt/vtctl/workflow/traffic_switcher.go b/go/vt/vtctl/workflow/traffic_switcher.go index bbfeb0c79ad..3f40bd99f0a 100644 --- a/go/vt/vtctl/workflow/traffic_switcher.go +++ b/go/vt/vtctl/workflow/traffic_switcher.go @@ -38,6 +38,7 @@ import ( "vitess.io/vitess/go/vt/logutil" "vitess.io/vitess/go/vt/sqlparser" "vitess.io/vitess/go/vt/topo" + "vitess.io/vitess/go/vt/topo/topoproto" "vitess.io/vitess/go/vt/topotools" "vitess.io/vitess/go/vt/vterrors" "vitess.io/vitess/go/vt/vtgate/vindexes" @@ -1433,7 +1434,7 @@ func (ts *trafficSwitcher) initializeTargetSequences(ctx context.Context, sequen }) if terr != nil || len(qr.Rows) != 1 { return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s on tablet %v in order to initialize the backing sequence table: %v", - ts.targetKeyspace, sequenceMetadata.usingTableName, primary.Alias, terr) + ts.targetKeyspace, sequenceMetadata.usingTableName, topoproto.TabletAliasString(primary.Alias), terr) } rawVal := sqltypes.Proto3ToResult(qr).Rows[0][0] maxID := int64(0) @@ -1441,7 +1442,7 @@ func (ts *trafficSwitcher) initializeTargetSequences(ctx context.Context, sequen maxID, terr = rawVal.ToInt64() if terr != nil { return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s on tablet %v in order to initialize the backing sequence table: %v", - ts.targetKeyspace, sequenceMetadata.usingTableName, primary.Alias, terr) + ts.targetKeyspace, sequenceMetadata.usingTableName, topoproto.TabletAliasString(primary.Alias), terr) } } srMu.Lock() diff --git a/go/vt/wrangler/traffic_switcher.go b/go/vt/wrangler/traffic_switcher.go index ee9b0ebd9be..fa787025e59 100644 --- a/go/vt/wrangler/traffic_switcher.go +++ b/go/vt/wrangler/traffic_switcher.go @@ -40,6 +40,7 @@ import ( "vitess.io/vitess/go/vt/logutil" "vitess.io/vitess/go/vt/sqlparser" "vitess.io/vitess/go/vt/topo" + "vitess.io/vitess/go/vt/topo/topoproto" "vitess.io/vitess/go/vt/topotools" "vitess.io/vitess/go/vt/vtctl/workflow" "vitess.io/vitess/go/vt/vterrors" @@ -625,7 +626,7 @@ func (wr *Wrangler) SwitchWrites(ctx context.Context, targetKeyspace, workflowNa ts.Logger().Infof("Initializing target sequences") // Writes are blocked so we can safely initialize the sequence tables but // we also want to use a shorter timeout than the parent context. - // We use up at most half of the overall timeout. + // We use at most half of the overall timeout. initSeqCtx, cancel := context.WithTimeout(ctx, timeout/2) defer cancel() if err := sw.initializeTargetSequences(initSeqCtx, sequenceMetadata); err != nil { @@ -2201,7 +2202,7 @@ func (ts *trafficSwitcher) initializeTargetSequences(ctx context.Context, sequen qr, terr := ts.wr.ExecuteFetchAsApp(ictx, primary.GetAlias(), true, query.Query, 1) if terr != nil || len(qr.Rows) != 1 { return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s on tablet %v in order to initialize the backing sequence table: %v", - ts.targetKeyspace, sequenceMetadata.usingTableName, primary.Alias, terr) + ts.targetKeyspace, sequenceMetadata.usingTableName, topoproto.TabletAliasString(primary.Alias), terr) } rawVal := sqltypes.Proto3ToResult(qr).Rows[0][0] maxID := int64(0) @@ -2209,7 +2210,7 @@ func (ts *trafficSwitcher) initializeTargetSequences(ctx context.Context, sequen maxID, terr = rawVal.ToInt64() if terr != nil { return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s on tablet %v in order to initialize the backing sequence table: %v", - ts.targetKeyspace, sequenceMetadata.usingTableName, primary.Alias, terr) + ts.targetKeyspace, sequenceMetadata.usingTableName, topoproto.TabletAliasString(primary.Alias), terr) } } srMu.Lock() From d3d05ac38542dd96f6407804b6795e8832985e72 Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Tue, 20 Feb 2024 12:42:40 -0500 Subject: [PATCH 7/7] Nits after final self review Signed-off-by: Matt Lord --- go/vt/vtctl/workflow/traffic_switcher.go | 4 ++-- go/vt/wrangler/traffic_switcher.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go/vt/vtctl/workflow/traffic_switcher.go b/go/vt/vtctl/workflow/traffic_switcher.go index 3f40bd99f0a..c8551c5ff73 100644 --- a/go/vt/vtctl/workflow/traffic_switcher.go +++ b/go/vt/vtctl/workflow/traffic_switcher.go @@ -1433,7 +1433,7 @@ func (ts *trafficSwitcher) initializeTargetSequences(ctx context.Context, sequen MaxRows: 1, }) if terr != nil || len(qr.Rows) != 1 { - return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s on tablet %v in order to initialize the backing sequence table: %v", + return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s on tablet %s in order to initialize the backing sequence table: %v", ts.targetKeyspace, sequenceMetadata.usingTableName, topoproto.TabletAliasString(primary.Alias), terr) } rawVal := sqltypes.Proto3ToResult(qr).Rows[0][0] @@ -1441,7 +1441,7 @@ func (ts *trafficSwitcher) initializeTargetSequences(ctx context.Context, sequen if !rawVal.IsNull() { // If it's NULL then there are no rows and 0 remains the max maxID, terr = rawVal.ToInt64() if terr != nil { - return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s on tablet %v in order to initialize the backing sequence table: %v", + return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s on tablet %s in order to initialize the backing sequence table: %v", ts.targetKeyspace, sequenceMetadata.usingTableName, topoproto.TabletAliasString(primary.Alias), terr) } } diff --git a/go/vt/wrangler/traffic_switcher.go b/go/vt/wrangler/traffic_switcher.go index fa787025e59..a6b3587c3a1 100644 --- a/go/vt/wrangler/traffic_switcher.go +++ b/go/vt/wrangler/traffic_switcher.go @@ -2201,7 +2201,7 @@ func (ts *trafficSwitcher) initializeTargetSequences(ctx context.Context, sequen ) qr, terr := ts.wr.ExecuteFetchAsApp(ictx, primary.GetAlias(), true, query.Query, 1) if terr != nil || len(qr.Rows) != 1 { - return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s on tablet %v in order to initialize the backing sequence table: %v", + return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s on tablet %s in order to initialize the backing sequence table: %v", ts.targetKeyspace, sequenceMetadata.usingTableName, topoproto.TabletAliasString(primary.Alias), terr) } rawVal := sqltypes.Proto3ToResult(qr).Rows[0][0] @@ -2209,7 +2209,7 @@ func (ts *trafficSwitcher) initializeTargetSequences(ctx context.Context, sequen if !rawVal.IsNull() { // If it's NULL then there are no rows and 0 remains the max maxID, terr = rawVal.ToInt64() if terr != nil { - return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s on tablet %v in order to initialize the backing sequence table: %v", + return vterrors.Errorf(vtrpcpb.Code_INTERNAL, "failed to get the max used sequence value for target table %s.%s on tablet %s in order to initialize the backing sequence table: %v", ts.targetKeyspace, sequenceMetadata.usingTableName, topoproto.TabletAliasString(primary.Alias), terr) } }