Skip to content

[WIP/POC] Embedded test exposing pending segment upgrade failure during minor compaction #19673

Draft
cecemei wants to merge 2 commits into
apache:masterfrom
cecemei:testing07
Draft

[WIP/POC] Embedded test exposing pending segment upgrade failure during minor compaction #19673
cecemei wants to merge 2 commits into
apache:masterfrom
cecemei:testing07

Conversation

@cecemei

@cecemei cecemei commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Description

Adds KafkaIngestionWithCompactionTest to reproduce a bug where realtime pending segments are not upgraded after minor compaction.

The bug: When minor compaction replaces V1 historical segments with V2, the overlord should call registerUpgradedPendingSegment on active realtime tasks to re-announce their pending segments at V2. In this scenario, that upgrade never happens, the log ==== StreamAppenderator: announcing upgraded realtime segment is absent, meaning the slow supervisor's rows become invisible to queries once V1 segments are superseded.

Test setup:

  • fastSupervisor (3s task duration): commits segments quickly
  • slowSupervisor (100s task duration): holds an append lock throughout, never commits during the test window
  • After Step 2 full compaction and Step 3 ingestion, minor compaction triggers in Step 4
  • Expected: slow supervisor's 20 realtime rows remain visible at V2; test observes them missing

When the bug is present, assumeTrue passes and the test proceeds to a success, we've verified the buggy behavior end-to-end.


This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@kfaraz

kfaraz commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

@cecemei , good catch!

The problem is that the current upgrade logic sends the upgrade notification to only a single supervisor by using SupervisorManager.getActiveSupervisorIdForDatasourceWithAppendLock() (since this logic was written before multi supervisors was a thing). So, the upgrade notification is probably going to a supervisor which didn't actually allocate the pending segment and thus ignores the notification altogether.

The fix for this would be to either send the upgrade notification to all supervisors for that datasource, or to find the one supervisor which actually allocated this segment and send the notification to it.

You can update this PR to include the fix along with a simple unit test.
I think we may omit the embedded test here, since it is difficult to get it to not be flaky and the value addition might not be very high.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants