Skip to content

Conversation

@yuzefovich
Copy link
Member

This PR contains a few commits that address a few nits I noticed while reviewing the plan hints.

Epic: None

This might be interesting for testing the scenario when the hints cache
is disabled (which is allowed by the cluster setting).

Release note: None
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@yuzefovich yuzefovich marked this pull request as ready for review November 7, 2025 19:42
@yuzefovich yuzefovich requested a review from a team as a code owner November 7, 2025 19:42
@yuzefovich
Copy link
Member Author

The last commit seemingly adds a failure under stress that I don't fully understand:

    hint_cache_test.go:127:
          Error Trace:  pkg/sql/hints/hint_cache_test.go:127
          Error:        Not equal:
                        expected: 1
                        actual  : 2
          Test:         TestHintCacheLRU

Where does the extra DB read come from given that we're not actually executing any queries that would match the fingerprints?

Copy link
Collaborator

@DrewKimball DrewKimball left a comment

Choose a reason for hiding this comment

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

:lgtm: Thanks!

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

Previously, all tests created a separate hints cache that was running
side-by-side with the hints cache of the test server. I'm not sure
whether there is a reason for it (other than possibly trying to prevent
flakes when we start actually using the cache on the main query path),
but I don't think it's necessary (e.g. we shouldn't be touching the
hints cache for internal queries, and the tests themselves are the only
workload that should be affected by the hints cache, and we have full
control of that). This commit hooks up all tests to just use the test
server's hints cache. One test for verifying that the initial scan
populates the existing hints into the cache needed a minor refactor - we
now restart the single-node test cluster to simulate the initial scan.
Additionally, the LRU test needed hardening if the initial scan is
somewhat delayed.

What prompted me to look into this is that I was confused why all
rangefeed logs (which I enabled temporarily) were being duplicated in
tests.

It also expands a comment where the behavior wasn't obvious to me.

Release note: None
Copy link
Member Author

@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.

That flake was due to initial scan being somewhat delayed (so some of our INSERT INTO system.statement_hints queries happened to perform DB reads).

TFTR!

bors r+

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

craig bot pushed a commit that referenced this pull request Nov 7, 2025
157041: sql/hints: address minor nits r=yuzefovich a=yuzefovich

This PR contains a few commits that address a few nits I noticed while reviewing the plan hints.

Epic: None

Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
@craig
Copy link
Contributor

craig bot commented Nov 7, 2025

Build failed:

@yuzefovich
Copy link
Member Author

unrelated flake

bors r+

@craig
Copy link
Contributor

craig bot commented Nov 7, 2025

@craig craig bot merged commit 83e74b7 into cockroachdb:master Nov 7, 2025
23 of 24 checks passed
@yuzefovich yuzefovich deleted the hints-nits branch November 7, 2025 23:14
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.

3 participants