fix(reindex): clear stale on-demand job before triggering reindex#28772
Conversation
A leftover on-demand job from a previous run that did not complete was preventing further reindex runs. Start the scheduler in the CLI path and clear any existing on-demand job before triggering. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
There was a problem hiding this comment.
Pull request overview
This PR addresses a failure mode in the CLI reindex flow where a persisted Quartz on-demand job from a previous crashed run prevents subsequent reindex runs. It does so by ensuring the scheduler is started in the CLI path and clearing any stale on-demand job/trigger before triggering the reindex application.
Changes:
- Start
AppSchedulerin the CLI reindex entrypoints so on-demand triggers can actually be scheduled. - Clear any existing on-demand Quartz job/trigger before triggering Search/DataInsights reindex apps.
- Add unit tests covering stale on-demand job behavior and best-effort cleanup semantics.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| openmetadata-service/src/main/java/org/openmetadata/service/util/OpenMetadataOperations.java | Starts the scheduler in CLI reindex commands and deletes stale on-demand jobs before triggering reindex apps. |
| openmetadata-service/src/main/java/org/openmetadata/service/apps/scheduler/AppScheduler.java | Adds deleteOnDemandJob(App) helper to clear persisted on-demand job/trigger state. |
| openmetadata-service/src/test/java/org/openmetadata/service/apps/scheduler/AppSchedulerTest.java | Adds tests validating stale on-demand job cleanup and failure behavior without cleanup. |
Address review: deleteOnDemandJob now skips the delete when the on-demand job is in getCurrentlyExecutingJobs(), so a genuinely running reindex is never cleared. Narrow the Javadoc to the actual CLI usage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
🔴 Playwright Results — 1 failure(s), 10 flaky✅ 4267 passed · ❌ 1 failed · 🟡 10 flaky · ⏭️ 88 skipped
Genuine Failures (failed on all attempts)❌
|
Code Review ✅ Approved 2 resolved / 2 findingsClears stale on-demand reindex jobs before triggering new runs to prevent execution conflicts, resolving issues with unsafe job deletion and incorrect Javadoc documentation. ✅ 2 resolved✅ Edge Case: deleteOnDemandJob deletes job without checking if it is running
✅ Quality: Javadoc lists callers (server start, upgrade) that are not wired
OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |



Fixes #28773
The existing on-demand job left behind by a previous run was preventing further reindex runs. This clears it before triggering (and starts the scheduler in the CLI path).
🤖 Generated with Claude Code