Skip to content

Fixes #33738: keep multi-node suites out of the parallel lane and make alert scheduling idempotent - #33739

Merged
mohityadav766 merged 2 commits into
mainfrom
fix/33738-multi-node-it-lane-leak
Sep 22, 2026
Merged

mohityadav766 merged 2 commits into
mainfrom
fix/33738-multi-node-it-lane-leak

Conversation

@mohityadav766

@mohityadav766 mohityadav766 commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #33738

Integration tests were failing randomly in the merge queue while the same commit was green on
PR CI, and the failure landed in a different, unrelated suite each time.

CsvExportMultiNodeIT was running in the parallel lane, where it boots extra full
OpenMetadata servers inside the shared test JVM while 4 JUnit workers drive the primary app. It
is @Tag("multi-node") and listed in integrationTests.multiNodeTests, but unlike its three
siblings it was never added to an isolated-tests <includes> or a parallel-tests <excludes>
list — it appeared at exactly one line in that pom, while each sibling appeared 16 times. Its own
Javadoc names the hazard: "SessionMultiNodeCluster starts extra Dropwizard instances inside this
JVM, so the nodes share a database ... but also share a filesystem and JVM statics."

The tag backstop that should have caught the omission was inert: in parallel-tests,
<excludedGroups>scale</excludedGroups> sat inside <systemPropertyVariables> where failsafe never
reads it — a mistake the pom already documents at lines 1502-1505 and gets right in search-it and
ui-it. The other 7 parallel-tests executions had no excludedGroups at all.

Those extra nodes are what produced both reported failures. The lifecycle-dispatcher NPE
(handler is null) came from each node's SearchRepository constructor mutating the process-global
handler list — that mechanism is already fixed by #33712, but not its trigger. The Quartz failure
came from every booting node running initializeEventSubscriptions() against the same clustered job
store, colliding with the test's own PATCH on the same trigger keys.

Type of change:

  • Bug fix

High-level design:

Two independent guards against the lane leak. CsvExportMultiNodeIT is added to all 8
isolated-tests <includes> and all 8 parallel-tests <excludes>, and <excludedGroups> is
moved to a direct <configuration> child in every parallel-tests execution as
scale,multi-node, with all four multi-node classes tagged @Tag("multi-node"). The filename
lists are the explicit statement; the tag filter is what keeps the next multi-node suite out when
someone forgets them. All four classes are now consistent across tag, lane property, and both lists.

The Quartz race is fixed rather than avoided, because it is reachable outside tests: every node
runs EventSubscriptionResource.initialize() → initializeEventSubscriptions() on startup against
one clustered job store, so a rolling restart hits the same window.
QuartzScheduler.deleteJob lists a job's triggers and then unschedules them in separate
JobStoreTX transactions (verified against the 2.5.0-rc2 bytecode), and throws when a trigger it
just listed is already gone — which is the state being asked for, not a failure. So:

  • the enabled path writes the job and its trigger in one transaction via
    scheduleJob(jobDetail, Set.of(trigger), true) instead of delete-then-add. That is strictly
    better than making delete-then-add safe: it also removes the window in which the alert is not
    scheduled at all, and the ObjectAlreadyExistsException race on the add side.
  • delete removes the trigger before the job, so deleteJob finds nothing left to unschedule, and
    a lost race is accepted once checkExists confirms the job is gone (bounded to 3 attempts so a
    genuinely stuck job store still errors rather than looping).

Catching and ignoring the SchedulerException was rejected: it would have hidden a real job-store
failure behind the same code path, and left the unscheduled window open.

Fail loudly rather than corrupt silently. SessionMultiNodeCluster.getInstance() now refuses to
start when junit.jupiter.execution.parallel.enabled is set, naming the four places a multi-node
class must be registered. A recurrence becomes an immediate, self-describing error in the offending
lane instead of a corrupted run whose symptoms surface an hour later somewhere else. It also tears
down a node whose startup threw — startNode() hands the app to registerAdditionalApp only on
success, so such a node would otherwise never be stopped.

Tests:

Use cases covered

  • A multi-node suite cannot run in a fork configured for parallel execution (by filename, by tag,
    and by a runtime guard)
  • Enabling/disabling an event subscription concurrently never fails on the server
  • An alert is never observably unscheduled while it is being updated
  • Deleting an alert publisher that another writer has already removed succeeds instead of 500-ing

Unit tests

  • Not added. The changed scheduler paths are thin wrappers over Quartz whose behaviour only
    differs under a real clustered JobStoreTX against a database; a mocked Scheduler would
    assert the call shape rather than the race, which is what the integration test below covers.

