Repository navigation
MOD-21454 - making arrappend atomic - #1718
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1718 +/- ##
==========================================
+ Coverage 87.89% 87.91% +0.01%
==========================================
Files 18 18
Lines 6756 6758 +2
==========================================
+ Hits 5938 5941 +3
+ Misses 818 817 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ca08cf5 to
1ae251b
Compare
1ae251b to
d0c3579
Compare
gabsow
left a comment
There was a problem hiding this comment.
Approving at d0c3579. It's 1ae251b rebased onto master with the same three commits, and the new master commit only touches tests/benchmarks/compare_local.py.
I built 1ae251b and its merge base with master (ff23290) on an Apple silicon Mac. I ran the PR's cases through redis-cli with auto-create off and on, because I don't have RLTest set up here:
- On master,
JSON.ARRAPPEND k '$..*' 1 <125-deep array>on{"a":[],"b":{"c":[]}}returns the recursion error, butahas already been appended. The command isn't in the AOF, so afterDEBUG LOADAOFais empty again. With this PR the document is unchanged, and the AOF agrees. $..*and..*behave the same in both modes, whether the deep operand is alone, first or last.- Every other probe gives the same reply on both builds. That covers the 124-deep boundary, duplicate targets, a target inside another target, typed arrays, auto-creating a missing path, legacy root paths, wrong-type and missing paths, and ARRINSERT at index 0 and 1.
cargo test -p redis_json -p json_pathpasses, 453 tests.
The depth arithmetic doesn't change. arr_append received the path length as depth, and the new up-front check uses the same path.len() + 1 + operand_depth >= MAX_DEPTH.
Non-blocking:
- The
$..ycases pass on master too.- With a 125-deep operand,
a.y(path length 2) is already over the limit. So the first target fails before anything is appended. - Only the
$..*and..*cases fail without the fix, in both new test functions. - A 124-deep operand on
{"a":{"y":[]},"b":{"c":{"y":[]}}}fitsa.ybut notb.c.y. On master with auto-create off, that leavesa.yappended.
- With a 125-deep operand,
- Two benchmark descriptions are copied from ARRINSERT.
json_arrappend_nested_operand.ymlsays "Insert an object ... into a 16-element array".json_arrappend_auto_create_existing.ymlkeeps "(MOD-9116 regression)", which was the ARRINSERT duplicate-path bug. The README section also comes after "Legacy absolute KPI floors" instead of next to "ARRINSERT regression workloads".
CI: the rebase restarted it, and most jobs were still running when I posted.
Note
Medium Risk
Changes multi-target write semantics and the Manager
arr_appendAPI; mistakes could allow partial updates or reject valid appends, but behavior is heavily tested.Overview
JSON.ARRAPPEND now validates recursion depth for every matched target before appending, so a depth error on one path cannot leave other arrays partially updated. This aligns ARRAPPEND with the existing ARRINSERT auto-create behavior.
Array seed types are unified:
Seed::EmptyArray/Seed::InsertArraybecomeSeed::Array { operand_depth }, with sharedvalidate_array_depth. Commands compute max operand depth once and pass it througharr_append(trait + IValue backend) instead of re-checking each operand at append time. Auto-create-off paths also run depth checks inseed_missing_pathsbefore returning targets.Coverage adds pytest cases for atomic depth failures (with/without auto-create, replica/AOF) and three ARRAPPEND benchmark workloads.
Reviewed by Cursor Bugbot for commit d0c3579. Bugbot is set up for automated code reviews on this repo. Configure here.