Commit fc35ee5
committed
adapter/sqs: align peek partition iteration with effectivePartitionCount
Three r3 findings on PR #794:
1. Codex P2 (sqs_admin_peek.go:268). peekStartPartition and
walkPeek's partition advance / termination keyed off
meta.PartitionCount directly. In perQueue throughput mode
(FifoThroughputLimit=perQueue) the data plane collapses every
MessageGroupId to partition 0 (see effectivePartitionCount in
sqs_keys_dispatch.go); peek still rotated over all N partitions,
wasting up to N-1 guaranteed-empty ScanAt calls per peek (31
extra scans at PartitionCount=32). Switch to
effectivePartitionCount(meta) in peekStartPartition, walkPeek's
partition advance, and preparePeekCursor's bounds check.
Caller audit: effectivePartitionCount is the same helper
receiveMessage uses for its fanout loop (sqs_messages.go:885),
so peek and receive now agree on partition usage.
2. CodeRabbit minor (test order-coupling). HappyPath asserted row
ordering matched send order, but vis-index entries with the same
visible_at millisecond tie-break on message_id (random hex) — a
timing-sensitive flake. Replace ordered loop with set-based
assertion via assertPeekRowsAsSet.
3. CodeRabbit minor (counter type assertion panic). The fanout
counter test used `counter, _ := v.(*atomic.Uint32)` then
counter.Load(), which panics if the assertion fails. Extract
loadFanoutCounter helper that fails the test explicitly on bad
type / nil rather than panicking.
Tests: TestAdminPeekQueue_PerQueueFIFOCollapsesToOnePartition pins
the perQueue functional contract end-to-end.
TestPreparePeekCursor_PerQueueCollapse pins the cursor codec's
effective-bounds validation (a Partition=2 cursor against a
perQueue PartitionCount=4 queue is rejected — even though the raw
PartitionCount would otherwise allow it).1 parent 3e6841e commit fc35ee5
2 files changed
Lines changed: 157 additions & 54 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
| 265 | + | |
266 | 266 | | |
267 | 267 | | |
268 | | - | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
269 | 273 | | |
270 | 274 | | |
271 | 275 | | |
272 | 276 | | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
277 | 282 | | |
278 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
279 | 293 | | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
288 | 302 | | |
289 | 303 | | |
290 | | - | |
291 | | - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
292 | 307 | | |
| 308 | + | |
293 | 309 | | |
294 | 310 | | |
295 | 311 | | |
296 | 312 | | |
297 | 313 | | |
298 | | - | |
| 314 | + | |
299 | 315 | | |
300 | 316 | | |
301 | 317 | | |
| |||
305 | 321 | | |
306 | 322 | | |
307 | 323 | | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
| 324 | + | |
317 | 325 | | |
318 | 326 | | |
319 | | - | |
| 327 | + | |
320 | 328 | | |
321 | 329 | | |
322 | 330 | | |
| |||
350 | 358 | | |
351 | 359 | | |
352 | 360 | | |
353 | | - | |
354 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
355 | 367 | | |
356 | 368 | | |
357 | | - | |
| 369 | + | |
358 | 370 | | |
359 | 371 | | |
360 | 372 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
| 49 | + | |
| 50 | + | |
52 | 51 | | |
53 | 52 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
60 | 60 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
67 | 73 | | |
68 | | - | |
69 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
70 | 78 | | |
71 | | - | |
72 | | - | |
| 79 | + | |
| 80 | + | |
73 | 81 | | |
74 | 82 | | |
75 | 83 | | |
| |||
826 | 834 | | |
827 | 835 | | |
828 | 836 | | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
829 | 855 | | |
830 | 856 | | |
831 | 857 | | |
| |||
863 | 889 | | |
864 | 890 | | |
865 | 891 | | |
866 | | - | |
867 | | - | |
868 | | - | |
869 | | - | |
870 | | - | |
| 892 | + | |
871 | 893 | | |
872 | 894 | | |
873 | 895 | | |
| |||
887 | 909 | | |
888 | 910 | | |
889 | 911 | | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
890 | 981 | | |
891 | 982 | | |
892 | 983 | | |
| |||
0 commit comments