Backend integration tests

  • Added test_concurrentEnableDisableSubscription to EventSubscriptionResourceIT — 4 threads
    × 5 toggles on one subscription. It tolerates version conflicts between racing PATCHes
    (legitimate, client errors) and fails on any 5xx or unschedule trigger message, so it
    targets the defect exactly and cannot false-fail.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

mvn -o install -pl :openmetadata-integration-tests -am -DskipTests                → BUILD SUCCESS
mvn -o test-compile -pl :openmetadata-integration-tests                           → 0
mvn -o spotless:check -pl :openmetadata-service,:openmetadata-integration-tests    → 0
xmllint --noout openmetadata-integration-tests/pom.xml                            → OK

Lane membership was verified to be consistent for all four multi-node classes (tag,
multiNodeTests, 8 includes, 8 excludes each).

Not run locally: the integration suites themselves, which need the Docker testcontainers stack;
relying on CI for those.

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #33738 above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: not applicable, no schema changes.
  • For UI changes: not applicable.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • I have added a test that covers the exact scenario we are fixing.

🤖 Generated with Claude Code

RetriggerConfidence Score: 4/5

The PR is not yet safe to merge because scheduler deletion can report success while leaving an alert job active, and the explicit Java method-size requirement must also be satisfied.

Findings

  1. P1 Job deletion failures are hidden ▶
  2. P2 Concurrency tests are oversized ▶
Summary

This PR separates multi-node integration suites from parallel test forks and reconciles Quartz alert schedules from committed subscription state.

  • Adds explicit filename and JUnit-tag guards for multi-node suites.
  • Cleans up partially started test nodes.
  • Replaces delete-then-add scheduling with atomic Quartz job/trigger replacement and committed-state reconciliation.
  • Adds concurrent enable/disable integration coverage.
  • A remaining deletion error-handling defect can acknowledge removal while leaving an alert job active.
Diagram
sequenceDiagram
    participant API as Subscription API
    participant DB as Metadata DB
    participant Sync as Scheduler Reconcile
    participant Q as Clustered Quartz
    API->>DB: Commit subscription mutation
    API->>Sync: Reconcile subscription ID
    Sync->>DB: Read committed subscription
    alt enabled
        Sync->>Q: Replace job and trigger atomically
    else disabled or deleted
        Sync->>Q: Unschedule trigger
        Sync->>Q: Delete job
        Q--xSync: SchedulerException
        Note over Sync,API: Current code suppresses the failure
    end
Loading

Reviews (2) · Last reviewed commit: "Order alert scheduling against committed..."

CsvExportMultiNodeIT boots extra full OpenMetadata servers inside the shared
test JVM. It is @tag("multi-node") and listed in integrationTests.multiNodeTests,
but unlike its three siblings it was never added to an isolated-tests <includes>
or a parallel-tests <excludes> list, so it also ran in the parallel lane next to
4 concurrent workers -- replacing process-wide singletons and joining the
clustered Quartz job store underneath every other suite in the fork. That is what
produced the two unrelated-looking merge-queue failures: the lifecycle dispatcher
NPE (mechanism since fixed by #33712) and the Quartz "Unable to unschedule
trigger [...] while deleting job [...]" 500.

Add it to all 8 include and all 8 exclude lists, and repair the tag backstop that
should have caught the omission: excludedGroups sat inside systemPropertyVariables
where failsafe never reads it, a mistake the pom already documents for search-it
and ui-it. It is now a direct <configuration> child in every parallel-tests
execution, and all four multi-node classes carry @tag("multi-node"), so a future
one is excluded even if the filename lists are forgotten.

Also close the Quartz race itself, which is reachable outside tests -- every node
reinstalls every subscription on startup against one clustered job store, so a
rolling restart hits it. QuartzScheduler.deleteJob lists a job's triggers and then
unschedules them in separate transactions and throws when one is already gone,
which is the state being asked for rather than a failure. The enabled path now
writes the job and its trigger in a single transaction with replace=true instead
of delete-then-add, which also removes the window where the alert is unscheduled
at all; delete drops the trigger before the job and accepts a lost race once the
job is confirmed gone.

Finally, SessionMultiNodeCluster now refuses to start when it finds itself in a
fork configured for parallel execution, so this misconfiguration fails loudly in
the offending lane instead of corrupting a run whose symptoms surface later in an
unrelated test, and it tears down a node whose startup threw.
@mohityadav766
mohityadav766 requested a review from a team as a code owner September 21, 2026 18:04
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This 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 skip-pr-checks label.

@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Sep 21, 2026
@sonarqubecloud

Copy link
Copy Markdown

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integration tests fail randomly in the merge queue: CsvExportMultiNodeIT starts extra servers inside the parallel lane's JVM

2 participants