fix: clean up RocksDB files on drop_index so create_index can be repeated#485
Open
feihongxu0824 wants to merge 1 commit into
Open
fix: clean up RocksDB files on drop_index so create_index can be repeated#485feihongxu0824 wants to merge 1 commit into
feihongxu0824 wants to merge 1 commit into
Conversation
…ated Two issues prevented drop_index + create_index from working: 1. `reload_scalar_index(nullptr)` was a no-op — it never removed the old inverted indexer directory. Now it deletes the working dir and sets the pointer to null. 2. `create_scalar_index` returned a null output when no new fields needed indexing (early-return path), causing the caller to pass nullptr to `reload_scalar_index` which then wiped the existing indexer. Now it returns the current indexer pointer so the caller preserves it. Added an identity-pointer guard (`invert_indexers_ == scalar_indexer`) to avoid accidentally deleting an indexer's own directory during reload. Closes alibaba#427 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
b94a90a to
0030e05
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
reload_scalar_index(nullptr)now properly removes the old inverted indexer directory instead of silently returning, fixing the stale RocksDB column family that blocked re-creation.create_scalar_indexearly-return path now outputs the current indexer pointer (instead of leaving it null), so the caller doesn't accidentally wipe an existing indexer viareload_scalar_index.reload_scalar_indexfrom deleting an indexer's own directory when the input is the same object.Closes #427
Test plan
Feature_DropAndRecreateScalarIndex— verifies 3 rounds of create/drop on a single field + data integrity checkFeature_DropAndRecreateScalarIndex_MultipleFields— verifies partial drop, full drop, and recreate on two fieldsColumn family already exists in RocksDB)