Skip to content

Commit 41bde65

Browse files
craig[bot]rafiss
andcommitted
Merge #144307
144307: logictest: raise TxnLivenessThreshold for multitenant configs r=rafiss a=rafiss Logic tests are flaky due to overload when running in multitenant mode. This patch increases the threshold for transaction heartbeat timeouts, which will make it less likely for foreground operations to be aborted by background jobs like the span config reconciler or the job registry loop to reclaim jobs from dead sessions. This change was first added in a8ccd6b, but then was later reverted in 84079c9 since we fixed auto-retry behavior. I'm adding it back now since we are still seeing these flakes for statements/transactions that cannot be auto-retried. fixes #143660 fixes #143946 Release note: None Co-authored-by: Rafi Shamim <[email protected]>
2 parents 77c11b1 + bf6caf2 commit 41bde65

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

pkg/sql/logictest/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ go_library(
6262
"//pkg/kv/kvclient/rangefeed",
6363
"//pkg/kv/kvserver",
6464
"//pkg/kv/kvserver/kvserverbase",
65+
"//pkg/kv/kvserver/txnwait",
6566
"//pkg/multitenant/tenantcapabilities",
6667
"//pkg/multitenant/tenantcapabilitiespb",
6768
"//pkg/security/username",

pkg/sql/logictest/logic.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import (
4141
"github.com/cockroachdb/cockroach/pkg/kv/kvclient/rangefeed"
4242
"github.com/cockroachdb/cockroach/pkg/kv/kvserver"
4343
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/kvserverbase"
44+
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/txnwait"
4445
"github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilities"
4546
"github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilitiespb"
4647
"github.com/cockroachdb/cockroach/pkg/security/username"
@@ -4438,6 +4439,18 @@ func RunLogicTest(
44384439
if *printErrorSummary {
44394440
defer lt.printErrorSummary()
44404441
}
4442+
if config.UseSecondaryTenant == logictestbase.Always {
4443+
// Under multitenant configs running in EngFlow, we have seen that logic
4444+
// tests can be flaky due to an overload condition where schema change
4445+
// transactions do not heartbeat quickly enough. This prevents background
4446+
// jobs such as the spanconfig reconciler or the job registry "remove claims
4447+
// from dead sessions" loop from aborting the queries under test.
4448+
// See https://github.com/cockroachdb/cockroach/pull/140400#issuecomment-2634346278
4449+
// and https://github.com/cockroachdb/cockroach/issues/140494#issuecomment-2640208187
4450+
// for a detailed analysis of this issue.
4451+
cleanup := txnwait.TestingOverrideTxnLivenessThreshold(10 * time.Second)
4452+
defer cleanup()
4453+
}
44414454
// Each test needs a copy because of Parallel
44424455
serverArgsCopy := serverArgs
44434456
serverArgsCopy.ForceProductionValues = serverArgs.ForceProductionValues || nonMetamorphicBatchSizes

0 commit comments

Comments
 (0)