Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SHOW VITESS_REPLICATION_STATUS: Only use replication tracker when it's enabled #15348

Merged
merged 12 commits into from
Feb 26, 2024
Prev Previous commit
Next Next commit
Minor changes after self review
Signed-off-by: Matt Lord <mattalord@gmail.com>
  • Loading branch information
mattlord committed Feb 24, 2024
commit d24a354c65277024a094f0ce0b27c7ab4fa4e644
2 changes: 1 addition & 1 deletion go/test/endtoend/tabletgateway/vtgate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func TestVtgateReplicationStatusCheck(t *testing.T) {
require.NoError(t, err)
}
}()
// Stop replication on the non-primary tablets.
// Stop replication on the non-PRIMARY tablets.
_, err = clusterInstance.VtctldClientProcess.ExecuteCommandWithOutput("ExecuteFetchAsDBA", clusterInstance.Keyspaces[0].Shards[0].Replica().Alias, "stop slave")
require.NoError(t, err)
_, err = clusterInstance.VtctldClientProcess.ExecuteCommandWithOutput("ExecuteFetchAsDBA", clusterInstance.Keyspaces[0].Shards[0].Rdonly().Alias, "stop slave")
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -951,13 +951,13 @@
replLastError = row["Last_Error"].ToString()
if tabletenv.NewCurrentConfig().ReplicationTracker.Mode == tabletenv.Disable { // Use the value from mysqld
if row["Seconds_Behind_Master"].IsNull() {
replLag = "NULL" // Uppercase to match mysqld's output in SHOW REPLICA STATUS
replLag = strings.ToUpper(sqltypes.NullStr) // Uppercase to match mysqld's output in SHOW REPLICA STATUS
} else {
replLag = row["Seconds_Behind_Master"].ToString()

Check warning on line 956 in go/vt/vtgate/executor.go

View check run for this annotation

Codecov / codecov/patch

go/vt/vtgate/executor.go#L956

Added line #L956 was not covered by tests
}
} else { // Use the value we get from the replication tracker
if ts.Stats != nil {
replLag = fmt.Sprintf("%d", ts.Stats.ReplicationLagSeconds)

Check warning on line 960 in go/vt/vtgate/executor.go

View check run for this annotation

Codecov / codecov/patch

go/vt/vtgate/executor.go#L958-L960

Added lines #L958 - L960 were not covered by tests
}
}
}
Expand Down
Loading