René's URL Explorer Experiment


Title: fix(tables): drop the per-table row-order lock from inserts by TheodoreSpeaks · Pull Request #8811 · simstudioai/sim · GitHub

Open Graph Title: fix(tables): drop the per-table row-order lock from inserts by TheodoreSpeaks · Pull Request #8811 · simstudioai/sim

X Title: fix(tables): drop the per-table row-order lock from inserts by TheodoreSpeaks · Pull Request #8811 · simstudioai/sim

Description: Summary Inserts no longer take the per-table row-order advisory lock (user_table_rows_pos). It was held until commit, so one insert stuck waiting on synchronous replication made every other insert to that table wait behind it and fail at the 3 s lock_timeout. With #8765, a row write no longer holds any lock shared by the whole table. Append keys: appendKeys mints inside the integer range after the last key, narrowed to a random sub-range (32 random halvings). Two appends that read the same last key never collide, a batch stays contiguous instead of interleaving with another writer's, and keys don't grow across appends (8–9 characters after 2,000 sequential appends). Positions stay max + 1, read without a lock, so concurrent appends can share one. The run dispatcher pages on (position, id). When a window is full, it also takes the remaining rows at the last position, so a tie split across windows is never skipped. No schema or API change: the cursor is still the last position processed. Positional inserts take the next key strictly above the lower neighbour, the same rule the neighbour-anchored path already used, so a tied key no longer throws a >= b. A position past the last row now appends; it used to mint a0 and land the row near the top. Upsert: the re-check behind the order lock is gone. The conflict target is always a unique column, and lockUniqueValues already serializes same-value upserts before the lookup. Replace still excludes a concurrent replace through lockUniqueColumns, which every replace takes exclusively, even on tables with no unique columns. An insert that commits during a replace survives it, the same outcome as running right after it. Not changed: the order_key backfill script migration and the collation repair script still take the old lock. Neither concurrent appends nor these scripts are protected by it any more; the scripts only rewrite tables without valid keys. Benchmark Local Postgres, 48 concurrent writers on one table through the real row services, 10 s per scenario, with a 20 ms commit delay per transaction to stand in for the replication wait (locks still held). Successful ops/s, p99, failures: Scenario Op staging + #8765 + #8765 + this Inserts only insert 17/s · 3115 ms · 13 timeouts 22/s · 2919 ms · 0 1510/s · 80 ms · 0 Mixed insert 2/s · 4856 ms · 39/62 timed out 13/s · 1881 ms · 0 404/s · 84 ms · 0 Mixed + one insert stalled 4 s insert 1/s · 5901 ms · 46/63 timed out 7/s · 3039 ms · 16/86 timed out 461/s · 81 ms · 0 Mixed + one insert stalled 4 s update 7/s · 8011 ms · 0 92/s · 672 ms · 0 384/s · 118 ms · 0 Live row count matched COUNT(*) in every run. Absolute numbers vary between runs; read the columns relative to each other. Type of Change Bug fix Testing New integration tests, each red on the pre-change code: Every insert path (append, at a position, after a row, batch, upsert, import with a new column) commits while another transaction holds the retired lock. Before: each waits out the 3 s lock timeout. 4 batches and 4 single inserts that all read the same last key get distinct keys, and each batch stays contiguous. Red with deterministic append keys: 25 rows, 6 distinct keys. Insert at a position between two rows sharing a key. Before: throws. Insert at a position past the last row lands last. Before: lands near the top. Dispatcher (dispatcher.integration.ts): rows that share positions across a window boundary each run exactly once. Before: tied rows skipped. Two concurrent replaces leave exactly one row set (guards the unique-lock serialization, green before and after). The unique-value race tests used the order lock to pause inserts mid-flight. They now pause on a definition row held FOR UPDATE, which an insert's foreign-key check waits on after its unique check. The obsolete lock-order unit tests are removed. Table + TTL integration suites: migrated 161 passed, push-provisioned 131 passed. Table unit tests 987 passed. lint:check and check:audits pass. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA) 🤖 Generated with Claude Code https://claude.ai/code/session_01CJxC2fgucGVpT59RV5Z7xv

Open Graph Description: Summary Inserts no longer take the per-table row-order advisory lock (user_table_rows_pos). It was held until commit, so one insert stuck waiting on synchronous replication made every other insert...

X Description: Summary Inserts no longer take the per-table row-order advisory lock (user_table_rows_pos). It was held until commit, so one insert stuck waiting on synchronous replication made every other insert...

