Skip to content

add update or replace to sim and fix update or replace ordering#5606

Open
Pavan-Nambi wants to merge 5 commits intotursodatabase:mainfrom
Pavan-Nambi:sim_update
Open

add update or replace to sim and fix update or replace ordering#5606
Pavan-Nambi wants to merge 5 commits intotursodatabase:mainfrom
Pavan-Nambi:sim_update

Conversation

@Pavan-Nambi
Copy link
Copy Markdown
Contributor

@Pavan-Nambi Pavan-Nambi commented Feb 25, 2026

NOTE: this do not qualify for turso challenge, this is a general simulator improvement. - update or replace is added after 0.4.4

In update or replace , we handled the rowid conflict too late; we updated indexes first, then deleted the conflicting row. If the new row and the conflicting row shared
indexed values, this could leave stale entries in secondary indexes (and NotExists could also move the table cursor onto the wrong row). Fix: delete the conflicting row (and its index
entries) before the index update loop, then re-seek back to the row being updated.

 cargo run --bin limbo_sim -- --maximum-tests 1000 --seed 4939548460769627338
 
 Error: failed with error: 'InternalError("Integrity Check Failed: row 1 missing from index idx_approachable_klassen_827_gregario_320403\nwrong # of entries in index idx_approachable_klassen_827_gregario_320403")'

- Three similar lines > premature abstraction

## Index Mutations

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

if any of u think, this pollutes code-qualit/skill.md i am ok with removing it, personally i only added this cuz i remember seeing similar issue in check constraints pr - see #5040 (comment) and it's easy to miss. i think it's nice to have this.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Feb 25, 2026

Merging this PR will not alter performance

✅ 279 untouched benchmarks
⏩ 105 skipped benchmarks1


Comparing Pavan-Nambi:sim_update (b5c5122) with main (5291b2b)

Open in CodSpeed

Footnotes

  1. 105 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Pavan-Nambi Pavan-Nambi reopened this Feb 25, 2026
@Pavan-Nambi Pavan-Nambi changed the title update or replace. add update or replace to sim and fix update or replace ordering Feb 25, 2026
@Pavan-Nambi Pavan-Nambi marked this pull request as ready for review February 25, 2026 18:04
Copy link
Copy Markdown

@turso-bot turso-bot bot left a comment

Choose a reason for hiding this comment

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

Please review @PThorpe92

PThorpe92 added a commit that referenced this pull request Feb 28, 2026
Cherry-picked from #5606
The PR has semi-related simulator changes but I wanted to isolate this
out and merge first

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #5672
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.

1 participant