Skip to content

Commit

Permalink
Debug logging for flake hunting
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Mar 27, 2024
1 parent 2f066de commit d65c345
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions go/test/endtoend/vreplication/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
Expand Down
4 changes: 0 additions & 4 deletions go/test/endtoend/vreplication/resharding_workflows_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions go/vt/vtctl/workflow/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit d65c345

Please sign in to comment.