Commit 128e16c
authored
## Summary
Flips `adapter.RedisServer.onePhaseTxnDedup` from default-off to
default-on, closing the rollout of the option-2 idempotency design
landed by
[`docs/design/2026_05_21_proposed_txn_secondary_idempotency.md`](https://github.com/bootjp/elastickv/blob/main/docs/design/2026_05_21_proposed_txn_secondary_idempotency.md).
No new mechanism — the FSM probe (`dedupProbeOnePhase`), the wire change
(`TxnMeta.PrevCommitTS`, V2-only when non-zero), and every adapter-side
reuse path already ship and are exercised every day by the dedup-mode
Jepsen workflow.
Closes #937.
## Authorization
The parent design's `M4` 7-day criterion
([source](https://github.com/bootjp/elastickv/blob/main/docs/design/2026_05_21_proposed_txn_secondary_idempotency.md#m4--validation))
reads:
> 7 consecutive days without `:duplicate-elements` /
`:G-single-item-realtime` in the dedup-mode workflow.
[`jepsen-test-scheduled-dedup.yml`](https://github.com/bootjp/elastickv/blob/main/.github/workflows/jepsen-test-scheduled-dedup.yml)
(Redis stress profile, `ELASTICKV_REDIS_ONEPHASE_DEDUP=1`) has produced
**12 consecutive green runs over 10 calendar days, 2026-05-31 →
2026-06-10**. Run IDs are listed in the new design doc; the most recent
are:
| Date (UTC) | Run | Conclusion |
|---|---|---|
| 2026-06-10 04:50 |
[27253991270](https://github.com/bootjp/elastickv/actions/runs/27253991270)
| success |
| 2026-06-09 04:44 |
[27184402445](https://github.com/bootjp/elastickv/actions/runs/27184402445)
| success |
| 2026-06-08 04:57 |
[27116904871](https://github.com/bootjp/elastickv/actions/runs/27116904871)
| success |
| 2026-06-07 04:54 |
[27083142341](https://github.com/bootjp/elastickv/actions/runs/27083142341)
| success |
| 2026-06-06 04:40 |
[27052820868](https://github.com/bootjp/elastickv/actions/runs/27052820868)
| success |
| 2026-06-05 04:49 |
[26996058409](https://github.com/bootjp/elastickv/actions/runs/26996058409)
| success |
| 2026-06-04 04:57 |
[26931749014](https://github.com/bootjp/elastickv/actions/runs/26931749014)
| success |
| 2026-06-04 04:16 |
[26930308744](https://github.com/bootjp/elastickv/actions/runs/26930308744)
| success |
| 2026-06-03 04:58 |
[26864667493](https://github.com/bootjp/elastickv/actions/runs/26864667493)
| success |
| ...(2 more) | | success |
Exceeds the 7-day threshold. The parent's R5 (FSM determinism across a
rolling upgrade) is discharged — the probe code has shipped on every
production node for months.
## Change
| File | Change |
|---|---|
| `docs/design/2026_06_10_proposed_redis_onephase_dedup_default_on.md` |
New design doc (commit 1) recording M4 evidence and the rollout. |
| `adapter/redis.go` | Flips env-var sense from `== "1"` to `!= "0"`;
updates the comment, godoc, and field comment. |
| `.github/workflows/jepsen-test-scheduled.yml` | Adds explicit
`ELASTICKV_REDIS_ONEPHASE_DEDUP: "0"` to the job env so the control
baseline keeps its meaning across the default change. Retirement of the
control workflow is a 30-day follow-up. |
## Behaviour change
- **Default**: dedup gate is now **on** for any process that does not
opt out.
- **Opt-out**: `ELASTICKV_REDIS_ONEPHASE_DEDUP=0` (single-env-var
rollback, no binary revert). The constructor option
`WithOnePhaseTxnDedup(false)` still trumps the env.
- **Existing opt-in users**: `=1` (the dedup-mode workflow's existing
setting) continues to resolve to `true`. No breakage.
## Risk
| Concern | Disposition |
|---|---|
| Data loss | None — the dedup path only short-circuits on a confirmed
prior commit at the exact `prev_commit_ts` (the parent design's R1 + the
existing `kv/fsm.go` probe). No write is dropped. |
| Concurrency / distributed failures | None — every node already runs
the probe code; no new fanout, no new round-trip. R5 discharged as
above. |
| Performance | Default-on adds the `PrevCommitTS` probe on each
retryable attempt. Cost is one `CommittedVersionAt` MVCC lookup at the
primary key + stale `commit_ts`; this is the same cost the dedup-mode
workflow has been paying for 12 days without regression. No hot-path
allocation change. |
| Data consistency | Improved — the failure modes the parent design
predicted (`:duplicate-elements`, `:future-read`,
`:G-single-item-realtime`) become unreachable on the protected path.
Issue #937 is the most recent control-baseline reproduction. |
| Test coverage | No new branches added; existing
`adapter/redis_*_dedup_test.go` suites cover both gate states. Tests
that construct `&RedisServer{...}` directly (zero-value
`onePhaseTxnDedup`) still observe the legacy path, so the off-path
remains covered at unit level. |
## Verification
- `go vet ./...` — clean
- `go build ./...` — clean
- `go test -run 'Dedup|OnePhase|PrevCommit|Idempot' ./adapter/` — pass
(1.2s)
- `go test -run
'TestRedis|TestList|TestSet|TestZSet|TestStream|TestExec|TestMulti'
./adapter/` — pass (169s)
- `golangci-lint run ./adapter/...` — 0 issues
## Follow-ups
- **30 days post-merge** — review whether `jepsen-test-scheduled.yml`
(now explicit dedup-off) still adds signal. If not, retire it.
- **DynamoDB default-on** — parallel work tracked by
[`2026_06_03_partial_dynamodb_onephase_dedup.md`](https://github.com/bootjp/elastickv/blob/main/docs/design/2026_06_03_partial_dynamodb_onephase_dedup.md)'s
`M2`. Not part of this PR.
- **S3, SQS dedup paths** — not yet routed through one-phase reuse; out
of scope for the parent design.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Documentation**
* Added a design doc describing a planned default-on change for Redis
transaction dedup and rollout/verification plans.
* **Chores**
* Flipped adapter default behavior so transaction dedup is enabled by
default, with an environment opt-out preserved.
* Introduced a separate opt-in gate for standalone SET dedup to avoid
unintended behavior changes.
* **Tests**
* Updated standalone SET tests and added a regression test to verify
overwrite semantics remain correct under current defaults.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
5 files changed
Lines changed: 395 additions & 21 deletions
File tree
- .github/workflows
- adapter
- docs/design
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
42 | 55 | | |
43 | 56 | | |
44 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
251 | 252 | | |
252 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
253 | 268 | | |
254 | 269 | | |
255 | 270 | | |
256 | 271 | | |
257 | 272 | | |
258 | | - | |
259 | | - | |
260 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
261 | 281 | | |
262 | 282 | | |
263 | 283 | | |
264 | 284 | | |
265 | 285 | | |
266 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
267 | 299 | | |
268 | 300 | | |
269 | 301 | | |
| |||
495 | 527 | | |
496 | 528 | | |
497 | 529 | | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
507 | 544 | | |
508 | 545 | | |
509 | 546 | | |
| |||
1131 | 1168 | | |
1132 | 1169 | | |
1133 | 1170 | | |
1134 | | - | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
1135 | 1178 | | |
1136 | 1179 | | |
1137 | 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 | + | |
0 commit comments