Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
fix type id for specially encoded data types, for direct blob saving …
Browse files Browse the repository at this point in the history
…of intsets, ziplists and zipmaps
  • Loading branch information
antirez committed Apr 20, 2011
1 parent 5045ff8 commit 552a6fb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 552a6fb

Please sign in to comment.