Skip to content

kvserver/closedts: add TestPolicyRefresherWithLatencies#144482

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
wenyihu6:policyrefreshertests
Apr 24, 2025
Merged

kvserver/closedts: add TestPolicyRefresherWithLatencies#144482
craig[bot] merged 1 commit intocockroachdb:masterfrom
wenyihu6:policyrefreshertests

Conversation

@wenyihu6
Copy link
Copy Markdown
Contributor

@wenyihu6 wenyihu6 commented Apr 15, 2025

This commit adds a new test, TestPolicyRefresherWithLatencies, which verifies
that the policy refresher correctly updates latency information using mocked
latency map data.

Resolves: #143888
Release note: none

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@wenyihu6
Copy link
Copy Markdown
Contributor Author

I recall you mentioned we prefer testing as much as possible sync rather than async. So I'm manually invoking the methods and verifying the expected outcomes here. Alternatively, we could call pr.Run() and use SucceedsSoon to observe the results.

@wenyihu6 wenyihu6 marked this pull request as ready for review April 15, 2025 15:36
@wenyihu6 wenyihu6 requested a review from a team as a code owner April 15, 2025 15:36
@wenyihu6 wenyihu6 requested a review from arulajmani April 15, 2025 15:36
@wenyihu6 wenyihu6 force-pushed the policyrefreshertests branch from ccd2b08 to d209694 Compare April 15, 2025 15:39
@wenyihu6 wenyihu6 force-pushed the policyrefreshertests branch from d209694 to 3688eb4 Compare April 23, 2025 15:32
Copy link
Copy Markdown
Contributor Author

@wenyihu6 wenyihu6 left a comment

Choose a reason for hiding this comment

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

Do we consider #143888 resolved with this PR? I recall there was some interest in adding roachtests with more distant regions. I've enabled auto-tuning metamorphically for all existing follower reads roachtests, so auto-tuning will be tested regardless of region distance or latency. So far, there haven't been any real test failures. If we want to extend test coverage, we can add tests involving more distant regions but it may introduce some flakiness. Wdyt?

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @arulajmani)

Copy link
Copy Markdown
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

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

:lgtm:

Let's chat about whether we want to add any more roachtests before closing the linked issue offline.

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @wenyihu6)


pkg/kv/kvserver/closedts/policyrefresher/policy_refresher_test.go line 292 at r2 (raw file):

	// Enable global reads and set furthest node to 1. We should get
	// LEAD_FOR_GLOBAL_READS_WITH_NO_LATENCY_INFO policy before cache update.

nit: "before the cache update"

Copy link
Copy Markdown
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

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

Actually, not much to chat -- I just checked, and the current follower reads roachtests uses us-east, us-west, and eu-west as the regions. That should place replicas in different buckets, so we should have good coverage with the metamorphic changes. Let's close #143888 out.

Great work here!

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @wenyihu6)

@wenyihu6 wenyihu6 force-pushed the policyrefreshertests branch from 3688eb4 to e246347 Compare April 23, 2025 23:49
Copy link
Copy Markdown
Contributor Author

@wenyihu6 wenyihu6 left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @arulajmani)


pkg/kv/kvserver/closedts/policyrefresher/policy_refresher_test.go line 292 at r2 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

nit: "before the cache update"

Done.

@wenyihu6 wenyihu6 force-pushed the policyrefreshertests branch from e246347 to 1c7efbc Compare April 24, 2025 00:30
@wenyihu6
Copy link
Copy Markdown
Contributor Author

Last push was to rebase on master to include a flaky test fix for TestAuthenticationAndHBARules.

This commit adds a new test, TestPolicyRefresherWithLatencies, which verifies
that the policy refresher correctly updates latency information using mocked
latency map data.

Resolves: cockroachdb#143888
Release note: none
@wenyihu6 wenyihu6 force-pushed the policyrefreshertests branch from 1c7efbc to 5dbc33c Compare April 24, 2025 02:20
@wenyihu6
Copy link
Copy Markdown
Contributor Author

Last push was to rebase on master to include a flaky test fix for TestLeaderlessWatcherErrorRefreshedOnUnavailabilityTransition.

@wenyihu6
Copy link
Copy Markdown
Contributor Author

TFTR!

bors r=arulajmani

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Apr 24, 2025

Build failed:

@wenyihu6
Copy link
Copy Markdown
Contributor Author

bors retry

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Apr 24, 2025

@craig craig bot merged commit 17351c3 into cockroachdb:master Apr 24, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

roachtest: add more tests for auto-tuning closed ts

3 participants