feat(opensearch) #34610: vendor-neutral DotIndexWindowLimitException replaces QueryPhaseExecutionException#35827
Conversation
…utral DotIndexWindowLimitException Introduce DotIndexWindowLimitException (extends DotRuntimeException) as a vendor-neutral signal for result-window overflow (max_result_window exceeded). Both factory implementations now detect the vendor-specific error and throw the neutral exception before it escapes the factory layer: - ES: instanceof QueryPhaseExecutionException (typed check, no string matching) - OS: e.error().type() == "illegal_argument_exception" + reason contains "Result window" (structured error field, not free-text message parsing) WorkflowAPIImpl.findContentletsToProcess() now catches DotIndexWindowLimitException directly — no more string matching, no more ES vendor import. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…om PR #34610 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove @ESCoupled annotation and extra blank line — WorkflowAPIImpl is excluded from this PR. Vendor-neutral exception handling tracked separately in #35827. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
WorkflowAPIImpl is not part of this PR. Restore to exact origin/main state. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix dead instanceof branch in ContentFactoryIndexOperationsES: QPE does not
extend ElasticsearchStatusException|IndexNotFoundException|SearchPhaseExecutionException,
so the old check was unreachable. Now mirrors OS: check instanceof
ElasticsearchStatusException + message.contains("Result window")
- Add Logger.debug before DotIndexWindowLimitException throw in both ES and OS
factories so operators retain the failing-index breadcrumb
- Re-include WorkflowAPIImpl: replace QueryPhaseExecutionException instanceof
(ES vendor type) with DotIndexWindowLimitException catch — the stated goal
of this PR; remove org.elasticsearch import
- Add DotIndexWindowLimitException(String index, Throwable) constructor so
factories can embed the offending index name in the exception message
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Claude finished @fabrizzio-dotCMS's task in 2m 38s —— View job PR Review
Findings1. PR description is out of date and contradicts the code (medium) 2. Behavior change is broader than "fixes WorkflowAPIImpl" (HIGH — please audit)
Any of these triggered with offset ≥ 10 000 will now throw to their caller instead of returning empty. Some of these are background jobs / servlets / Velocity tools where the previous silent-empty was arguably wrong, but flipping it to a 3. String-match on 4. No tests added (medium) 5. Import ordering in import com.dotmarketing.exception.DotDataException;
import com.dotmarketing.exception.DotIndexWindowLimitException; // ← out of order
import com.dotmarketing.exception.DotDataValidationException;
import com.dotmarketing.exception.DotHibernateException;6. Single-arg constructor is unused (nit) 7. Index name in both log line and exception message (nit) NetThe local refactor is fine. The non-obvious risk is #2 — the silent-to-throwing flip happens at the factory boundary so it affects everyone, not just the workflow path called out in the title. I'd want either an audit of those call sites confirming they tolerate the throw, or scoping the throw to the workflow entry point. The other items are smaller (description, tests, import order). |
|
Not worth the effort. Will remove the Exception at decommission time |
Summary
Introduces
DotIndexWindowLimitException extends DotRuntimeExceptionas the vendor-neutral signal for result-window overflow (max_result_windowexceeded, default 10 000 in both ES and OS).Problem
WorkflowAPIImpl.findContentletsToProcess()previously caughtQueryPhaseExecutionException— an Elasticsearch-specific type — to detect when pagination exceeded the index window. This kept an ES vendor import in business logic and had no equivalent for the OpenSearch path.Additionally, both factory implementations (
ContentFactoryIndexOperationsESandContentFactoryIndexOperationsOS) were swallowing the vendor exception silently and returningERROR_HIT(empty result), so the original typed check inWorkflowAPIImplwas never triggered. The caller saw an empty list with no diagnostic information.Solution
The detection now happens at the factory layer, which is the only place that knows the vendor-specific exception types:
instanceof QueryPhaseExecutionException— typed, no string matchinge.error().type().equals("illegal_argument_exception")+ reason contains"Result window"— structured error field, not free-textWhen detected, both implementations throw
DotIndexWindowLimitExceptioninstead of silently returning empty results.WorkflowAPIImplnow catches it by type with no vendor imports.Changes
DotIndexWindowLimitException(new)DotRuntimeExceptionsubclassContentFactoryIndexOperationsESQueryPhaseExecutionException, throw neutral exceptionContentFactoryIndexOperationsOSOpenSearchException, throw neutral exceptionWorkflowAPIImplinstanceof QueryPhaseExecutionExceptionwithcatch (DotIndexWindowLimitException e); remove ES vendor importTest plan
./mvnw compile -pl :dotcms-core -DskipTests— no compilation errorsgrep -r "QueryPhaseExecutionException" dotCMS/src/main/java/com/dotmarketing/portlets/workflows/returns emptygrep -r "org.elasticsearch" dotCMS/src/main/java/com/dotmarketing/portlets/workflows/business/WorkflowAPIImpl.javareturns emptyCloses #34610
🤖 Generated with Claude Code