-
Notifications
You must be signed in to change notification settings - Fork 0
Fix PartitionDeleted error in index rebuild operations #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Note Free review on us!CodeRabbit is offering free reviews until Wed Dec 17 2025 to showcase some of the refinements we've made. Comment |
Co-authored-by: anidotnet <[email protected]>
…ndant code Co-authored-by: anidotnet <[email protected]>
Co-authored-by: anidotnet <[email protected]>
Co-authored-by: anidotnet <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a critical bug in the Fjall adapter where index rebuild operations fail due to improper handling of deleted partitions. The adapter's in-memory cache (map_registry) was retaining stale entries after partition deletion, causing PartitionDeleted errors when attempting to recreate indexes.
Key changes:
- Added error detection and mapping for deleted partitions in the error handling layer
- Implemented cache cleanup logic when encountering deleted partitions during open and remove operations
- Introduced a helper function to centralize partition deletion error detection
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| nitrite-fjall-adapter/src/wrapper.rs | Added mapping of "deleted" and "PartitionDeleted" error patterns to StoreNotInitialized error kind |
| nitrite-fjall-adapter/src/store.rs | Added helper function is_partition_deleted_error() and integrated cache cleanup logic in open_map() and remove_map() to handle deleted partitions gracefully |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… partitions Co-authored-by: anidotnet <[email protected]>
… issues Co-authored-by: anidotnet <[email protected]>
…mentation Co-authored-by: anidotnet <[email protected]>
Fix PartitionDeleted error during index rebuild by handling stale partition references
…load non-blocking, and conditionally compile FTS and spatial integration tests with `fjall` feature.
…improve memory map key retrieval for robustness.
…ss minor formatting issues.
…y index reader to manual reload.
Index rebuild operations were failing because the Fjall adapter didn't handle deleted partitions properly. When
rebuild_indexdrops an index partition and immediately recreates it, the adapter's cache retained stale entries and failed on the reopening withPartitionDeletederrors.Changes
Error mapping: Added
PartitionDeletedand "deleted" patterns toto_nitrite_error(), mapping them toStoreNotInitializedCache cleanup in
open_map(): Remove stale registry entries when encountering deleted partitions during open operationsGraceful deletion in
remove_map(): Handle already-deleted partitions by checking error messages and cleaning up registry instead of propagating errorsHelper function: Extracted
is_partition_deleted_error()to centralize partition deletion detection logicThe changes ensure the adapter's
map_registrycache stays consistent with on-disk partition state during drop/recreate cycles.Original prompt
Problem
The
test_rebuild_indexintegration tests are failing with aPartitionDeletederror when attempting to rebuild indexes. The error occurs in the following tests:repository::repository_modification_test::test_rebuild_indexcollection::single_field_index_test::test_rebuild_indexcollection::single_field_index_test::test_rebuild_index_on_running_indexRoot Cause
When
rebuild_indexis called, it performs the following steps:indexer.drop_index()which deletes the Fjall partitionHowever, the Fjall store adapter has issues with this flow:
map_registrycache retains stale entries after partition deletionremove_mapfunction doesn't handle cases where partitions are already deletedopen_mapfunction doesn't properly clean up stale cache entries when encountering deleted partitionsto_nitrite_errordoesn't recognizePartitionDeletederrorsThis causes the rebuild operation to fail when trying to reopen a just-deleted partition.
Solution
Implement the following fixes in the Fjall adapter:
1. Fix
remove_mapfunction innitrite-fjall-adapter/src/store.rsUpdate the function to handle cases where partitions may already be deleted:
2. Update
to_nitrite_errorinnitrite-fjall-adapter/src/wrapper.rsAdd specific handling for partition deleted errors:
3. Improve
open_mapinnitrite-fjall-adapter/src/store.rsEnsure stale cache entries are cleaned up when encountering deleted partitions: