Repository navigation
Fixes #37345: send ReindexStopUnderLoadIT's stop while the reindex is still running - #37918
Conversation
…ll running At the nightly fast tier's jpw.sizeFactor=0.05 the test seeds 500 tables and the whole reindex finishes in about 6 s, but the stop went out a fixed 8 s after the run registered. When it arrived after the job had finished, the server's async stop thread threw "There is no job running for the application", and in the embedded lane Awaitility rethrew that uncaught exception in the test. Scale the warm-up with the cohort: 8 s at full size as before, and at least 2 s.
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
| // The stop has to reach a reindex that is still running, and at the fast tier's 0.05 factor | ||
| // the whole run takes about 6 s. So the warm-up scales with the cohort, with a 2 s floor that | ||
| // gives the job time to start. | ||
| private static final Duration WARMUP = | ||
| Duration.ofMillis(Math.max(2_000L, 8_000L * SEED_TABLES / FULL_SIZE_TABLES)); |
There was a problem hiding this comment.
💡 Edge Case: Stop still races with job completion; only the timing window shrinks
The fix only moves the stop earlier: WARMUP is now max(2s, 8s*SEED_TABLES/FULL_SIZE_TABLES), which is 2 s at the 0.05 factor against a run the comment puts at about 6 s. ReindexHelpers.sendStop (ReindexHelpers.java) still POSTs /v1/apps/stop/... without handling the error, so if the run finishes before the stop arrives, the test fails with the same uncaught 'no job running' error. That can happen on a fast runner, with any SizeFactor below 0.05 (the cohort shrinks down to SizeFactor.FLOOR but the warm-up stays at 2 s), or when waitForRunStartedSince notices the start late. The assertion already allows success and completed, which shows a finished-before-stop run is expected. Right now that outcome can't get past sendStop. A sturdier fix: catch the stop failure, and if freshRunIsTerminal shows the run already ended, carry on to the status assertions instead of failing.
Tolerate a stop that arrives after the run already finished, so accepted success/completed outcomes can actually be reached:
try {
ReindexHelpers.sendStop(server, ReindexHelpers.SEARCH_INDEX_APP);
} catch (RuntimeException stopFailure) {
if (!ReindexHelpers.freshRunIsTerminal(
server, ReindexHelpers.SEARCH_INDEX_APP, triggeredAt)) {
throw stopFailure;
}
}
Was this helpful? React with 👍 / 👎
Code Review 👍 Approved with suggestions 🟡 Medium risk 0 closed / 1 findingsScaling the integration test’s warm-up changes when its stop request runs; a timing regression could still let reindex finish first. Scales the ReindexStopUnderLoadIT stop warm-up with the seeded cohort size, moving the stop earlier so it lands while the reindex is still running at the fast tier's reduced size. Approved with a suggestion: the stop still races with job completion, since the 2 s floor at 0.05 leaves a short window and 💡 Edge Case: Stop still races with job completion; only the timing window shrinks📄 openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/search/ReindexStopUnderLoadIT.java:53-57 📄 openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/search/ReindexStopUnderLoadIT.java:107-109 📄 openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/search/ReindexStopUnderLoadIT.java:120-122 The fix only moves the stop earlier: Tolerate a stop that arrives after the run already finished, so accepted success/completed outcomes can actually be reached🤖 Prompt for agentsVerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
🤖 Backport to |
|
🤖 Backport to |
…ll running (#37918) (#37964) At the nightly fast tier's jpw.sizeFactor=0.05 the test seeds 500 tables and the whole reindex finishes in about 6 s, but the stop went out a fixed 8 s after the run registered. When it arrived after the job had finished, the server's async stop thread threw "There is no job running for the application", and in the embedded lane Awaitility rethrew that uncaught exception in the test. Scale the warm-up with the cohort: 8 s at full size as before, and at least 2 s. (cherry picked from commit fa2eb13) Co-authored-by: Mohit Yadav <105265192+mohityadav766@users.noreply.github.com>
Describe your changes:
Fixes #37345
ReindexStopUnderLoadIT.stopRequestTerminatesActiveReindexUnderLoadfails intermittently in the openmetadata-nightly fast tier (embedded search shard, PostgreSQL + OpenSearch,jpw.sizeFactor=0.05):Since #37346 scaled this test's cohort with
jpw.sizeFactor, the fast tier seeds 500 tables, and the whole reindex finishes in about 6 s. The stop still went out a fixed 8 s after the test saw the run register, which is about 6.5–6.75 s after the job logsReindexing job started. So whether the stop reached a running job was a coin flip. From the server logs of the last five fast-tier runs that executed this test:When the stop misses,
POST /apps/stopstill answers 200 and runs the stop on a virtual thread, which throws because no job is running. In the embedded lane the server shares the test JVM, and Awaitility (4.2.2,catchUncaughtExceptionson by default) rethrows that uncaught exception from the test'sawait. That's why the test errors even though it acceptssuccess/completed, and why the trace has only server frames. The cluster lane and the nightly tier (10k tables) don't hit it. The test is identical on main, 2.1 and 2.0, and main has no scheduled fast-tier runs, so it has only shown up on the release branches so far.The fix scales the warm-up with the cohort: 8 s at full size (the nightly tier is unchanged), with a 2 s floor. In the runs above the job started 1.25–1.5 s after the test saw the run register, so at 0.05 the stop now lands about 0.5–0.75 s into a run that takes about 6 s, leaving 5 s or more of margin.
Type of change:
High-level design:
N/A — one-file test fix.
Tests:
Use cases covered
jpw.sizeFactor=0.05, the stop reaches the reindex while it is still running.Unit tests
Not applicable: test-only change.
Backend integration tests
ReindexStopUnderLoadITonly.mvn -DskipTests install -pl :openmetadata-integration-tests -am(the nightly's build command) andtest-compileat the pushed commit. Spotless is clean.search-it, postgres-opensearch). The local Docker VM had no memory left for a PostgreSQL + OpenSearch stack (the OpenSearch container was OOM-killed at startup), so the run was skipped. The merge queue doesn't runsearch-it, so the nightly fast tier is where this gets exercised.Ingestion integration tests
Not applicable.
Playwright (UI) tests
Not applicable.
Visual regression baselines
Manual testing performed
UnhandledServerExceptionfromAppScheduler.stopApplicationRun).Reindexing job startedvs.AppScheduler: Found matching job/No running job foundandstatus -> COMPLETED/STOPPED), giving the table above.ConditionAwaiterbytecode: anawait()without.ignoreExceptions()installs itself as the default uncaught-exception handler, anddefaultCatchUncaughtExceptionsistrue.UI screen recording:
Not applicable — test-only change.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.REVIEW.md(thepr-checklistskill runs it) and fixed every 🔴 finding, or answered it on the line below.docs/decisions/(see itsREADME.md). This description is gone fromgit logafter the squash-merge. (nothing to record: the warm-up's reason is in the code comment)🤖 Generated with Claude Code


Confidence Score: 5/5
This test-only change appears safe to merge.Summary
Updates
ReindexStopUnderLoadITto send its stop request sooner for smaller table cohorts.Reviews (1) · Last reviewed commit: "test(it): send ReindexStopUnderLoadIT's ..." · Reviewed by Greptile