From 6debeb3779fada89c82c1ffad3cf98fa48aa3b5d Mon Sep 17 00:00:00 2001 From: FutabaRio Date: Wed, 19 Oct 2022 20:11:28 +0800 Subject: [PATCH] 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. --- src/quicklist.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/quicklist.c b/src/quicklist.c index 69438165b2..9543313652 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