OAK-12248: graceful 404 when ES alias is not yet provisioned#2950
Open
bhabegger wants to merge 1 commit into
Open
OAK-12248: graceful 404 when ES alias is not yet provisioned#2950bhabegger wants to merge 1 commit into
bhabegger wants to merge 1 commit into
Conversation
34d67e8 to
32e7d73
Compare
05248f4 to
17749e4
Compare
ddf8a34 to
46e080d
Compare
When an Elasticsearch alias does not exist (index_not_found_exception / 404), the query now returns an empty cursor and logs INFO instead of propagating an ERROR via FulltextIndex.getPlans(). The fix is behind feature toggle FT_OAK-12248 (disabled by default) registered in ElasticIndexProviderService. The 404 is caught in ElasticIndexStatistics.getCountOrZeroOn404() so the planner receives 0 estimated documents and proceeds normally; ElasticResultRow- AsyncIterator.onFailure() / hasNext() also suppress the ERROR when the toggle is on. ElasticGraceful404QueryTest verifies both toggle-off (ERROR expected) and toggle-on (empty result, no ERROR, INFO logged) behaviours. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
46e080d to
12ea30f
Compare
Contributor
|
@bhabegger - do we need a toggle for this ? The change seems very limited. |
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
FT_OAK-12248(off by default) toElasticIndexStatisticsElasticsearchExceptionfrom an EScountrequest during query planning is caught ingetCountOrZeroOn404(), logged at INFO, and treated as 0 estimated documents — the planner stays on the ES path instead of falling back to traversal with an ERROR logElasticResultRowAsyncIterator.onFailure()/hasNext()also check the toggle to suppress ERROR at execution time if the alias is still missingElasticIndexProviderServicealongside the existingFT_OAK-12206andFT_OAK-12234togglesRoot cause note
The 404 first surfaces during planning (not execution):
ElasticIndexStatistics.getDocCountFor()fires an EScountrequest whoseElasticsearchExceptionpropagates uncaught toFulltextIndex.getPlans():176and is logged as ERROR there. Oak's cache re-throwsRuntimeExceptioncauses unwrapped (only checked exceptions are wrapped inCompletionException), so the catch must targetElasticsearchExceptiondirectly.Test
ElasticGraceful404QueryTest(new):queryOnMissingAlias_withToggleOff_logsError— seeds data, provisions index, deletes alias, asserts ERROR log (confirms existing behaviour)queryOnMissingAlias_withToggleOn_returnsEmptyWithoutError— same setup, toggle on, asserts 0 results + no ERROR + INFO "alias not found"Relation to other tickets
Builds on OAK-12247 (track
totalIndexedNodes). Prerequisite for OAK-12249 (lazy ES provisioning): without this toggle, a non-existent alias after an empty reindex would ERROR on every query.🤖 Generated with Claude Code