1
0
mirror of https://github.com/fluencelabs/redis synced 2025-03-18 00:20:50 +00:00

List type AOF rewrite using variadic RPUSH for the linked list encoding.

This commit is contained in:
antirez 2011-12-07 11:34:25 +01:00
parent 5b25009656
commit 38c06fa037

@ -460,10 +460,16 @@ int rewriteListObject(rio *r, robj *key, robj *o) {
while((ln = listNext(&li))) { while((ln = listNext(&li))) {
robj *eleobj = listNodeValue(ln); robj *eleobj = listNodeValue(ln);
if (rioWriteBulkCount(r,'*',3) == 0) return 0; if (count == 0) {
if (rioWriteBulkString(r,"RPUSH",5) == 0) return 0; int cmd_items = (items > REDIS_AOFREWRITE_ITEMS_PER_CMD) ?
if (rioWriteBulkObject(r,key) == 0) return 0; REDIS_AOFREWRITE_ITEMS_PER_CMD : items;
if (rioWriteBulkCount(r,'*',2+cmd_items) == 0) return 0;
if (rioWriteBulkString(r,"RPUSH",5) == 0) return 0;
if (rioWriteBulkObject(r,key) == 0) return 0;
}
if (rioWriteBulkObject(r,eleobj) == 0) return 0; if (rioWriteBulkObject(r,eleobj) == 0) return 0;
if (++count == REDIS_AOFREWRITE_ITEMS_PER_CMD) count = 0;
items--;
} }
} else { } else {
redisPanic("Unknown list encoding"); redisPanic("Unknown list encoding");