cockroachdb / cockroach

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

sql: Automatic sql consistency checker #10425

Open vivekmenezes opened 7 years ago

vivekmenezes commented 7 years ago

We already check replication consistency on an ongoing basis and can check replication consistency explicitly through a KV API command CheckConsistency(). This issue is about developing a system that checks the consistency of UNIQUE indexes, CHECK CONSISTENCY constraints and other such constraints that SQL manages.

The RFC for the command, SCRUB, can be found here. The progress of it:

Jira issue: CRDB-6137

Epic CRDB-30356

petermattis commented 7 years ago

Another set of checks to perform is that all of the data associated with a table is correct. For example, we should loop over the rows in the table and verify that all of the associated index keys exists. We should loop over the indexes and verify that we don't have any dangling index keys that aren't referenced by a row. We should verify that the primary index data is organized into column families as per the TableDescriptor (e.g. there is no extraneous column data in a family and there are no extraneous families).

knz commented 6 years ago

@jordanlewis I think this is what we were talking about yesterday ;)

What do you think about making this a starter project?

vivekmenezes commented 6 years ago

I like the list you've come up with. Great job @lego !