Skip to content

Commit 05c1fa7

Browse files
committed
kvserver: test environment variable to disble async intent resolution
This commit adds a new test-only environment variable that disables async intent resolution (similarly to the `DisableAsyncIntentResolution` testing knob). This new variable will be useful in writing roachtests for the vistualized intent resolution work. Part of: #156800 Release note: None
1 parent 26a5f93 commit 05c1fa7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkg/kv/kvserver/intentresolver/intent_resolver.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ import (
3535
"github.com/cockroachdb/errors"
3636
)
3737

38+
// asyncIntentResolutionDisabled disables asynchronous intent resolution. It is
39+
// similar to DisableAsyncIntentResolution in IntentResolverTestingKnobs, but
40+
// for the use of roachtests.
41+
var asyncIntentResolutionDisabled = envutil.EnvOrDefaultBool(
42+
"COCKROACH_TEST_ONLY_ASYNC_INTENT_RESOLUTION_DISABLED", false,
43+
)
44+
3845
// defaultTaskLimit is the maximum number of asynchronous tasks that may be
3946
// started by intentResolver. When this limit is reached asynchronous tasks will
4047
// start to block to apply backpressure. This is a last line of defense against
@@ -491,7 +498,7 @@ func (ir *IntentResolver) MaybePushTransactions(
491498
func (ir *IntentResolver) runAsyncTask(
492499
origCtx context.Context, allowSyncProcessing bool, taskFn func(context.Context),
493500
) error {
494-
if ir.testingKnobs.DisableAsyncIntentResolution {
501+
if ir.testingKnobs.DisableAsyncIntentResolution || asyncIntentResolutionDisabled {
495502
return errors.New("intents not processed as async resolution is disabled")
496503
}
497504
ctx, hdl, err := ir.stopper.GetHandle(

0 commit comments

Comments
 (0)