Skip to content

Prevent rebuildIndexes from concurrent index state changes#3999

Draft
jjezra wants to merge 3 commits intoFoundationDB:mainfrom
jjezra:rebuild_indexes_avoid_conflicts
Draft

Prevent rebuildIndexes from concurrent index state changes#3999
jjezra wants to merge 3 commits intoFoundationDB:mainfrom
jjezra:rebuild_indexes_avoid_conflicts

Conversation

@jjezra
Copy link
Contributor

@jjezra jjezra commented Mar 10, 2026

These index state changes are protected by semaphores, and doing them in multiple threads
was occasionally causing a failure.

This PR should change rebuildIndexes to first rebuild (i.e. build inline) as a multi-target all the indexes that are targeted to become readable and then:
- raise index state write semaphore
- locklessly change the states of all indexes and clear data (if needed). if rebuild had failed (very rare) convert all the desired READABLE to DISABLED.
- release the index state write semaphore

This PR is intended to be followed by another one that simplifies the index rebuild/state-change mechanism and probably move it to an external class.

   These index state changes are protected by semaphores, and doing them in multiple threads
   was oaccasionally causing a failure.
@jjezra jjezra added the bug fix Change that fixes a bug label Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix Change that fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant