cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
30.16k stars 3.82k forks source link

kvserver: intent resolution by mvccGCQueue does not use the tenant of the range for admission control #135853

Open sumeerbhola opened 1 day ago

sumeerbhola commented 1 day ago

mvccGCQueue, when resolving intents, sets a AdmissionHeader using a gcAdmissionHeader. An AdmissionHeader does not include a tenantID since it is supposed to be extracted in Node.Batch using roachpb.ClientTenantFromContext(ctx). AFAIK, we don't provide a context in this case that includes the tenantID of the range. This means the intent resolution will be charged to the system tenant.

For proper inter-tenant isolation, intent resolution in this case should use the range's tenant.

This is motivated by an escalation -- e.g. see thread https://cockroachlabs.slack.com/archives/C081JBE946P/p1732121444459029?thread_ts=1732114829.937389&cid=C081JBE946P

Jira issue: CRDB-44749

Epic CRDB-43580