Skip to content

Fix NPE caused by realtime segment closing race, fix possible missing-segment retry bug.#15260

Merged
gianm merged 3 commits into
apache:masterfrom
gianm:fix-hydrant-swap
Nov 20, 2023
Merged

Fix NPE caused by realtime segment closing race, fix possible missing-segment retry bug.#15260
gianm merged 3 commits into
apache:masterfrom
gianm:fix-hydrant-swap

Conversation

@gianm

@gianm gianm commented Oct 26, 2023

Copy link
Copy Markdown
Contributor

Fix NPE caused by realtime segment closing race, fix possible missing-segment retry bug.

Fixes #12168, by returning empty from FireHydrant when the segment is swapped to null. This causes the SinkQuerySegmentWalker to use ReportTimelineMissingSegmentQueryRunner, which causes the Broker to look for the segment somewhere else.

In addition, this patch changes SinkQuerySegmentWalker to acquire references to all hydrants (subsegments of a sink) at once, and return a ReportTimelineMissingSegmentQueryRunner if any of them could not be acquired. I suspect, although have not confirmed, that the prior behavior could lead to segments being reported as missing even though results from some hydrants were still included.

@gianm gianm changed the title FireHydrant: Return empty from getSegmentForQuery when adapter is null. Fix NPE caused by realtime segment closing race, fix possible missing-segment retry bug. Oct 26, 2023
…-segment retry bug.

Fixes apache#12168, by returning empty from FireHydrant when the segment is
swapped to null. This causes the SinkQuerySegmentWalker to use
ReportTimelineMissingSegmentQueryRunner, which causes the Broker to look
for the segment somewhere else.

In addition, this patch changes SinkQuerySegmentWalker to acquire references
to all hydrants (subsegments of a sink) at once, and return a
ReportTimelineMissingSegmentQueryRunner if *any* of them could not be acquired.
I suspect, although have not confirmed, that the prior behavior could lead to
segments being reported as missing even though results from some hydrants were
still included.
@gianm

gianm commented Oct 27, 2023

Copy link
Copy Markdown
Contributor Author

CI failures appear to be coverage-related. I'll need to add some more tests.

@abhishekagarwal87 abhishekagarwal87 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

* method instead of testing {@link #acquireSegmentReferences(Function, boolean)} directly).
*/
@VisibleForTesting
static List<SinkSegmentReference> acquireSegmentReferences(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be annotated @nullable

@gianm
gianm merged commit 5ccd79d into apache:master Nov 20, 2023
@gianm
gianm deleted the fix-hydrant-swap branch November 20, 2023 18:48
writer-jill pushed a commit to writer-jill/druid that referenced this pull request Nov 20, 2023
…g-segment retry bug. (apache#15260)

* Fix NPE caused by realtime segment closing race, fix possible missing-segment retry bug.

Fixes apache#12168, by returning empty from FireHydrant when the segment is
swapped to null. This causes the SinkQuerySegmentWalker to use
ReportTimelineMissingSegmentQueryRunner, which causes the Broker to look
for the segment somewhere else.

In addition, this patch changes SinkQuerySegmentWalker to acquire references
to all hydrants (subsegments of a sink) at once, and return a
ReportTimelineMissingSegmentQueryRunner if *any* of them could not be acquired.
I suspect, although have not confirmed, that the prior behavior could lead to
segments being reported as missing even though results from some hydrants were
still included.

* Some more test coverage.
yashdeep97 pushed a commit to yashdeep97/druid that referenced this pull request Dec 1, 2023
…g-segment retry bug. (apache#15260)

* Fix NPE caused by realtime segment closing race, fix possible missing-segment retry bug.

Fixes apache#12168, by returning empty from FireHydrant when the segment is
swapped to null. This causes the SinkQuerySegmentWalker to use
ReportTimelineMissingSegmentQueryRunner, which causes the Broker to look
for the segment somewhere else.

In addition, this patch changes SinkQuerySegmentWalker to acquire references
to all hydrants (subsegments of a sink) at once, and return a
ReportTimelineMissingSegmentQueryRunner if *any* of them could not be acquired.
I suspect, although have not confirmed, that the prior behavior could lead to
segments being reported as missing even though results from some hydrants were
still included.

* Some more test coverage.
@LakshSingla LakshSingla added this to the 29.0.0 milestone Jan 29, 2024
riovic918data pushed a commit to riovic918data/druid that referenced this pull request Jun 12, 2026
…g-segment retry bug. (apache#15260)

* Fix NPE caused by realtime segment closing race, fix possible missing-segment retry bug.

Fixes apache#12168, by returning empty from FireHydrant when the segment is
swapped to null. This causes the SinkQuerySegmentWalker to use
ReportTimelineMissingSegmentQueryRunner, which causes the Broker to look
for the segment somewhere else.

In addition, this patch changes SinkQuerySegmentWalker to acquire references
to all hydrants (subsegments of a sink) at once, and return a
ReportTimelineMissingSegmentQueryRunner if *any* of them could not be acquired.
I suspect, although have not confirmed, that the prior behavior could lead to
segments being reported as missing even though results from some hydrants were
still included.

* Some more test coverage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Query realtime datasource may get NullPointerException just when segment unannouncing.

3 participants