Commit eedc17c
committed
fix(sqs): fail-closed for unresolved txn read keys
Round 5 introduced fail-closed semantics in ShardRouter.ResolveGroup
(recognised-but-unresolved partitioned keys return ok=false instead
of falling through to the engine), but the read-key path inside
ShardedCoordinator was not audited for the new contract.
engineGroupIDForKey discards the resolver's ok flag and returns 0
for any failure. groupReadKeysByShardID then loops `if gid == 0
{ continue }`, silently dropping unrouted read keys from the
prewrite payload. With the new fail-closed resolver, a partitioned
read key whose queue has drifted out of --sqsFifoPartitionMap
(partial rollout / config drift) gets dropped from OCC validation.
The FSM never sees that key in ReadKeys, a concurrent write to the
same key commits without conflict, and SSI is broken.
Codex round-2 P1 on PR #715 caught this — addressed here.
Fix
groupReadKeysByShardID returns (map, error). Any read key that
fails to route surfaces as ErrInvalidRequest, dispatchTxn
propagates the error, and the transaction aborts before prewrite.
Calls c.router.ResolveGroup directly (rather than via
engineGroupIDForKey) so the (gid, ok) signal is preserved through
the boundary.
Tests
- TestGroupReadKeysByShardID_FailsClosedOnUnroutable replaces
TestGroupReadKeysByShardID_SkipsUnroutableKeys (which had been
pinning the buggy skip-silently behaviour). Asserts the new
fail-closed contract: unroutable keys → error, no partial map.
- TestShardedCoordinator_TxnFailsClosedForUnresolvedReadKey is
the coordinator-level regression: a transaction with a
recognised-but-unresolved partitioned read key MUST abort
before any prewrite. Asserts no group received an RPC.
- The three existing TestGroupReadKeysByShardID_* tests are
updated for the new (map, error) signature.1 parent 87561fd commit eedc17c
3 files changed
Lines changed: 139 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
398 | | - | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
399 | 405 | | |
400 | 406 | | |
401 | 407 | | |
| |||
891 | 897 | | |
892 | 898 | | |
893 | 899 | | |
894 | | - | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
895 | 917 | | |
896 | | - | |
| 918 | + | |
897 | 919 | | |
898 | 920 | | |
899 | 921 | | |
900 | | - | |
901 | | - | |
902 | | - | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
903 | 928 | | |
904 | 929 | | |
905 | 930 | | |
906 | | - | |
| 931 | + | |
907 | 932 | | |
908 | 933 | | |
909 | 934 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
198 | 277 | | |
199 | 278 | | |
200 | 279 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
313 | 315 | | |
314 | 316 | | |
315 | 317 | | |
316 | 318 | | |
317 | 319 | | |
318 | 320 | | |
319 | 321 | | |
320 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
321 | 325 | | |
322 | 326 | | |
323 | 327 | | |
| |||
327 | 331 | | |
328 | 332 | | |
329 | 333 | | |
330 | | - | |
| 334 | + | |
331 | 335 | | |
332 | 336 | | |
333 | 337 | | |
334 | 338 | | |
| 339 | + | |
335 | 340 | | |
336 | 341 | | |
337 | 342 | | |
| |||
340 | 345 | | |
341 | 346 | | |
342 | 347 | | |
343 | | - | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
344 | 361 | | |
345 | 362 | | |
346 | 363 | | |
347 | 364 | | |
348 | 365 | | |
349 | 366 | | |
350 | | - | |
| 367 | + | |
351 | 368 | | |
352 | | - | |
| 369 | + | |
353 | 370 | | |
354 | | - | |
355 | | - | |
356 | | - | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
357 | 376 | | |
358 | 377 | | |
359 | 378 | | |
| |||
0 commit comments