Skip to content

Commit

Permalink
kvfollowerreadsccl: fix tests when run as secondary tenants
Browse files Browse the repository at this point in the history
We probabilistically run SQL using secondary tenant connections
in tests. This breaks TestBoundedStalenessDataDriven and
TestFollowerReadsWithStaleDescriptor.

TestBoundedStalenessDataDriven can't make assertions on log lines
originating from kv server as these are redacted before they're sent
to secondary tenants. This patch fixes this by flipping a cluster
setting to disable such redaction.

TestFollowerReadsWithStaleDescriptor is not as clear cut, so for now
we simply eschew running it with a secondary tenant.

Release note: None
  • Loading branch information
arulajmani committed Aug 10, 2022
1 parent f76e638 commit 9353f9c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions pkg/ccl/kvccl/kvfollowerreadsccl/boundedstaleness_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,13 @@ func TestBoundedStalenessDataDriven(t *testing.T) {
tc := testcluster.StartTestCluster(t, 3, clusterArgs)
defer tc.Stopper().Stop(ctx)

// This test may probabilistically execute its SQL as a secondary tenant. It
// also traces queries and makes assertions on whether log lines indicate
// requests were served via follower reads. As these log lines originate
// down in kvserver we disable their redaction.
systemTenantSQL := sqlutils.MakeSQLRunner(tc.StorageClusterConn())
systemTenantSQL.Exec(t, `SET CLUSTER SETTING server.secondary_tenants.redact_trace.enabled = 'false'`)

savedTraceStmt := ""
datadriven.RunTest(t, path, func(t *testing.T, d *datadriven.TestData) string {
// Early exit non-query execution related commands.
Expand Down
8 changes: 6 additions & 2 deletions pkg/ccl/kvccl/kvfollowerreadsccl/followerreads_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,13 +568,17 @@ func TestFollowerReadsWithStaleDescriptor(t *testing.T) {
tc := testcluster.StartTestCluster(t, 4,
base.TestClusterArgs{
ReplicationMode: base.ReplicationManual,
ServerArgs: base.TestServerArgs{UseDatabase: "t"},
ServerArgs: base.TestServerArgs{
DisableDefaultTestTenant: true,
UseDatabase: "t",
},
// n4 pretends to have low latency to n2 and n3, so that it tries to use
// them for follower reads.
// Also, we're going to collect a trace of the test's final query.
ServerArgsPerNode: map[int]base.TestServerArgs{
3: {
UseDatabase: "t",
DisableDefaultTestTenant: true,
UseDatabase: "t",
Knobs: base.TestingKnobs{
KVClient: &kvcoord.ClientTestingKnobs{
// Inhibit the checking of connection health done by the
Expand Down

0 comments on commit 9353f9c

Please sign in to comment.