Skip to content

Fix segment ID mismatch in parallel indexing with non-UTC segmentGranularity - #20032

Open
triopo wants to merge 1 commit into
apache:masterfrom
triopo:fix/parallel-index-nonutc-segmentid
Open

Fix segment ID mismatch in parallel indexing with non-UTC segmentGranularity#20032
triopo wants to merge 1 commit into
apache:masterfrom
triopo:fix/parallel-index-nonutc-segmentid

Conversation

@triopo

@triopo triopo commented Aug 17, 2026

Copy link
Copy Markdown

Description

SinglePhaseParallelIndexTaskRunner built the parent's SegmentIdWithShardSpec using the interval as returned from the sub-task, which retains its original time zone. When segmentGranularity specifies a non-UTC time zone (e.g. Europe/Warsaw), Interval#toString() renders with the zone offset (e.g. "2026-04-08T00:00:00.000+02:00"), while the sub-task's own segment ID for the same interval is built from a JSON-deserialized interval that normalizes to UTC ("2026-04-07T22:00:00.000Z"). The two string representations differ, so matching prevSegmentId via indexOf() fails and parallel indexing breaks for non-UTC segment granularities.

Normalize the interval to UTC before constructing the parent's segment ID so it matches what sub-tasks produce.

This PR has:

  • [ x] 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
  • [ x] 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.
  • [x ] been tested in a test Druid cluster.

…ularity

SinglePhaseParallelIndexTaskRunner built the parent's SegmentIdWithShardSpec
using the interval as returned from the sub-task, which retains its original
time zone. When segmentGranularity specifies a non-UTC time zone (e.g.
Europe/Warsaw), Interval#toString() renders with the zone offset (e.g.
"2026-04-08T00:00:00.000+02:00"), while the sub-task's own segment ID for the
same interval is built from a JSON-deserialized interval that normalizes to
UTC ("2026-04-07T22:00:00.000Z"). The two string representations differ, so
matching prevSegmentId via indexOf() fails and parallel indexing breaks for
non-UTC segment granularities.

Normalize the interval to UTC before constructing the parent's segment ID so
it matches what sub-tasks produce.

@FrankChen021 FrankChen021 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have reviewed the code for correctness, edge cases, concurrency, and integration risks; no issues found.

Reviewed 1 of 1 changed files.


This is an automated review by Codex GPT-5.6-Luna(max)

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.

2 participants