Skip to content

Make smoll refactor in MVCC#5599

Draft
avinassh wants to merge 2 commits intotursodatabase:mainfrom
avinassh:mvcc-refactor
Draft

Make smoll refactor in MVCC#5599
avinassh wants to merge 2 commits intotursodatabase:mainfrom
avinassh:mvcc-refactor

Conversation

@avinassh
Copy link
Member

Description

Depends on #5596

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors the MVCC (Multi-Version Concurrency Control) commit logic to reduce code duplication and adds correctness assertions. The PR depends on #5596 which added initial MVCC correctness asserts, and this PR continues that work with additional refactoring.

Changes:

  • Extracted common read-only transaction commit logic into commit_read_only_tx helper function
  • Extracted version timestamp conversion logic into convert_version_timestamps helper function
  • Added runtime assertions to enforce MVCC invariants (transactions not depending on themselves, proper timestamp ordering)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Extract commit_read_only_tx() to unify the read-only transaction
commit logic used by both the Initial fast-path and the
WaitForDependencies path.

The WaitForDependencies path previously called
pager_commit_lock.unlock() directly inside the is_exclusive_tx guard,
while Initial used unlock_commit_lock_if_held(). Both were correct
(exclusive txs always hold the commit lock), but the helper is used
now for consistency.
Deduplicate the TxID-to-Timestamp conversion loops for table rows
and index rows during commit postprocessing. The same logic (match
begin/end against tx_id, replace with Timestamp, append to log_record,
check sqlite_schema) was repeated for both row types.
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