You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The json.arrinsert is not atomic. As shown below, I used json.arrinsert to insert a number at position 1 in the JSON array. The insertion was successful for match groups 1 and 2, but it failed for match groups 3 and 4. I believe it is a bug.
I found this issue while using the Docker image redis/redis-stack:latest.
127.0.0.1:6379> json.set op $ '{"x":{"y":[1]},"p":{"y":[100,12]},"t":{"y":[]},"bb":{"y":[786]}}'
OK
127.0.0.1:6379> json.arrinsert op $..y 1 99
(error) ERR index out of bounds
127.0.0.1:6379> json.get op
"{\"x\":{\"y\":[1,99]},\"p\":{\"y\":[100,99,12]},\"t\":{\"y\":[]},\"bb\":{\"y\":[786]}}"
There are two valid scenarios in terms of logic:
If any of the match groups are incorrect, all insert operations will fail.
In my example, the correct return should be: "{\"x\":{\"y\":[1]},\"p\":{\"y\":[100,12]},\"t\":{\"y\":[]},\"bb\":{\"y\":[786]}}"
An incorrect match group should not affect the subsequent match groups.
In my example, the correct return should be: "{\"x\":{\"y\":[1,99]},\"p\":{\"y\":[100,99,12]},\"t\":{\"y\":[]},\"bb\":{\"y\":[786,99]}}"
Which logic is the one we like?
The text was updated successfully, but these errors were encountered:
jihuayu
changed the title
json.arrinsert is not atomicjson.arrinsert is not atomic
Nov 3, 2023
The
json.arrinsert
is not atomic. As shown below, I usedjson.arrinsert
to insert a number at position 1 in the JSON array. The insertion was successful for match groups 1 and 2, but it failed for match groups 3 and 4. I believe it is a bug.I found this issue while using the Docker image
redis/redis-stack:latest
.There are two valid scenarios in terms of logic:
In my example, the correct return should be:
"{\"x\":{\"y\":[1]},\"p\":{\"y\":[100,12]},\"t\":{\"y\":[]},\"bb\":{\"y\":[786]}}"
In my example, the correct return should be:
"{\"x\":{\"y\":[1,99]},\"p\":{\"y\":[100,99,12]},\"t\":{\"y\":[]},\"bb\":{\"y\":[786,99]}}"
Which logic is the one we like?
The text was updated successfully, but these errors were encountered: