fix: ES index upgrade never completes when several connectors share an alias - EXO-88232 - #770
Merged
Merged
Conversation
…n alias - EXO-88232 (#769) ## Problem While upgrading `notes_v1 → notes_v2` (Meeds-io/notes#1756), the upgrade failed with: ``` ERROR | An error occurred while upgrading index notes_v1 java.lang.NullPointerException: Cannot invoke "java.util.Set.size()" because the return value of "java.util.Map.get(Object)" is null at ...ElasticIndexingOperationProcessor$ReindexESType.run(ElasticIndexingOperationProcessor.java:792) ``` Notes declares **two** connectors on the same `index_alias` (`WikiPageIndexingServiceConnector` and `NoteVersionLanguageIndexingServiceConnector`). One `ReindexESType` task is submitted per connector. The first task to finish saw `size() > 1`, did nothing, then its `finally` removed the **whole alias entry** from `indexUpgrading` → the second task NPE'd. Net effect: the alias was never switched to the new index and the old index was never deleted, on every alias shared by ≥ 2 connectors. ## Fix - Track completion **per connector** (`markConnectorUpgraded`); switch the alias and delete the old index once, after the last connector of that alias finishes. - On failure, release only the finished connector's slot; drop the alias entry when nothing is pending anymore. - Send the ES-side `_reindex` **once per alias/pipeline** instead of once per connector (it was duplicated for notes). - Logs name the connector; the pipeline-failure WARN now carries the exception. - `setExecutors(ExecutorService)` / `isIndexUpgrading(alias)` added for tests. ## Tests Two new tests in `ElasticOperationProcessorTest` with two connectors on `notes_alias`, run on a same-thread executor: - alias switch / old-index delete / `_reindex` each happen exactly once, after both connectors; - after only the first connector finishes, the alias is untouched and the upgrade is still pending. **Mutation-verified**: with the previous `size() > 1` + whole-alias `remove` logic put back, both tests fail; with the fix, the full `commons-search` suite passes. ## Classification N2 — shared indexing engine (cross-domain seam), no ACL/schema/REST surface touched. Knowledge: none — behaviour fix in the indexing engine, no domain-doc claim changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
|
boubaker
enabled auto-merge (squash)
August 27, 2026 09:01
AzmiTouil
approved these changes
Aug 27, 2026
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.



Problem
While upgrading
notes_v1 → notes_v2(Meeds-io/notes#1756), the upgrade failed with:Notes declares two connectors on the same
index_alias(WikiPageIndexingServiceConnectorandNoteVersionLanguageIndexingServiceConnector). OneReindexESTypetask is submitted per connector. The first task to finish sawsize() > 1, did nothing, then itsfinallyremoved the whole alias entry fromindexUpgrading→ the second task NPE'd. Net effect: the alias was never switched to the new index and the old index was never deleted, on every alias shared by ≥ 2 connectors.Fix
markConnectorUpgraded); switch the alias and delete the old index once, after the last connector of that alias finishes._reindexonce per alias/pipeline instead of once per connector (it was duplicated for notes).setExecutors(ExecutorService)/isIndexUpgrading(alias)added for tests.Tests
Two new tests in
ElasticOperationProcessorTestwith two connectors onnotes_alias, run on a same-thread executor:_reindexeach happen exactly once, after both connectors;Mutation-verified: with the previous
size() > 1+ whole-aliasremovelogic put back, both tests fail; with the fix, the fullcommons-searchsuite passes.Classification
N2 — shared indexing engine (cross-domain seam), no ACL/schema/REST surface touched.
Knowledge: none — behaviour fix in the indexing engine, no domain-doc claim changes.
🤖 Generated with Claude Code