Skip to content

Conversation

AmatyaAvadhanula
Copy link
Contributor

@AmatyaAvadhanula AmatyaAvadhanula commented Oct 6, 2024

Fixes #16587

Streaming ingestion tasks operate by allocating segments before ingesting rows.
These allocations happen across replicas which may send different requests but must get the same segment id for a given (datasource, interval, version, sequenceName) across replicas.

The previousSegmentId despite being set in the SegmentAllocateAction must play no role in determining the segment id as streaming ingestion works by skipping lineage check.

This PR fixes a bug that arises because the above is not considered while checking for existing allocated segments for a given request.

Alternative approach:
(Perhaps the best solution is to always set previousSegmentId to null when lineage check is being skipped in the SegmentAllocateRequest.)

TODO: cluster testing

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.

Copy link
Contributor

@kfaraz kfaraz left a comment

Choose a reason for hiding this comment

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

Thanks for catching this, @AmatyaAvadhanula !

@@ -1326,7 +1326,8 @@ public UniqueAllocateRequest(
{
this.interval = interval;
this.sequenceName = request.getSequenceName();
this.previousSegmentId = request.getPreviousSegmentId();
// Even if the previousSegmentId is set, disregard it when skipping lineage check for streaming ingestion
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Even if the previousSegmentId is set, disregard it when skipping lineage check for streaming ingestion
// Even if the previousSegmentId is set, disregard it when skipping lineage check

@kfaraz kfaraz added this to the 31.0.0 milestone Oct 7, 2024
@kfaraz kfaraz merged commit ff97c67 into apache:master Oct 7, 2024
90 checks passed
@kfaraz kfaraz deleted the batch_segment_allocation_bug_with_replicas branch October 7, 2024 14:22
kfaraz pushed a commit to kfaraz/druid that referenced this pull request Oct 7, 2024
Fixes apache#16587

Streaming ingestion tasks operate by allocating segments before ingesting rows.
These allocations happen across replicas which may send different requests but
must get the same segment id for a given (datasource, interval, version, sequenceName)
across replicas.

This patch fixes the bug by ignoring the previousSegmentId when skipLineageCheck is true.
kfaraz added a commit that referenced this pull request Oct 8, 2024
Fixes #16587

Streaming ingestion tasks operate by allocating segments before ingesting rows.
These allocations happen across replicas which may send different requests but
must get the same segment id for a given (datasource, interval, version, sequenceName)
across replicas.

This patch fixes the bug by ignoring the previousSegmentId when skipLineageCheck is true.

Co-authored-by: AmatyaAvadhanula <amatya.avadhanula@imply.io>
vivek807 pushed a commit to deep-bi/druid that referenced this pull request Nov 23, 2024
…ache#17267)

Fixes apache#16587

Streaming ingestion tasks operate by allocating segments before ingesting rows.
These allocations happen across replicas which may send different requests but
must get the same segment id for a given (datasource, interval, version, sequenceName)
across replicas.

This patch fixes the bug by ignoring the previousSegmentId when skipLineageCheck is true.

Co-authored-by: AmatyaAvadhanula <amatya.avadhanula@imply.io>
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.

Kafka indexing service duplicate key exception in druid_pendingSegments table
2 participants