bhabegger opened a new pull request, #2950:
URL: https://github.com/apache/jackrabbit-oak/pull/2950

   ## Summary
   
   - Adds feature toggle `FT_OAK-12248` (off by default) to 
`ElasticIndexStatistics`
   - When enabled, a 404 `ElasticsearchException` from an ES `count` request 
during query planning is caught in `getCountOrZeroOn404()`, 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 log
   - `ElasticResultRowAsyncIterator.onFailure()` / `hasNext()` also check the 
toggle to suppress ERROR at execution time if the alias is still missing
   - Toggle registered in `ElasticIndexProviderService` alongside the existing 
`FT_OAK-12206` and `FT_OAK-12234` toggles
   
   ## Root cause note
   
   The 404 first surfaces during **planning** (not execution): 
`ElasticIndexStatistics.getDocCountFor()` fires an ES `count` request whose 
`ElasticsearchException` propagates uncaught to `FulltextIndex.getPlans():176` 
and is logged as ERROR there. Oak's cache re-throws `RuntimeException` causes 
**unwrapped** (only checked exceptions are wrapped in `CompletionException`), 
so the catch must target `ElasticsearchException` directly.
   
   ## 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](https://claude.ai/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to