Skip to content

sql: remove enforce_home_region_follower_reads_enabled#148314

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
michae2:remove_ehrfre
Aug 25, 2025
Merged

sql: remove enforce_home_region_follower_reads_enabled#148314
craig[bot] merged 1 commit intocockroachdb:masterfrom
michae2:remove_ehrfre

Conversation

@michae2
Copy link
Copy Markdown
Collaborator

@michae2 michae2 commented Jun 13, 2025

In #97827 we added a new ability to dynamically determine the home region of a row when a query failed due to enforce_home_region. Unfortunately, the strategy of switching to follower reads after a savepoint rollback is no longer permitted by the KV layer. This commit removes the dynamic home region lookup ability.

Fixes: #113765

Release note (sql change): The functionality provided by session variable enforce_home_region_follower_reads_enabled was deprecated in v24.2.4 and is now removed. (The variable itself remains for backward compatibility but has no effect.) (Note that related session variable enforce_home_region is not deprecated and still functions normally.)

@blathers-crl
Copy link
Copy Markdown

blathers-crl bot commented Jun 13, 2025

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@stevendanna
Copy link
Copy Markdown
Collaborator

We can do it as a follow-up if you'd prefer, but I think there is also some code we can remove over in txn_coord_sender_savepoints.go and txn_interceptor_span_refresher.go that we can remove as a result of this change.

@blathers-crl
Copy link
Copy Markdown

blathers-crl bot commented Jun 25, 2025

Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@DrewKimball
Copy link
Copy Markdown
Collaborator

@michae2 I volunteer as a reviewer if you think this is reasonably close.

@michae2
Copy link
Copy Markdown
Collaborator Author

michae2 commented Aug 21, 2025

(Let me rebase it at least before you look.)

Copy link
Copy Markdown
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: Wow, nice work!

We can do it as a follow-up if you'd prefer, but I think there is also some code we can remove over in txn_coord_sender_savepoints.go and txn_interceptor_span_refresher.go that we can remove as a result of this change.

I think we can now flip KeepRefreshSpansOnSavepointRollback on by default, but can't remove the extra savepoint logic until that setting is removed, is that right?

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


pkg/ccl/logictestccl/testdata/logic_test/multi_region_remote_access_error line 1203 at r3 (raw file):

# Prepared statement accessing a row in a remote region errors out.
retry
statement error pq: 

nit: should we have error messages here? Or do you think it's uninteresting?

@michae2 michae2 marked this pull request as ready for review August 25, 2025 09:10
@michae2 michae2 requested review from a team as code owners August 25, 2025 09:10
@michae2 michae2 requested review from yuzefovich and removed request for a team August 25, 2025 09:10
In cockroachdb#97827 we added a new ability to dynamically determine the home
region of a row when a query failed due to `enforce_home_region`.
Unfortunately, the strategy of switching to follower reads after a
savepoint rollback is no longer permitted by the KV layer. This commit
removes the dynamic home region lookup ability.

Fixes: cockroachdb#113765

Release note (sql change): The functionality provided by session
variable `enforce_home_region_follower_reads_enabled` was deprecated in
v24.2.4 and is now removed. (The variable itself remains for backward
compatibility but has no effect.) (Note that related session variable
`enforce_home_region` is _not_ deprecated and still functions normally.)
Copy link
Copy Markdown
Collaborator Author

@michae2 michae2 left a comment

Choose a reason for hiding this comment

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

TFTR!

We can do it as a follow-up if you'd prefer, but I think there is also some code we can remove over in txn_coord_sender_savepoints.go and txn_interceptor_span_refresher.go that we can remove as a result of this change.

I think we can now flip KeepRefreshSpansOnSavepointRollback on by default, but can't remove the extra savepoint logic until that setting is removed, is that right?

Good point. Let's do this in a follow-up PR.

bors r=DrewKimball

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


pkg/ccl/logictestccl/testdata/logic_test/multi_region_remote_access_error line 1203 at r3 (raw file):

Previously, DrewKimball (Drew Kimball) wrote…

nit: should we have error messages here? Or do you think it's uninteresting?

Oh, good catch! I just missed a couple spots.

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 25, 2025

@craig craig bot merged commit c74f6a3 into cockroachdb:master Aug 25, 2025
22 of 23 checks passed
@michae2 michae2 deleted the remove_ehrfre branch August 25, 2025 17:07
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.

sql: remove enforce_home_region_follower_reads_enabled

4 participants