Opengraph URL: https://github.com/simstudioai/sim/pull/8811

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:790312ad-6273-45e5-4e5e-55375ab92916
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9DFC:3988A1:E087B2:1341850:6AFB5EB6
html-safe-noncebb9ddd9ecff7db5951c366700b4f681100431654ee099ab490faded9b85374d4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5REZDOjM5ODhBMTpFMDg3QjI6MTM0MTg1MDo2QUZCNUVCNiIsInZpc2l0b3JfaWQiOiI1NjkyNTMxNjEyNzU1NjQ4MTgyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacc72b355ccf6fab8f5d08207f8950af7f1a246e13b66fca66d57bcb6d0832dbac
hovercard-subject-tagpull_request:4792506238
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/8811/files
twitter:imagehttps://avatars.githubusercontent.com/u/19564703?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/19564703?s=400&v=4
og:image:altSummary Inserts no longer take the per-table row-order advisory lock (user_table_rows_pos). It was held until commit, so one insert stuck waiting on synchronous replication made every other insert...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneea33d13c96d0ff66bd8fa906b193d2213536b78cb06b0c50a4632c58b1418f94
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release59ef97164c52cf59bd10558ddec9c4f482763988
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/8811/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F8811%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F8811%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/8811/files
Reloadhttps://github.com/simstudioai/sim/pull/8811/files
Reloadhttps://github.com/simstudioai/sim/pull/8811/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests197 (197)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
TheodoreSpeakshttps://github.com/TheodoreSpeaks
staginghttps://github.com/simstudioai/sim/tree/staging
fix/drop-row-order-lockhttps://github.com/simstudioai/sim/tree/fix/drop-row-order-lock
Conversation 13 https://github.com/simstudioai/sim/pull/8811
Commits 2 https://github.com/simstudioai/sim/pull/8811/commits
Checks 45 https://github.com/simstudioai/sim/pull/8811/checks
Files changed https://github.com/simstudioai/sim/pull/8811/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8811/files
fix(tables): drop the per-table row-order lock from inserts https://github.com/simstudioai/sim/pull/8811/files#top
Show all changes 2 commits https://github.com/simstudioai/sim/pull/8811/files
a1a384e fix(tables): drop the per-table row-order lock from inserts TheodoreSpeaks Oct 8, 2026 https://github.com/simstudioai/sim/pull/8811/commits/a1a384ee0e073df1f9d784234d3c64b4a13632fc
f334574 test(tables): order rows bytewise in the lockless-insert tests and st… TheodoreSpeaks Oct 8, 2026 https://github.com/simstudioai/sim/pull/8811/commits/f334574c943ff754f71a24d61bb2615f45819efa
Clear filters https://github.com/simstudioai/sim/pull/8811/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8811/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8811/files
dispatcher.integration.ts https://github.com/simstudioai/sim/pull/8811/files#diff-82746fa53d2126501bb43f252159c38d59518e849f97627301cddfb2618ffab2
dispatcher.ts https://github.com/simstudioai/sim/pull/8811/files#diff-f8c89504ec9f5dd51c53a54ead52a73b9fe7c64bc6d6a19d01d07cd72e2435a6
import-data.ts https://github.com/simstudioai/sim/pull/8811/files#diff-bd07d4e05a01d98126156b48ff15cfbaa9e6cb5cf636878cf4f78225a57fd2fa
lock-order.test.ts https://github.com/simstudioai/sim/pull/8811/files#diff-593e419fc0699598b6b79f7e5faadc7ef1c9e02184a1a4ab9a65024ae83e7005
order-key.ts https://github.com/simstudioai/sim/pull/8811/files#diff-3c79b7b93620e6a36152091377fe2473de2a59afa3dcb0a0317d71db98067bad
ordering.ts https://github.com/simstudioai/sim/pull/8811/files#diff-ae68362b6a8201eef72124d4fa40ebc0332664f66d7487e04d435623e408658f
row-writes.integration.ts https://github.com/simstudioai/sim/pull/8811/files#diff-653e2260e6bc1166f12f87c1cd10329f4ae89e569dc2f54ade8cf6b57c027468
service.ts https://github.com/simstudioai/sim/pull/8811/files#diff-bb7e45c4b7c8d660db1d230975eb35231ae2616360572a342fd56d37296bb23f
unique-locks.ts https://github.com/simstudioai/sim/pull/8811/files#diff-7789d73b180c071e0909c0066680f335dcd29d2d1b4b95b6de904f20a813c135
service.ts https://github.com/simstudioai/sim/pull/8811/files#diff-691e9b1dc59be0015a1be5ea6189899b241d4e979a8b40e088dd7d722cfaadb6
update-row.test.ts https://github.com/simstudioai/sim/pull/8811/files#diff-7ec760a0597423be488477c6f96b641c36f1a13d1d9b74a46f68b6458fc979e6
validation.ts https://github.com/simstudioai/sim/pull/8811/files#diff-4afe0c5257b85a0e6c183bc2a7cd3db262dc445d8f341964364c751f6aa34f04
apps/sim/lib/table/dispatcher.integration.tshttps://github.com/simstudioai/sim/pull/8811/files#diff-82746fa53d2126501bb43f252159c38d59518e849f97627301cddfb2618ffab2
View file https://github.com/simstudioai/sim/blob/f334574c943ff754f71a24d61bb2615f45819efa/apps/sim/lib/table/dispatcher.integration.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8811/{{ revealButtonHref }}
apps/sim/lib/table/dispatcher.tshttps://github.com/simstudioai/sim/pull/8811/files#diff-f8c89504ec9f5dd51c53a54ead52a73b9fe7c64bc6d6a19d01d07cd72e2435a6
View file https://github.com/simstudioai/sim/blob/f334574c943ff754f71a24d61bb2615f45819efa/apps/sim/lib/table/dispatcher.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8811/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8811/files#diff-f8c89504ec9f5dd51c53a54ead52a73b9fe7c64bc6d6a19d01d07cd72e2435a6
Please reload this pagehttps://github.com/simstudioai/sim/pull/8811/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8811/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8811/files
https://github.com/simstudioai/sim/pull/8811/files#diff-f8c89504ec9f5dd51c53a54ead52a73b9fe7c64bc6d6a19d01d07cd72e2435a6
apps/sim/lib/table/import-data.tshttps://github.com/simstudioai/sim/pull/8811/files#diff-bd07d4e05a01d98126156b48ff15cfbaa9e6cb5cf636878cf4f78225a57fd2fa
View file https://github.com/simstudioai/sim/blob/f334574c943ff754f71a24d61bb2615f45819efa/apps/sim/lib/table/import-data.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8811/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8811/files#diff-bd07d4e05a01d98126156b48ff15cfbaa9e6cb5cf636878cf4f78225a57fd2fa
https://github.com/simstudioai/sim/pull/8811/files#diff-bd07d4e05a01d98126156b48ff15cfbaa9e6cb5cf636878cf4f78225a57fd2fa
https://github.com/simstudioai/sim/pull/8811/files#diff-bd07d4e05a01d98126156b48ff15cfbaa9e6cb5cf636878cf4f78225a57fd2fa
https://github.com/simstudioai/sim/pull/8811/files#diff-bd07d4e05a01d98126156b48ff15cfbaa9e6cb5cf636878cf4f78225a57fd2fa
https://github.com/simstudioai/sim/pull/8811/files#diff-bd07d4e05a01d98126156b48ff15cfbaa9e6cb5cf636878cf4f78225a57fd2fa
https://github.com/simstudioai/sim/pull/8811/files#diff-bd07d4e05a01d98126156b48ff15cfbaa9e6cb5cf636878cf4f78225a57fd2fa
https://github.com/simstudioai/sim/pull/8811/files#diff-bd07d4e05a01d98126156b48ff15cfbaa9e6cb5cf636878cf4f78225a57fd2fa
https://github.com/simstudioai/sim/pull/8811/files#diff-bd07d4e05a01d98126156b48ff15cfbaa9e6cb5cf636878cf4f78225a57fd2fa
https://github.com/simstudioai/sim/pull/8811/files#diff-bd07d4e05a01d98126156b48ff15cfbaa9e6cb5cf636878cf4f78225a57fd2fa
https://github.com/simstudioai/sim/pull/8811/files#diff-bd07d4e05a01d98126156b48ff15cfbaa9e6cb5cf636878cf4f78225a57fd2fa
apps/sim/lib/table/lock-order.test.tshttps://github.com/simstudioai/sim/pull/8811/files#diff-593e419fc0699598b6b79f7e5faadc7ef1c9e02184a1a4ab9a65024ae83e7005
View file https://github.com/simstudioai/sim/blob/1bb9e8667355d4c70c671c94e30071a17ff9a4d6/apps/sim/lib/table/lock-order.test.ts
Open in desktop https://desktop.github.com
Please reload this pagehttps://github.com/simstudioai/sim/pull/8811/files
apps/sim/lib/table/order-key.tshttps://github.com/simstudioai/sim/pull/8811/files#diff-3c79b7b93620e6a36152091377fe2473de2a59afa3dcb0a0317d71db98067bad
View file https://github.com/simstudioai/sim/blob/f334574c943ff754f71a24d61bb2615f45819efa/apps/sim/lib/table/order-key.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/8811/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/8811/files#diff-3c79b7b93620e6a36152091377fe2473de2a59afa3dcb0a0317d71db98067bad
https://github.com/simstudioai/sim/pull/8811/files#diff-3c79b7b93620e6a36152091377fe2473de2a59afa3dcb0a0317d71db98067bad
Please reload this pagehttps://github.com/simstudioai/sim/pull/8811/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/8811/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.