Skip to content

Merge control topic and last persisted offests - #14525

Merged
danielcweeks merged 2 commits into
apache:mainfrom
danielcweeks:kc-merge-offsets
Nov 7, 2025
Merged

danielcweeks merged 2 commits into
apache:mainfrom
danielcweeks:kc-merge-offsets

Conversation

@danielcweeks

@danielcweeks danielcweeks commented Nov 7, 2025 •

Copy link
Copy Markdown
Contributor

The control group topic offsets that are persisted in the table state my include a subset of partitions if some partitions do not have values. We currently overwrite the previous value, but that may remove partition offset information of not all partitions are included in the most recent commit.

Comment on lines +214 to +216
Stream.of(committedOffsets, controlTopicOffsets)
.flatMap(map -> map.entrySet().stream())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, Long::max));

@singhpk234 singhpk234 Nov 7, 2025 •

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.

[doubt] IIUC this will merge both maps and in case of matching keys take the max Val ? wondering this case:

Lets say my committed offset :
[0, 100] [2, 250]
my control topic offset :
[1, 150] [2, 200]

my output [0, 100] [1,150] [2, 250], but i think we did went back as we [2, 200] in control offset ? is this check flagged already somewhere ?

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.

This is the correct behavior. The offsets in the table correspond to the data committed. If the user did want to roll back the offsets, they also need to roll back the offsets in the table, either by rolling back the snapshot or by updating the offsets manually. (The hope was we'd have tools to help with that at some point.)

@bryanck

bryanck commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

Very nice catch, thanks for fixing this!

@bryanck

bryanck commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

cc @kumarpritam863 you might be interested

@bryanck

bryanck commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

One thing to note is that tables that currently have only a subset of offsets might need some commit cycles until they are fixed.

@singhpk234 singhpk234 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 too, Great find, thanks @danielcweeks !

thanks @bryanck for the pointer (here)

should we mark it 1.10.1 ?

@danielcweeks danielcweeks added this to the Iceberg 1.10.1 milestone Nov 7, 2025
@danielcweeks
danielcweeks merged commit 8da07dc into apache:main Nov 7, 2025
12 checks passed
entry.getKey(), entry.getValue(), controlTopicOffsets(), validThroughTs);
});

// we should only get here if all tables committed successfully...

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.

@danielcweeks @bryanck Does the method below (committing the control topic offsets) need to have the merged offsets as well?

huaxingao pushed a commit to huaxingao/iceberg that referenced this pull request Nov 13, 2025
* Merge control topic and last persisted offests

* Add tests

(cherry picked from commit 8da07dc)
huaxingao added a commit that referenced this pull request Nov 13, 2025
* Merge control topic and last persisted offests

* Add tests

(cherry picked from commit 8da07dc)

Co-authored-by: Daniel Weeks <dweeks@apache.org>
thomaschow pushed a commit to thomaschow/iceberg that referenced this pull request Jan 19, 2026
* Merge control topic and last persisted offests

* Add tests
talatuyarer pushed a commit to talatuyarer/iceberg that referenced this pull request Apr 1, 2026
* Merge control topic and last persisted offests

* Add tests
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.

4 participants