Commit 669d8e7
committed
sqlite: audit savepoint boundaries — no over-report on ROLLBACK TO
The committed-audit stream over-reported when SQL rolled back to a
savepoint inside an open transaction (`BEGIN; SAVEPOINT s; INSERT…;
ROLLBACK TO s; COMMIT;`): SQLite fires no rollback hook for `ROLLBACK TO`,
so rows written after the savepoint stayed pending and were promoted to
the committed stream on the outer COMMIT — recording an insert that never
landed.
EngineContext now tracks open savepoints as (name, pending-count) markers,
driven by the SQLITE_SAVEPOINT authorizer events (arg1 = BEGIN/RELEASE/
ROLLBACK, arg2 = name; verified against the amalgamation). Because the
authorizer fires at prepare time and runScript prepares+steps one
statement at a time, by the time `ROLLBACK TO s` is prepared the
intervening rows are already pending, so the marker trims them precisely.
RELEASE merges into the parent; commit()/rollback()/discardPending() clear
the stack.
Tests: a rolled-back-savepoint insert is absent from the committed stream
(and the row doesn't land); a RELEASEd-then-committed insert is present.1 parent 0f42881 commit 669d8e7
3 files changed
Lines changed: 82 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | | - | |
324 | 323 | | |
325 | 324 | | |
326 | 325 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| |||
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
45 | 58 | | |
46 | 59 | | |
47 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
48 | 84 | | |
49 | 85 | | |
50 | 86 | | |
| |||
189 | 225 | | |
190 | 226 | | |
191 | 227 | | |
| 228 | + | |
192 | 229 | | |
193 | 230 | | |
194 | 231 | | |
195 | 232 | | |
196 | 233 | | |
197 | 234 | | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
203 | 239 | | |
204 | 240 | | |
| 241 | + | |
205 | 242 | | |
206 | 243 | | |
207 | 244 | | |
| |||
229 | 266 | | |
230 | 267 | | |
231 | 268 | | |
| 269 | + | |
232 | 270 | | |
233 | 271 | | |
234 | 272 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
98 | 137 | | |
0 commit comments