-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Open
Description
This bug is about a node should be compressed witch is not.
The following code can create that node.
TEST("limit")
{
quicklist *ql = quicklistNew(2, 1);
quicklistPushHead(ql, "0", 1);
quicklistPushHead(ql, "1", 1);
quicklistPushHead(ql, "2", 1);
quicklistPushHead(ql, "3", 1);
quicklistPushHead(ql, "4", 1);
quicklistPushHead(ql, "5", 1);
assert(ql->len == 3);
assert(ql->head->next->encoding == QUICKLIST_NODE_ENCODING_RAW);
size_t sz = (1 << 12);
unsigned char *s = zmalloc(sz);
randstring(s, sz);
quicklistEntry entry;
quicklistIter *iter = quicklistGetIteratorEntryAtIdx(ql, 2, &entry);
quicklistDelEntry(iter, &entry);
quicklistInsertAfter(iter, &entry, s, sz);
quicklistReleaseIterator(iter);
assert(ql->len == 3);
/* ql->head->next is not compressed */
assert(ql->head->next->encoding == QUICKLIST_NODE_ENCODING_RAW);
/* ql->head->next should be compressed */
__quicklistCompress(ql, ql->head->next);
assert(ql->head->next->encoding == QUICKLIST_NODE_ENCODING_LZF);
zfree(s);
quicklistRelease(ql);
}
This bug is related with the member recompress in struct quicklistNode.
A node will not be compressed if it's not compress small enough. And it will remain uncompressed after insert, because 'recompress' is 0 and will prevent compression。
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels