Skip to content

fix: clean up RocksDB files on drop_index so create_index can be repeated#485

Open
feihongxu0824 wants to merge 1 commit into
alibaba:mainfrom
feihongxu0824:fix/drop-recreate-scalar-index
Open

fix: clean up RocksDB files on drop_index so create_index can be repeated#485
feihongxu0824 wants to merge 1 commit into
alibaba:mainfrom
feihongxu0824:fix/drop-recreate-scalar-index

Conversation

@feihongxu0824

@feihongxu0824 feihongxu0824 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

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_index early-return path now outputs the current indexer pointer (instead of leaving it null), so the caller doesn't accidentally wipe an existing indexer via reload_scalar_index.
  • Added identity-pointer guard to prevent reload_scalar_index from deleting an indexer's own directory when the input is the same object.

Closes #427

Test plan

  • Added Feature_DropAndRecreateScalarIndex — verifies 3 rounds of create/drop on a single field + data integrity check
  • Added Feature_DropAndRecreateScalarIndex_MultipleFields — verifies partial drop, full drop, and recreate on two fields
  • Confirmed tests FAIL without the fix (Column family already exists in RocksDB)
  • Confirmed tests PASS with the fix

@feihongxu0824 feihongxu0824 requested a review from zhourrr as a code owner June 9, 2026 13:45
…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>
@feihongxu0824 feihongxu0824 force-pushed the fix/drop-recreate-scalar-index branch from b94a90a to 0030e05 Compare June 9, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: create_index() fails after drop_index() on scalar fields - RocksDB column family not cleaned up

1 participant