cockroachdb / cockroach

CockroachDB - the open source, cloud-native distributed SQL database.
https://www.cockroachlabs.com
Other
29.52k stars 3.7k forks source link

sql: limit enforce_home_region_follower_reads_enabled only to AOST queries #113765

Open miraradeva opened 8 months ago

miraradeva commented 8 months ago

Currently, the enforce_home_region_follower_reads_enabled feature uses (1) savepoint rollback and (2) follower reads to dynamically detect a home region for a query which encountered "Query has no home region" error. (1) is used to roll back the original failed read, and (2) is used to ensure that while we try different regions to find the home region we don't actually serve remote reads.

In #111228 we want to change the behavior of savepoint rollbacks to not drop the accumulated read spans, and instead ensure those reads are serializable even after the rollback. This change breaks the above enforce_home_region_follower_reads_enabled functionality because (1) no longer removes the original failed read from the txn's read span, and as a result (2) fails to use AOST because the txn has preceding reads.

Ideally, we would change the behavior of enforce_home_region_follower_reads_enabled to work with the new savepoint behavior but it's unclear how to best approach this. In the mean time, after discussing with @michae2, we agreed we can limit the behavior of enforce_home_region_follower_reads_enabled to work only for queries that already use AOST. This will help because we no longer need to do part (2).

Jira issue: CRDB-33142

blathers-crl[bot] commented 4 months ago

Hi @michae2, please add branch-* labels to identify which branch(es) this GA-blocker affects.

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