From 552a6fb39d2683c5ad1e57b73464ffdd9c0719cd Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 28 Feb 2011 19:29:33 +0100 Subject: [PATCH] fix type id for specially encoded data types, for direct blob saving of intsets, ziplists and zipmaps --- src/rdb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rdb.c b/src/rdb.c index 87a9bcd5..b9e5d4d0 100644 --- a/src/rdb.c +++ b/src/rdb.c @@ -463,8 +463,15 @@ int rdbSave(char *filename) { o->storage == REDIS_VM_SWAPPING) { int otype = o->type; + /* Fix the type id for specially encoded data types */ if (otype == REDIS_HASH && o->encoding == REDIS_ENCODING_ZIPMAP) otype = REDIS_HASH_ZIPMAP; + else if (otype == REDIS_LIST && + o->encoding == REDIS_ENCODING_ZIPLIST) + otype = REDIS_LIST_ZIPLIST; + else if (otype == REDIS_SET && + o->encoding == REDIS_ENCODING_INTSET) + otype = REDIS_SET_INTSET; /* Save type, key, value */ if (rdbSaveType(fp,otype) == -1) goto werr; if (rdbSaveStringObject(fp,&key) == -1) goto werr;