+ } else if (type == REDIS_HASH_ZIPMAP ||
+ type == REDIS_LIST_ZIPLIST ||
+ type == REDIS_SET_INTSET ||
+ type == REDIS_ZSET_ZIPLIST)
+ {
+ robj *aux = rdbLoadStringObject(fp);
+
+ if (aux == NULL) return NULL;
+ o = createObject(REDIS_STRING,NULL); /* string is just placeholder */
+ o->ptr = zmalloc(sdslen(aux->ptr));
+ memcpy(o->ptr,aux->ptr,sdslen(aux->ptr));
+ decrRefCount(aux);
+
+ /* Fix the object encoding, and make sure to convert the encoded
+ * data type into the base type if accordingly to the current
+ * configuration there are too many elements in the encoded data
+ * type. Note that we only check the length and not max element
+ * size as this is an O(N) scan. Eventually everything will get
+ * converted. */
+ switch(type) {
+ case REDIS_HASH_ZIPMAP:
+ o->type = REDIS_HASH;
+ o->encoding = REDIS_ENCODING_ZIPMAP;
+ if (zipmapLen(o->ptr) > server.hash_max_zipmap_entries)
+ convertToRealHash(o);
+ break;
+ case REDIS_LIST_ZIPLIST:
+ o->type = REDIS_LIST;
+ o->encoding = REDIS_ENCODING_ZIPLIST;
+ if (ziplistLen(o->ptr) > server.list_max_ziplist_entries)
+ listTypeConvert(o,REDIS_ENCODING_LINKEDLIST);
+ break;
+ case REDIS_SET_INTSET:
+ o->type = REDIS_SET;
+ o->encoding = REDIS_ENCODING_INTSET;
+ if (intsetLen(o->ptr) > server.set_max_intset_entries)
+ setTypeConvert(o,REDIS_ENCODING_HT);
+ break;
+ case REDIS_ZSET_ZIPLIST:
+ o->type = REDIS_ZSET;
+ o->encoding = REDIS_ENCODING_ZIPLIST;
+ if (zsetLength(o) > server.zset_max_ziplist_entries)
+ zsetConvert(o,REDIS_ENCODING_SKIPLIST);
+ break;
+ default:
+ redisPanic("Unknown encoding");
+ break;
+ }