You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
150562: sql/stats: prevent stats collection in read-only tenants r=petermattis a=petermattis
This change prevents both automatic and manual statistics collection
in PCR reader tenants by detecting read-only tenant status at the
tenant level rather than checking individual table descriptors.
Key changes:
- Add TenantReadonly field to SQLConfig and ExecutorConfig to track
tenant-level read-only status
- Modify tenant initialization to detect read-only tenants by checking
mtinfopb.TenantInfoWithUsage.ReadFromTenant \!= nil
- Update MakeRefresher to accept readOnlyTenant parameter
- Prevent automatic stats collection in autoStatsEnabled()
- Prevent manual stats collection in makeJobRecord()
- Add TenantReadonly field to TestSharedProcessTenantArgs for testing
- Update tests to use tenant-level detection instead of table-level
ReplicatedPCRVersion checks
- Enhance test coverage for both autoStatsEnabled() and
autoStatsEnabledForTableID() functions
The tenant-level approach is more reliable than checking individual
table descriptors because some tables within read-only tenants are
not replicated (e.g. system.statement_statistics), yet we cannot
record stats for any tables since the system.table_statistics table
itself is read-only.
Fixes#135828
Release note: None
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
Co-authored-by: Peter Mattis <[email protected]>
0 commit comments