diff options
author | FutabaRio <futabario52@gmail.com> | 2022-10-19 20:11:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-19 15:11:28 +0300 |
commit | 6debeb3779fada89c82c1ffad3cf98fa48aa3b5d (patch) | |
tree | 6776c8f1a3b4fa38675c79e1499789066b5b39ac | |
parent | b57fd01064428ab388c9d9038a617a52488a447b (diff) | |
download | redis-6debeb3779fada89c82c1ffad3cf98fa48aa3b5d.tar.gz |
fix the size of variable merge_sz in quicklist.c (#11285)
11 was the size of header/trailer in the old structure Ziplist,
but now the size of header/trailer in the new structure Listpack should be 7.
-rw-r--r-- | src/quicklist.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/quicklist.c b/src/quicklist.c index 69438165b..954331365 100644 --- a/src/quicklist.c +++ b/src/quicklist.c @@ -502,9 +502,9 @@ REDIS_STATIC int _quicklistNodeAllowMerge(const quicklistNode *a, if (unlikely(QL_NODE_IS_PLAIN(a) || QL_NODE_IS_PLAIN(b))) return 0; - /* approximate merged listpack size (- 11 to remove one listpack - * header/trailer) */ - unsigned int merge_sz = a->sz + b->sz - 11; + /* approximate merged listpack size (- 7 to remove one listpack + * header/trailer, see LP_HDR_SIZE and LP_EOF) */ + unsigned int merge_sz = a->sz + b->sz - 7; if (likely(_quicklistNodeSizeMeetsOptimizationRequirement(merge_sz, fill))) return 1; /* when we return 1 above we know that the limit is a size limit (which is |