Skip to content

sql: fix lease duration in TestReacquireLeaseOnRestart#157189

Merged
craig[bot] merged 3 commits intocockroachdb:masterfrom
pav-kv:reacquire-lease-test-multitenancy
Nov 12, 2025
Merged

sql: fix lease duration in TestReacquireLeaseOnRestart#157189
craig[bot] merged 3 commits intocockroachdb:masterfrom
pav-kv:reacquire-lease-test-multitenancy

Conversation

@pav-kv
Copy link
Copy Markdown
Collaborator

@pav-kv pav-kv commented Nov 11, 2025

The test jumps the clock forward in order to expire KV leases. However, the DefaultDescriptorLeaseDuration constant that it chooses seems to be by mistake taken as the KV lease duration. Use the RangeLeaseDuration from the server config instead.

This also fixes early SQL pod termination when multi-tenancy is enabled. Currently, the lifetime of the SQL pod is the same as that of the session, which has a TTL of 40s (server.sqlliveness.ttl setting). The 10 minute clock jump in this test was causing early SQL pod termination and flakes.

Resolves #156333

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@pav-kv pav-kv force-pushed the reacquire-lease-test-multitenancy branch from bdaa594 to 8debd83 Compare November 11, 2025 12:51
@github-actions
Copy link
Copy Markdown
Contributor

Potential Bug(s) Detected

The three-stage Claude Code analysis has identified potential bug(s) in this PR that may warrant investigation.

Next Steps:
Please review the detailed findings in the workflow run.

Note: When viewing the workflow output, scroll to the bottom to find the Final Analysis Summary.

After you review the findings, please tag the issue as follows:

  • If the detected issue is real or was helpful in any way, please tag the issue with O-AI-Review-Real-Issue-Found
  • If the detected issue was not helpful in any way, please tag the issue with O-AI-Review-Not-Helpful

@github-actions github-actions bot added the o-AI-Review-Potential-Issue-Detected AI reviewer found potential issue. Never assign manually—auto-applied by GH action only. label Nov 11, 2025
@pav-kv pav-kv force-pushed the reacquire-lease-test-multitenancy branch 2 times, most recently from a165f18 to b2f1d17 Compare November 11, 2025 12:56
@pav-kv pav-kv added the O-AI-Review-Real-Issue-Found AI reviewer found real issue label Nov 11, 2025
@github-actions
Copy link
Copy Markdown
Contributor

Potential Bug(s) Detected

The three-stage Claude Code analysis has identified potential bug(s) in this PR that may warrant investigation.

Next Steps:
Please review the detailed findings in the workflow run.

Note: When viewing the workflow output, scroll to the bottom to find the Final Analysis Summary.

After you review the findings, please tag the issue as follows:

  • If the detected issue is real or was helpful in any way, please tag the issue with O-AI-Review-Real-Issue-Found
  • If the detected issue was not helpful in any way, please tag the issue with O-AI-Review-Not-Helpful

@pav-kv pav-kv force-pushed the reacquire-lease-test-multitenancy branch from b2f1d17 to 7619339 Compare November 11, 2025 13:21
Copy link
Copy Markdown
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@yuzefovich reviewed 1 of 1 files at r1, 1 of 1 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @stevendanna)


pkg/sql/txn_restart_test.go line 1302 at r2 (raw file):

	params.Knobs.Store = storeTestingKnobs
	params.Knobs.KVClient = clientTestingKnobs
	params.DefaultTestTenant = base.TestTenantProbabilisticOnly

nit: simply leave DefaultTestTenant unset (which is the same as TestTenantProbabilisticOnly).

The test jumps the clock forward in order to expire KV leases. However,
the DefaultDescriptorLeaseDuration constant that it chooses seems to be
by mistake taken as the KV lease duration. Use the RangeLeaseDuration
from the server config instead.

This also fixes early SQL pod termination when multi-tenancy is enabled.
Currently, the lifetime of the SQL pod is the same as that of the
session, which has a TTL of 40s (server.sqlliveness.ttl setting).  The
10 minute clock jump in this test was causing early SQL pod termination
and flakes.

Epic: none
Release note: none
@pav-kv pav-kv force-pushed the reacquire-lease-test-multitenancy branch from 7619339 to 109bdbb Compare November 12, 2025 19:31
@pav-kv
Copy link
Copy Markdown
Collaborator Author

pav-kv commented Nov 12, 2025

TFTR!

bors r=yuzefovich

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Nov 12, 2025

@craig craig bot merged commit 74479fb into cockroachdb:master Nov 12, 2025
23 of 24 checks passed
@pav-kv pav-kv deleted the reacquire-lease-test-multitenancy branch November 18, 2025 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

o-AI-Review-Potential-Issue-Detected AI reviewer found potential issue. Never assign manually—auto-applied by GH action only. O-AI-Review-Real-Issue-Found AI reviewer found real issue v26.1.0-prerelease

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sql: investigate occasional failures in TestReacquireLeaseOnRestart with test tenants

3 participants