Repository navigation
fix(db): give push-managed databases the bytewise order_key collation - #10372
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
[Medium impact] The PR appears safe to merge. SummaryMakes push-managed databases use the same bytewise
No actionable issues found. Tests were not run during this review. Reviews (1) · Last reviewed commit: "fix(db): give push-managed databases the..." · Reviewed by Greptile |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ignored-columns.integration.ts("a batch insert names each dropped key once, in the order first sent") failed on 5 of the last 40 staging validations, every time on anintegration (push, …)shard. Rows came back out of insertion orderuser_table_rows.order_keyCOLLATE "C", so fractional keys (base-62, mixed case) compare bytewise as the library mints them.schema.tscan't express a column collation, so databases built bydb:push(local, dev, and the push CI path) kept the defaulten_US.UTF-8, which orders lowercase before uppercase.appendKeysmints keys with random bits, so some batches sort out of order thereapply-dev-table-triggers.ts, whichdb:pushalready runs to give push-managed databases the migration-only SQL foruser_table_rows, now also sets the collation. It runs only when the column isn't already"C", so a migrated database (staging, prod) is untouched, and a rerun doesn't rebuild the index. It runs between dropping and recreating the update trigger, since that trigger'sWHENreadsorder_keywrites.integration.tsno longer works around the gap withORDER BY order_key COLLATE "C". Its new case asserts'Zz'sorts before'a0', as it does bytewiseschema.ts's comment now points at where push-managed databases get the collationType of Change
Testing
db:push). Before the fix,order_keyhad no collation and the new test failed (['a0','Zz']); after, collationCand bothwrites.integration.tsandignored-columns.integration.tspass (112/112)ignored-columns.integration.tspassed 10/10 consecutive runs on the push-provisioned databaseuser_table_rowstriggers in placepackages/db/scripts/push.integration.ts19/19check:comment-hygieneChecklist
test-auditauthoring gate)