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
in file rax.c, the comment within function raxRemove claims the following:
* Example of case"1". A tree stores the keys "FOO" = 1and
* "FOOBAR" = 2:
*
*
* "FOO" -> "BAR" -> [] (2)
* (1)
*
* After the removal of "FOO" the tree can be compressed as:
*
* "FOOBAR" -> [] (2)
*
However, the logic associated with variable trycompress didn't take compress node into account.
The two predicates if (h->size == 0) and else if (h->size == 1) don't catch the intermediate compress node obviously.
This demo shows the real scenario:
insertion of key "foo", value 1.
insertion of key "foobar", value 2.
insertion of key "foobarzxc", value 3.
deletion of key "foobarzxc".
deletion of key "foobar".
// after 1/2/3"foo" -> "bar"=0x7ffc7cbdb69c -> "zxc"=0x7ffc7cbdb64c -> []=0x7ffc7cbdb5fc// after 4/5"foo" -> "bar" -> "zxc" -> []=0x7ffc7cbdb5fc
Not "foobarzxc" -> []=0x7ffc7cbdb5fc as expected
Anyway, this only prolongs the recompression and no bug is incurred. @antirez
The text was updated successfully, but these errors were encountered:
in file rax.c, the comment within function
raxRemove
claims the following:However, the logic associated with variable
trycompress
didn't take compress node into account.The two predicates
if (h->size == 0)
andelse if (h->size == 1)
don't catch the intermediate compress node obviously.This demo shows the real scenario:
Not "foobarzxc" -> []=0x7ffc7cbdb5fc as expected
Anyway, this only prolongs the recompression and no bug is incurred. @antirez
The text was updated successfully, but these errors were encountered: