From 6c0292f8df34655105ea8678aabaabfafebffd92 Mon Sep 17 00:00:00 2001 From: mcgrj <23058184+mcgrj@users.noreply.github.com> Date: Sat, 21 Nov 2026 14:48:38 +0000 Subject: [PATCH 1/7] [docs] Document that undo recovery rolls back other writers' changes on aggregation tables --- website/docs/table-design/merge-engines/aggregation.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/docs/table-design/merge-engines/aggregation.md b/website/docs/table-design/merge-engines/aggregation.md index 1b618060956..106eda85469 100644 --- a/website/docs/table-design/merge-engines/aggregation.md +++ b/website/docs/table-design/merge-engines/aggregation.md @@ -1507,6 +1507,8 @@ When using the `aggregation` merge engine, be aware of the following critical li When writing to an aggregate merge engine table using the Flink engine, Fluss does provide exactly-once guarantees. Thanks to Flink's checkpointing mechanism, in the event of a failure and recovery, the Flink connector automatically performs an undo operation to roll back the table state to what it was at the last successful checkpoint. This ensures no over-counting or under-counting: data remains consistent and accurate. +The undo operation rolls back every change in a bucket after the job's last write before its last successful checkpoint, whichever client wrote it. Make the Flink job the only writer of the table: changes that other jobs or clients write to it can be deleted or reverted when the job recovers. Buckets the job had not written to at that checkpoint, including partitions created after it, are rolled back from their first offset. + However, when using the Fluss client API directly (outside of Flink), exactly-once is not provided out of the box. In such cases, users must implement their own recovery logic (similar to what the Flink connector does) by explicitly resetting the table state to a previous version by performing undo operations. For detailed information about Exactly-Once implementation, please refer to: [FIP-21: Aggregation Merge Engine](https://cwiki.apache.org/confluence/display/FLUSS/FIP-21%3A+Aggregation+Merge+Engine) From c06d90293e6a2cbc718ba97c322d6e7e00f75df2 Mon Sep 17 00:00:00 2001 From: mcgrj <23058184+mcgrj@users.noreply.github.com> Date: Sat, 21 Nov 2026 14:59:38 +0000 Subject: [PATCH 2/7] [docs] Move single-writer note for aggregation undo into its own subsection with an example --- website/docs/table-design/merge-engines/aggregation.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/website/docs/table-design/merge-engines/aggregation.md b/website/docs/table-design/merge-engines/aggregation.md index 106eda85469..485abf85f87 100644 --- a/website/docs/table-design/merge-engines/aggregation.md +++ b/website/docs/table-design/merge-engines/aggregation.md @@ -1507,12 +1507,16 @@ When using the `aggregation` merge engine, be aware of the following critical li When writing to an aggregate merge engine table using the Flink engine, Fluss does provide exactly-once guarantees. Thanks to Flink's checkpointing mechanism, in the event of a failure and recovery, the Flink connector automatically performs an undo operation to roll back the table state to what it was at the last successful checkpoint. This ensures no over-counting or under-counting: data remains consistent and accurate. -The undo operation rolls back every change in a bucket after the job's last write before its last successful checkpoint, whichever client wrote it. Make the Flink job the only writer of the table: changes that other jobs or clients write to it can be deleted or reverted when the job recovers. Buckets the job had not written to at that checkpoint, including partitions created after it, are rolled back from their first offset. - However, when using the Fluss client API directly (outside of Flink), exactly-once is not provided out of the box. In such cases, users must implement their own recovery logic (similar to what the Flink connector does) by explicitly resetting the table state to a previous version by performing undo operations. For detailed information about Exactly-Once implementation, please refer to: [FIP-21: Aggregation Merge Engine](https://cwiki.apache.org/confluence/display/FLUSS/FIP-21%3A+Aggregation+Merge+Engine) +### Single Writer with Flink + +A Flink job writing an aggregation table must be the table's only writer. On recovery, the job rolls back every change in each bucket since its last checkpointed write, including changes from other jobs or clients. Partitions created after the checkpoint are rolled back in full. + +For example, with `v` aggregated by `sum`: the job writes `(1, 10)` and checkpoints. Another client then writes `(1, 100)` and `(1001, 7)`, so id 1 sums to 110. If the job fails and restarts, id 1 goes back to 10 and id 1001 is deleted. + ::: ## See Also From ac8d0f041d768cfe73fafc088242ed36cc8fa0a5 Mon Sep 17 00:00:00 2001 From: mcgrj Date: Wed, 25 Nov 2026 07:46:51 +0000 Subject: [PATCH 3/7] [docs] Clarify undo recovery for full-row writes --- website/docs/table-design/merge-engines/aggregation.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/website/docs/table-design/merge-engines/aggregation.md b/website/docs/table-design/merge-engines/aggregation.md index 485abf85f87..6074daa0265 100644 --- a/website/docs/table-design/merge-engines/aggregation.md +++ b/website/docs/table-design/merge-engines/aggregation.md @@ -1511,11 +1511,13 @@ However, when using the Fluss client API directly (outside of Flink), exactly-on For detailed information about Exactly-Once implementation, please refer to: [FIP-21: Aggregation Merge Engine](https://cwiki.apache.org/confluence/display/FLUSS/FIP-21%3A+Aggregation+Merge+Engine) -### Single Writer with Flink +### Undo Recovery for Full-Row Writes -A Flink job writing an aggregation table must be the table's only writer. On recovery, the job rolls back every change in each bucket since its last checkpointed write, including changes from other jobs or clients. Partitions created after the checkpoint are rolled back in full. +When a Flink job writes full rows to an aggregation table, restoring the job from a checkpoint can undo other writers’ changes in the same bucket. The checkpoint records the job’s own write position in each bucket. Another writer’s changes after that position can be undone even if they were written before the checkpoint was taken. -For example, with `v` aggregated by `sum`: the job writes `(1, 10)` and checkpoints. Another client then writes `(1, 100)` and `(1001, 7)`, so id 1 sums to 110. If the job fails and restarts, id 1 goes back to 10 and id 1001 is deleted. +For example, a Flink job writes a row with key `1` and takes a checkpoint. Another writer then inserts key `1001` in the same bucket. Restoring the job from that checkpoint deletes key `1001`, even though the job never wrote that key. + +Multiple Flink jobs can write the same key when each uses explicit partial updates and their non-key target columns do not overlap. If one job updates `price` and another updates `stock`, recovering the `price` job preserves the `stock` update. ::: From 6d2fa1d8829e1acf05ca819785fbebfa00b2a092 Mon Sep 17 00:00:00 2001 From: mcgrj Date: Wed, 25 Nov 2026 07:49:46 +0000 Subject: [PATCH 4/7] [docs] Clarify where bucket undo recovery starts --- website/docs/table-design/merge-engines/aggregation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/table-design/merge-engines/aggregation.md b/website/docs/table-design/merge-engines/aggregation.md index 6074daa0265..43027cd2640 100644 --- a/website/docs/table-design/merge-engines/aggregation.md +++ b/website/docs/table-design/merge-engines/aggregation.md @@ -1513,7 +1513,7 @@ For detailed information about Exactly-Once implementation, please refer to: [FI ### Undo Recovery for Full-Row Writes -When a Flink job writes full rows to an aggregation table, restoring the job from a checkpoint can undo other writers’ changes in the same bucket. The checkpoint records the job’s own write position in each bucket. Another writer’s changes after that position can be undone even if they were written before the checkpoint was taken. +When a Flink job writes full rows to an aggregation table, restoring the job from a checkpoint can undo other writers’ changes in the same bucket. For each bucket, undo starts at the recovery offset. That offset can already be behind the end of the bucket log when the checkpoint is taken, so recovery can undo another writer’s changes made before the checkpoint. For example, a Flink job writes a row with key `1` and takes a checkpoint. Another writer then inserts key `1001` in the same bucket. Restoring the job from that checkpoint deletes key `1001`, even though the job never wrote that key. From 4da94463c9d8cc5b22655ffa9449c5bd6c384992 Mon Sep 17 00:00:00 2001 From: mcgrj Date: Wed, 25 Nov 2026 07:52:27 +0000 Subject: [PATCH 5/7] [docs] Identify both jobs in the undo recovery example --- website/docs/table-design/merge-engines/aggregation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/table-design/merge-engines/aggregation.md b/website/docs/table-design/merge-engines/aggregation.md index 43027cd2640..88dff8557b9 100644 --- a/website/docs/table-design/merge-engines/aggregation.md +++ b/website/docs/table-design/merge-engines/aggregation.md @@ -1515,7 +1515,7 @@ For detailed information about Exactly-Once implementation, please refer to: [FI When a Flink job writes full rows to an aggregation table, restoring the job from a checkpoint can undo other writers’ changes in the same bucket. For each bucket, undo starts at the recovery offset. That offset can already be behind the end of the bucket log when the checkpoint is taken, so recovery can undo another writer’s changes made before the checkpoint. -For example, a Flink job writes a row with key `1` and takes a checkpoint. Another writer then inserts key `1001` in the same bucket. Restoring the job from that checkpoint deletes key `1001`, even though the job never wrote that key. +For example, Job A writes a row with key `1` and takes a checkpoint. Job B then inserts a row with key `1001` in the same bucket. When Job A recovers from its checkpoint, it deletes the row Job B inserted. Multiple Flink jobs can write the same key when each uses explicit partial updates and their non-key target columns do not overlap. If one job updates `price` and another updates `stock`, recovering the `price` job preserves the `stock` update. From c425cf48dcc33e86c6231220b3c57f7d64576386 Mon Sep 17 00:00:00 2001 From: mcgrj Date: Wed, 25 Nov 2026 07:55:27 +0000 Subject: [PATCH 6/7] [docs] Clarify partial-update recovery across jobs --- website/docs/table-design/merge-engines/aggregation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/table-design/merge-engines/aggregation.md b/website/docs/table-design/merge-engines/aggregation.md index 88dff8557b9..65d7b59e199 100644 --- a/website/docs/table-design/merge-engines/aggregation.md +++ b/website/docs/table-design/merge-engines/aggregation.md @@ -1517,7 +1517,7 @@ When a Flink job writes full rows to an aggregation table, restoring the job fro For example, Job A writes a row with key `1` and takes a checkpoint. Job B then inserts a row with key `1001` in the same bucket. When Job A recovers from its checkpoint, it deletes the row Job B inserted. -Multiple Flink jobs can write the same key when each uses explicit partial updates and their non-key target columns do not overlap. If one job updates `price` and another updates `stock`, recovering the `price` job preserves the `stock` update. +When two Flink jobs use explicit partial updates on the same key, recovering one job preserves the other job’s updates if they update separate sets of non-key columns. For example, if Job A updates only `price` and Job B updates only `stock`, recovering Job A preserves Job B’s `stock` update. ::: From 44efe6ce753fa5b28e3661a686850e4884242f20 Mon Sep 17 00:00:00 2001 From: mcgrj Date: Thu, 26 Nov 2026 08:51:32 +0000 Subject: [PATCH 7/7] [docs] State conditions for exactly-once aggregation writes --- website/docs/table-design/merge-engines/aggregation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/table-design/merge-engines/aggregation.md b/website/docs/table-design/merge-engines/aggregation.md index 65d7b59e199..10349261a2c 100644 --- a/website/docs/table-design/merge-engines/aggregation.md +++ b/website/docs/table-design/merge-engines/aggregation.md @@ -1505,7 +1505,7 @@ When using the `aggregation` merge engine, be aware of the following critical li ### Exactly-Once Semantics -When writing to an aggregate merge engine table using the Flink engine, Fluss does provide exactly-once guarantees. Thanks to Flink's checkpointing mechanism, in the event of a failure and recovery, the Flink connector automatically performs an undo operation to roll back the table state to what it was at the last successful checkpoint. This ensures no over-counting or under-counting: data remains consistent and accurate. +Flink provides exactly-once writes to an aggregation table when a single Flink job is the only writer, or when multiple Flink jobs use explicit partial updates on non-overlapping sets of non-primary-key columns. Thanks to Flink's checkpointing mechanism, in the event of a failure and recovery, the Flink connector automatically performs an undo operation to roll back the table state to what it was at the last successful checkpoint. This ensures no over-counting or under-counting: data remains consistent and accurate. However, when using the Fluss client API directly (outside of Flink), exactly-once is not provided out of the box. In such cases, users must implement their own recovery logic (similar to what the Flink connector does) by explicitly resetting the table state to a previous version by performing undo operations.