From d65c3453160d9a2163b03d511f786296a1d34e03 Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Tue, 26 Mar 2024 22:58:21 -0400 Subject: [PATCH] Debug logging for flake hunting Signed-off-by: Matt Lord --- go/test/endtoend/vreplication/helper_test.go | 4 ++++ go/test/endtoend/vreplication/resharding_workflows_v2_test.go | 4 ---- go/vt/vtctl/workflow/server.go | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/go/test/endtoend/vreplication/helper_test.go b/go/test/endtoend/vreplication/helper_test.go index 19a4f731ec6..659c5330811 100644 --- a/go/test/endtoend/vreplication/helper_test.go +++ b/go/test/endtoend/vreplication/helper_test.go @@ -368,6 +368,7 @@ func waitForWorkflowState(t *testing.T, vc *VitessCluster, ksWorkflow string, wa streamInfos.ForEach(func(attributeKey, attributeValue gjson.Result) bool { // for each attribute in the stream // we need to wait for all streams to have the desired state state = attributeValue.Get("State").String() + t.Logf("Workflow %s, on %s, state: %s", ksWorkflow, tabletId.String(), state) if state == wantState { for i := 0; i < len(fieldEqualityChecks); i++ { if kvparts := strings.Split(fieldEqualityChecks[i], "=="); len(kvparts) == 2 { @@ -379,6 +380,9 @@ func waitForWorkflowState(t *testing.T, vc *VitessCluster, ksWorkflow string, wa } } } + if wantState == binlogdatapb.VReplicationWorkflowState_Running.String() && attributeValue.Get("Pos").String() == "" { + done = false + } } else { done = false } diff --git a/go/test/endtoend/vreplication/resharding_workflows_v2_test.go b/go/test/endtoend/vreplication/resharding_workflows_v2_test.go index f84f8d09da5..06127b628c7 100644 --- a/go/test/endtoend/vreplication/resharding_workflows_v2_test.go +++ b/go/test/endtoend/vreplication/resharding_workflows_v2_test.go @@ -446,9 +446,6 @@ func testReshardV2Workflow(t *testing.T) { createAdditionalCustomerShards(t, "-40,40-80,80-c0,c0-") createReshardWorkflow(t, "-80,80-", "-40,40-80,80-c0,c0-") - if !strings.Contains(lastOutput, "Status: Running") { - t.Fail() - } validateReadsRouteToSource(t, "replica") validateWritesRouteToSource(t) @@ -473,7 +470,6 @@ func testMoveTablesV2Workflow(t *testing.T) { // The purge table should get skipped/ignored // If it's not then we'll get an error as the table doesn't exist in the vschema createMoveTablesWorkflow(t, "customer,loadtest,vdiff_order,reftable,_vt_PURGE_4f9194b43b2011eb8a0104ed332e05c2_20221210194431") - require.Contains(t, lastOutput, "Status: Running") waitForWorkflowState(t, vc, ksWorkflow, binlogdatapb.VReplicationWorkflowState_Running.String()) validateReadsRouteToSource(t, "replica") validateWritesRouteToSource(t) diff --git a/go/vt/vtctl/workflow/server.go b/go/vt/vtctl/workflow/server.go index c29cd3228db..5cfe876eb9d 100644 --- a/go/vt/vtctl/workflow/server.go +++ b/go/vt/vtctl/workflow/server.go @@ -3285,10 +3285,14 @@ func (s *Server) canSwitch(ctx context.Context, ts *trafficSwitcher, state *Stat log.Infof("writes already switched no need to check lag") return "", nil } + ts.Logger().Infof("Checking if we can switch traffic for workflow %s.%s with starting state: %s", + state.TargetKeyspace, state.Workflow, state.String()) wf, err := s.GetWorkflow(ctx, state.TargetKeyspace, state.Workflow, false, shards) if err != nil { return "", err } + ts.Logger().Infof("Checking if we can switch traffic for workflow %s.%s with GetWorkflow result: %+v", + state.TargetKeyspace, state.Workflow, wf) for _, stream := range wf.ShardStreams { for _, st := range stream.GetStreams() { if st.Message == Frozen {