Skip to content

MOD-21454 - making arrappend atomic - #1718

Merged
TalBarYakar merged 3 commits into
masterfrom
tal.ba/feat/arrapend_atomic
Nov 30, 2026
Merged

TalBarYakar merged 3 commits into
masterfrom
tal.ba/feat/arrapend_atomic

Conversation

@TalBarYakar

@TalBarYakar TalBarYakar commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Note

Medium Risk
Changes multi-target write semantics and the Manager arr_append API; 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::InsertArray become Seed::Array { operand_depth }, with shared validate_array_depth. Commands compute max operand depth once and pass it through arr_append (trait + IValue backend) instead of re-checking each operand at append time. Auto-create-off paths also run depth checks in seed_missing_paths before 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.

@TalBarYakar TalBarYakar self-assigned this Nov 29, 2026
@codecov

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.91%. Comparing base (789c17e) to head (d0c3579).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TalBarYakar
TalBarYakar force-pushed the tal.ba/feat/arrapend_atomic branch from ca08cf5 to 1ae251b Compare November 30, 2026 07:27
@TalBarYakar
TalBarYakar force-pushed the tal.ba/feat/arrapend_atomic branch from 1ae251b to d0c3579 Compare November 30, 2026 07:57

@gabsow gabsow left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, but a has already been appended. The command isn't in the AOF, so after DEBUG LOADAOF a is 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_path passes, 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:

  1. The $..y cases 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":[]}}} fits a.y but not b.c.y. On master with auto-create off, that leaves a.y appended.
  2. Two benchmark descriptions are copied from ARRINSERT. json_arrappend_nested_operand.yml says "Insert an object ... into a 16-element array". json_arrappend_auto_create_existing.yml keeps "(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.

@TalBarYakar
TalBarYakar merged commit e92f54e into master Nov 30, 2026
66 checks passed
@TalBarYakar
TalBarYakar deleted the tal.ba/feat/arrapend_atomic branch November 30, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants