Repository navigation
Commit 50aeeb8
committed
feat(driver-turso): the remote face issues auto_number values from the shared persistent sequence
Disposition A of the remote-autonumber question, executed: a create,
bulkCreate or upsert on the Turso REMOTE transport that leaves an
auto_number slot empty now gets a generated value, atomically in the
database, from the same `_objectstack_sequences` counter the local and
embedded-replica faces draw from.
- sql-driver: the rules a second face must share are lifted into protected
members (`resolveSequenceTenantId`, `defineSequencesTable`,
`maxAutonumberCounter`, `escapeLikePrefix`, the table name and retry
budget). No behaviour change on the local faces.
- turso-driver: `getNextSequenceValue` routes by transport; the remote face
moves the counter in one statement (`UPDATE … RETURNING`, cold path
`INSERT … ON CONFLICT DO UPDATE … RETURNING`), bootstraps from the data
table by the shared reading, and carries the #5495 re-seed. A legacy
(pre-key_hash) table is refused loudly, not keyed by a second rule.
- remote-transport: `upsert` takes insert-only columns so a merge keeps the
number already in the row.
- The refusal suite is converted to the generation suite; the two resync
boundary pins are rewritten to pin generation; a cross-process pin runs
two writers in two processes against one database file.
Claude-Session: https://claude.ai/code/session_01Ujdtvqs7ree7WyQmEDwEnG
Co-authored-by: Claude <noreply@anthropic.com>1 parent 9939854 commit 50aeeb8
12 files changed
Lines changed: 1478 additions & 833 deletions
File tree
- packages/drivers
- driver-sql/src
- driver-turso
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7593 | 7593 | | |
7594 | 7594 | | |
7595 | 7595 | | |
| 7596 | + | |
| 7597 | + | |
| 7598 | + | |
| 7599 | + | |
| 7600 | + | |
| 7601 | + | |
| 7602 | + | |
| 7603 | + | |
| 7604 | + | |
| 7605 | + | |
| 7606 | + | |
| 7607 | + | |
| 7608 | + | |
| 7609 | + | |
| 7610 | + | |
| 7611 | + | |
| 7612 | + | |
| 7613 | + | |
| 7614 | + | |
| 7615 | + | |
| 7616 | + | |
| 7617 | + | |
| 7618 | + | |
| 7619 | + | |
| 7620 | + | |
| 7621 | + | |
| 7622 | + | |
| 7623 | + | |
| 7624 | + | |
| 7625 | + | |
| 7626 | + | |
| 7627 | + | |
| 7628 | + | |
| 7629 | + | |
| 7630 | + | |
| 7631 | + | |
| 7632 | + | |
| 7633 | + | |
| 7634 | + | |
| 7635 | + | |
| 7636 | + | |
| 7637 | + | |
| 7638 | + | |
| 7639 | + | |
| 7640 | + | |
| 7641 | + | |
| 7642 | + | |
| 7643 | + | |
| 7644 | + | |
| 7645 | + | |
7596 | 7646 | | |
7597 | 7647 | | |
7598 | 7648 | | |
| |||
7602 | 7652 | | |
7603 | 7653 | | |
7604 | 7654 | | |
7605 | | - | |
7606 | | - | |
7607 | | - | |
7608 | | - | |
7609 | | - | |
7610 | | - | |
7611 | | - | |
7612 | | - | |
7613 | | - | |
7614 | | - | |
7615 | | - | |
| 7655 | + | |
7616 | 7656 | | |
7617 | 7657 | | |
7618 | 7658 | | |
| |||
7743 | 7783 | | |
7744 | 7784 | | |
7745 | 7785 | | |
7746 | | - | |
7747 | | - | |
| 7786 | + | |
7748 | 7787 | | |
7749 | 7788 | | |
7750 | 7789 | | |
7751 | 7790 | | |
| 7791 | + | |
| 7792 | + | |
| 7793 | + | |
| 7794 | + | |
| 7795 | + | |
| 7796 | + | |
| 7797 | + | |
| 7798 | + | |
| 7799 | + | |
| 7800 | + | |
| 7801 | + | |
| 7802 | + | |
| 7803 | + | |
| 7804 | + | |
| 7805 | + | |
| 7806 | + | |
| 7807 | + | |
| 7808 | + | |
| 7809 | + | |
| 7810 | + | |
7752 | 7811 | | |
7753 | 7812 | | |
7754 | | - | |
7755 | | - | |
| 7813 | + | |
7756 | 7814 | | |
7757 | 7815 | | |
7758 | 7816 | | |
| |||
7893 | 7951 | | |
7894 | 7952 | | |
7895 | 7953 | | |
7896 | | - | |
| 7954 | + | |
7897 | 7955 | | |
7898 | 7956 | | |
7899 | 7957 | | |
| |||
8153 | 8211 | | |
8154 | 8212 | | |
8155 | 8213 | | |
8156 | | - | |
8157 | | - | |
| 8214 | + | |
8158 | 8215 | | |
8159 | 8216 | | |
8160 | 8217 | | |
| |||
8188 | 8245 | | |
8189 | 8246 | | |
8190 | 8247 | | |
8191 | | - | |
8192 | | - | |
| 8248 | + | |
8193 | 8249 | | |
8194 | 8250 | | |
8195 | 8251 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1595 | 1595 | | |
1596 | 1596 | | |
1597 | 1597 | | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
1598 | 1607 | | |
1599 | 1608 | | |
1600 | 1609 | | |
1601 | 1610 | | |
1602 | 1611 | | |
| 1612 | + | |
1603 | 1613 | | |
1604 | 1614 | | |
1605 | 1615 | | |
| |||
1618 | 1628 | | |
1619 | 1629 | | |
1620 | 1630 | | |
1621 | | - | |
| 1631 | + | |
1622 | 1632 | | |
1623 | 1633 | | |
1624 | 1634 | | |
| |||
Lines changed: 49 additions & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
25 | 26 | | |
26 | | - | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | | - | |
34 | | - | |
35 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
36 | 41 | | |
37 | 42 | | |
38 | 43 | | |
39 | 44 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
45 | 49 | | |
46 | 50 | | |
47 | 51 | | |
| |||
131 | 135 | | |
132 | 136 | | |
133 | 137 | | |
134 | | - | |
| 138 | + | |
135 | 139 | | |
136 | 140 | | |
137 | 141 | | |
138 | 142 | | |
139 | 143 | | |
140 | | - | |
141 | | - | |
142 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
143 | 148 | | |
144 | 149 | | |
145 | 150 | | |
146 | 151 | | |
147 | 152 | | |
148 | 153 | | |
149 | 154 | | |
150 | | - | |
| 155 | + | |
| 156 | + | |
151 | 157 | | |
152 | 158 | | |
153 | | - | |
| 159 | + | |
154 | 160 | | |
155 | 161 | | |
156 | 162 | | |
| |||
164 | 170 | | |
165 | 171 | | |
166 | 172 | | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
181 | 194 | | |
182 | 195 | | |
183 | 196 | | |
| |||
0 commit comments