dolthub / dolthub/dolt

Provide a way to validate and repair secondary indexes

Open
#7,170 2 comments 0 reactions 0 assignees View on GitHub
enhancement indexes
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 5h
Merged PRs (30d)
108

Description

If a secondary index becomes corrupted (e.g. hardware failure, or a bug in merge logic), then customers can currently rebuild the index by dropping it from the table and then readding it back, with exactly the same definition. This unblocks customers, and corrupted indexes are a very rare event we don't see very often, but it would still be nice to provide an easier and more direct way for customers to validate and repair a table and its secondary indexes.

MySQL provides [the `REPAIR TABLE` statement](https://dev.mysql.com/doc/refman/8.0/en/rebuilding-tables.html#rebuilding-tables-repair-table) that validates and repairs a table and all of its secondary indexes, and *may* be a good model for Dolt, too. There are two downsides of following this pattern though:
- `REPAIR TABLE` only works for older MySQL storage engines (i.e. MyISAM, ARCHIVE, CSV) and not for the current default storage engine (i.e. InnoDB). Dolt uses its own storage engine of course, but this may still hinder discoverability, since it appears to be less used now.
- It requires the user to explicitly specify which tables should be validated and repaired. This is convenient if you do know exactly which tables need to be repaired, but clumsy if you want to repair all tables. MySQL supports this with the `mysqlcheck --repair --databases ` command line tool, and uses `REPAIR TABLE` as the primitive for that higher-level tool.

In addition to secondary index repair, there are likely other useful database validation/repair checks that we could put in some sort of statement/tool like this.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.