Skip to content

fix(datafusion): avoid replaying DML after an uncertain commit - #1587

Open
QuakeWang wants to merge 1 commit into
apache:mainfrom
QuakeWang:rest-update-repro
Open

QuakeWang wants to merge 1 commit into
apache:mainfrom
QuakeWang:rest-update-repro

Conversation

@QuakeWang

Copy link
Copy Markdown
Member

Purpose

DataFusion searched the entire commit error for conflict text. If REST published a snapshot and then returned an error containing Row ID conflict or Delete conflict, DataFusion could run the UPDATE again. A single value = value + 1 changed 10 to 12.

Brief change log

Classify conflicts from the top-level Paimon error. Genuine row-ID and delete conflicts still trigger replanning on their respective paths. An uncertain commit outcome propagates to the caller.

Tests

  • Unit tests cover typed row-ID retries and rejection of the opposite conflict prefix.
  • REST tests verify that data-evolution and copy-on-write UPDATEs both report an uncertain outcome after publication and leave the value at 11.

API and Format

No public API or storage format changes.

Documentation

No documentation update required.

A REST error can contain conflict text after the snapshot is published.
Matching the formatted error chain could execute an UPDATE twice.
Classify only top-level Paimon conflicts before retrying DML.

Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com>

@JeonDaehong JeonDaehong 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.

Checked the paths this relies on. The conflict checks in table_commit.rs that DML retries on (check_delete_entries_against_base, validate_row_id_alignment, validate_deleted_files) all return DataInvalid { source: None } with these prefixes, the uncertain outcome wraps the error in UnexpectedError, and the five retry sites (UPDATE, CoW UPDATE, both DELETEs and MERGE) pass the commit error through to_datafusion_error without another layer, so the top-level check sees the real error.

Since the classifier now depends on the exact prefix, I also checked that a reworded core message would be caught: renaming the two prefixes in table_commit.rs makes native_merge_retries_with_fresh_target_and_one_source_capture fail. On 2090c8c the merge_into unit tests (17), native_merge (16), rest_management_procedures (49) and the whole paimon-datafusion suite (1448) pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants