Commit a5909eb
committed
fix(redis): carve standalone SET behind separate sub-gate (codex P1)
PR #943 round-1 codex P1: flipping onePhaseTxnDedup to default-on
exposed a pre-existing semantic divergence on the standalone SET path.
txnContext.applySet (adapter/redis.go:2356) returns WRONGTYPE when the
target key already holds a list/hash/set/zset/stream, while the legacy
setLegacy → executeSet → replaceWithStringTxn path correctly deletes
the collection's logical elements and writes the string. Real Redis
allows SET to overwrite any prior type unconditionally; the default
flip would have silently broken normal overwrite semantics for any
default-configured server.
This commit narrows the default flip — the standalone SET path now
requires *two* gates to route through runTransactionWithDedup:
onePhaseTxnDedup (the umbrella, default on) AND a new
standaloneSetDedup sub-gate (default off, opt-in via
WithStandaloneSetDedup or ELASTICKV_REDIS_ONEPHASE_DEDUP_SET=1). With
the default config, the standalone SET branch falls through to
setLegacy, preserving legacy overwrite semantics. MULTI/EXEC and
list-push paths — the parent design's actual M4-validated workloads —
keep the dedup default-on win unchanged.
Bringing applySet to parity (collection-deletion + string write inside
the dedup txn buffer) is a larger surgery tracked as a follow-up;
until then the sub-gate stays default-off.
Per the CLAUDE.md "add failing test then fix" convention:
- TestRedis_SET_OverwritesList_UnderDefaultGate (new file
adapter/redis_set_overwrite_default_test.go) seeds RPUSH k x, runs
SET k v under default config, asserts OK + GET returns v.
Fails on the pre-fix build (WRONGTYPE), passes on the fixed build.
- Existing TestStandaloneSetDedup_* tests now set standaloneSetDedup:
true alongside onePhaseTxnDedup: true to keep pinning the dedup-on
routing they were designed to exercise.
Also addresses gemini medium: "[#937]" broken reference-style link in
the design doc replaced with an inline link.
Verified: go vet ./... clean, go build ./... clean,
golangci-lint run ./adapter/... 0 issues,
TestRedis_SET_OverwritesList_UnderDefaultGate + TestStandaloneSetDedup_*
+ Dedup/OnePhase test family all pass.1 parent a6af333 commit a5909eb
4 files changed
Lines changed: 148 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
254 | 268 | | |
255 | 269 | | |
256 | 270 | | |
257 | 271 | | |
258 | 272 | | |
259 | 273 | | |
260 | | - | |
| 274 | + | |
261 | 275 | | |
262 | 276 | | |
263 | 277 | | |
264 | 278 | | |
| 279 | + | |
| 280 | + | |
265 | 281 | | |
266 | 282 | | |
267 | 283 | | |
268 | 284 | | |
269 | 285 | | |
270 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
271 | 299 | | |
272 | 300 | | |
273 | 301 | | |
| |||
506 | 534 | | |
507 | 535 | | |
508 | 536 | | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
513 | 544 | | |
514 | 545 | | |
515 | 546 | | |
| |||
1137 | 1168 | | |
1138 | 1169 | | |
1139 | 1170 | | |
1140 | | - | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
1141 | 1178 | | |
1142 | 1179 | | |
1143 | 1180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
32 | 37 | | |
33 | 38 | | |
34 | 39 | | |
| |||
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
64 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
65 | 75 | | |
66 | 76 | | |
67 | 77 | | |
| |||
99 | 109 | | |
100 | 110 | | |
101 | 111 | | |
102 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
103 | 118 | | |
104 | 119 | | |
105 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
Lines changed: 33 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
| 84 | + | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| |||
110 | 111 | | |
111 | 112 | | |
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 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
113 | 145 | | |
114 | 146 | | |
115 | 147 | | |
| |||
0 commit comments