From 9353f9c34b46bd53224004d40319f333ba76a3a3 Mon Sep 17 00:00:00 2001 From: Arul Ajmani Date: Wed, 10 Aug 2022 11:00:10 -0400 Subject: [PATCH] kvfollowerreadsccl: fix tests when run as secondary tenants 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 --- pkg/ccl/kvccl/kvfollowerreadsccl/boundedstaleness_test.go | 7 +++++++ pkg/ccl/kvccl/kvfollowerreadsccl/followerreads_test.go | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pkg/ccl/kvccl/kvfollowerreadsccl/boundedstaleness_test.go b/pkg/ccl/kvccl/kvfollowerreadsccl/boundedstaleness_test.go index 2cdfc0a03566..a056d8ba5ee2 100644 --- a/pkg/ccl/kvccl/kvfollowerreadsccl/boundedstaleness_test.go +++ b/pkg/ccl/kvccl/kvfollowerreadsccl/boundedstaleness_test.go @@ -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. diff --git a/pkg/ccl/kvccl/kvfollowerreadsccl/followerreads_test.go b/pkg/ccl/kvccl/kvfollowerreadsccl/followerreads_test.go index d208aada388d..2c1d8e09b39a 100644 --- a/pkg/ccl/kvccl/kvfollowerreadsccl/followerreads_test.go +++ b/pkg/ccl/kvccl/kvfollowerreadsccl/followerreads_test.go @@ -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