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
29.86k stars 3.77k forks source link

sql: zone configuration changes logging enhancement #127176

Open inata4 opened 1 month ago

inata4 commented 1 month ago

Is your feature request related to a problem? Please describe. CRDB needs to log the original and final zone configuration changes when such are made. Currently there is no way to tell what was the original/previous zone configuration if it was changed. Only the final config is logged. This is a problem mostly when the replication factor changes (e.g. from 3 to 5) and the console starts reporting under replicated ranges.

Describe the solution you'd like CRDB needs to write both the original and the final zone configuration in the events log or audit log or somewhere else.

Describe alternatives you've considered Currently the only alternative is to run something like this and go back in time (if the GC hasn't ran yet):

SELECT id, crdb_internal.pb_to_json('cockroach.config.zonepb.ZoneConfig', config) FROM system.zones AS OF SYSTEM TIME '<insert some time>;

Additional context Without this it is harder to troubleshoot under replicated ranges when replication factor has been increased.

Jira issue: CRDB-40305

Epic CRDB-31473

fqazi commented 1 month ago

It feels like we need to just log the old and new values together, so we can figure out what changes got applied.