HIVE-29668: Add -rebuildIndexes utility to reconstruct backend Metast… - #6636
HIVE-29668: Add -rebuildIndexes utility to reconstruct backend Metast…#6636soumyakanti3578 wants to merge 2 commits into
Conversation
e0821f6 to
d42f9cf
Compare
|
nrg4878
left a comment
There was a problem hiding this comment.
I wasnt expecting that we will be checking in rebuild-indexes scripts as well. But I do not have a problem per se as long as these get updated when new indices are added.
|
|
||
| @Category(MetastoreUnitTest.class) | ||
| @RunWith(Parameterized.class) | ||
| public class TestRebuildIndexesScriptConsistency { |
There was a problem hiding this comment.
can we add a test that fails if we add a new index to the schema file that is not found in the rebuild-indexes file ? So that way developers will remember to update these files as well?
There was a problem hiding this comment.
Yes, that is exactly what's being tested in rebuildScriptMatchesInitScript()
Pattern pattern = PATTERNS.get(dbType);
Set<String> initIndexes = extractIndexNames(schemaScript, pattern);
Set<String> rebuildIndexes = extractIndexNames(rebuildScript, pattern);
Set<String> missing = new HashSet<>(initIndexes);
missing.removeAll(rebuildIndexes);
Set<String> extra = new HashSet<>(rebuildIndexes);
extra.removeAll(initIndexes);
assertTrue("Indexes in init script missing from rebuild script: " + missing, missing.isEmpty());
assertTrue("Indexes in rebuild script not found in init script: " + extra, extra.isEmpty());
and it tests extra indexes in the rebuild scripts too, so devs can remember to remove them if we ever remove an index from the schema file.



…ore indexes
What changes were proposed in this pull request?
rebuildIndexesoption toschemaToolWhy are the changes needed?
Gives users the ability to drop and recreate indexes easily through schematool.
Does this PR introduce any user-facing change?
Yes, adds a new option to schematool.
How was this patch tested?