Skip to content

docs: repare the transaction conflicts resolution flow#5133

Closed
majin1102 wants to merge 4 commits intolance-format:mainfrom
majin1102:transaction-docs
Closed

docs: repare the transaction conflicts resolution flow#5133
majin1102 wants to merge 4 commits intolance-format:mainfrom
majin1102:transaction-docs

Conversation

@majin1102
Copy link
Copy Markdown
Contributor

Close #5122

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Nov 4, 2025
@majin1102
Copy link
Copy Markdown
Contributor Author

Hi @wjones127 Please take a look when you have time

Comment thread docs/src/format/table/index.md Outdated
Comment thread docs/src/format/table/index.md Outdated
If there are any, begin the rebase process: read their transaction structures and check for conflicts.
If there are any conflicts and the conflicts are not retriable, abort the commit.
If the conflicts are retriable, writer should go back to step 2 and rebuild the transaction based on the newest version to resolve the conflicts.
4. Create a transaction file in the _transactions directory which describes the operations that were performed for two purposes:
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.

We might want to update this soon with #4774

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.

I think we could actually just make this a mermaid diagram. Then it's more understandable by AIs and can just be edited as text.

Here's how I would write it:

flowchart LR
    A[Write data files] --> C[Check for concurrent commits]
    A -.-> DF{{data/31a7060e-4898-4ecd-a428-afbff3539fa6.lance}}
    C --> D{Are there conflicts?}
    
    D -->|None| E[Write transaction file]
    E -.-> Txn{{_transactions/42-76019405-8d5a-43c3-a7a2-324ed49a9d75.txn}}
    D-->|Resolvable| G[Resolve conflicts] --> E
    G -.->|merged| Deletions{{_deletions/31a7060e-4898-4ecd-a428-afbff3539fa6.lance}}
    D -->|Retryable| H[Retry operation 🔄]
    D -->|Non-retryable| F[Abort ✗]
    
    E --> I[Atomically write manifest]
    I -.-> Manifest{{_versions/43.manifest}}
    I --> J{Success?}
    
    J -->|Yes| K[Complete ✓]
    J -->|No| C
    
    style A fill:#e1f5fe
    style K fill:#c8e6c9
    style F fill:#ffcdd2
    style H fill:#fff3e0
    style DF fill:#ddd
    style Txn fill:#ddd
    style Manifest fill:#ddd
    style Deletions fill: #ddd
Loading

This basically describes four outcomes of checking for conflicts:

  1. No conflicts
  2. Some conflicts, but we can resolve them just using the transactions
  3. Conflict, but it allows retries. So we can just retry the operation.
  4. Conflict, non-retryable. This rare, but happens for example if we are trying to append but another transaction completely changed the schema to remove columns we are trying to insert into.

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.

Sorry a bit late to this conversation, did not realize this PR. I just published #5209 which refreshes a lot of content for the table format and overall format intro. I also updated conflict resolution with mermaid diagram, but a bit different from this one. I will check tomorrow to see if I can reuse the content here.

Copy link
Copy Markdown
Contributor Author

@majin1102 majin1102 Nov 14, 2025

Choose a reason for hiding this comment

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

OK, I guess this PR would be useless.

If the conflicts are retryable, attempt to resolve conflicts between the candidate transaction and the conflicting transaction. For example, if they delete disjoint sets of rows, then the deletion files can be merged. If conflicts can't be resolved, the retryable conflict error is bubbled up. This can be handled as a full retry of the write operation.

Thanks for correcting me @wjones127 . I was misunderstanding about retryable.

Is this good to close? @jackye1995

jackye1995 added a commit that referenced this pull request Nov 11, 2025
Also refreshes all the contents regarding table format, separate it into
multiple documents for clarity.

Closes #4136 #5133
@majin1102 majin1102 closed this Dec 3, 2025
jackye1995 added a commit to jackye1995/lance that referenced this pull request Jan 21, 2026
Also refreshes all the contents regarding table format, separate it into
multiple documents for clarity.

Closes lance-format#4136 lance-format#5133
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The picture of conflict resolution is not right

3 participants