summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBinbin <binloveplay1314@qq.com>2022-05-22 17:27:54 +0800
committerGitHub <noreply@github.com>2022-05-22 12:27:54 +0300
commit18cb4a7d938d01981e9f6c565532a2056ceb269b (patch)
tree3ef3ef222afc4106b14ec235ed71ad2d36d1c82f
parent4a7a4e42db8ff757cdf3f4a824f66426036034ef (diff)
downloadredis-18cb4a7d938d01981e9f6c565532a2056ceb269b.tar.gz
Remove ziplist dead code in object.c (#10751)
Remove some dead code in object.c, ziplist is no longer used in 7.0 Some backgrounds: zipmap - hash: replaced by ziplist in #285 ziplist - hash: replaced by listpack in #8887 ziplist - zset: replaced by listpack in #9366 ziplist - list: replaced by quicklist (listpack) in #2143 / #9740 Moved the location of ziplist.h in the server.c
-rw-r--r--src/object.c3
-rw-r--r--src/server.h6
2 files changed, 3 insertions, 6 deletions
diff --git a/src/object.c b/src/object.c
index 093e2619e..84a9e3afc 100644
--- a/src/object.c
+++ b/src/object.c
@@ -930,7 +930,6 @@ char *strEncoding(int encoding) {
case OBJ_ENCODING_INT: return "int";
case OBJ_ENCODING_HT: return "hashtable";
case OBJ_ENCODING_QUICKLIST: return "quicklist";
- case OBJ_ENCODING_ZIPLIST: return "ziplist";
case OBJ_ENCODING_LISTPACK: return "listpack";
case OBJ_ENCODING_INTSET: return "intset";
case OBJ_ENCODING_SKIPLIST: return "skiplist";
@@ -998,8 +997,6 @@ size_t objectComputeSize(robj *key, robj *o, size_t sample_size, int dbid) {
samples++;
} while ((node = node->next) && samples < sample_size);
asize += (double)elesize/samples*ql->len;
- } else if (o->encoding == OBJ_ENCODING_ZIPLIST) {
- asize = sizeof(*o)+zmalloc_size(o->ptr);
} else {
serverPanic("Unknown list encoding");
}
diff --git a/src/server.h b/src/server.h
index 446ba5ab1..19467123c 100644
--- a/src/server.h
+++ b/src/server.h
@@ -70,7 +70,6 @@ typedef long long ustime_t; /* microsecond time type. */
#include "adlist.h" /* Linked lists */
#include "zmalloc.h" /* total memory usage aware version of malloc/free */
#include "anet.h" /* Networking the easy way */
-#include "ziplist.h" /* Compact list data structure */
#include "intset.h" /* Compact integer set structure */
#include "version.h" /* Version macro */
#include "util.h" /* Misc functions useful in many places */
@@ -86,6 +85,7 @@ typedef long long ustime_t; /* microsecond time type. */
/* Following includes allow test functions to be called from Redis main() */
#include "zipmap.h"
+#include "ziplist.h" /* Compact list data structure */
#include "sha1.h"
#include "endianconv.h"
#include "crc64.h"
@@ -828,9 +828,9 @@ typedef struct RedisModuleDigest {
#define OBJ_ENCODING_RAW 0 /* Raw representation */
#define OBJ_ENCODING_INT 1 /* Encoded as integer */
#define OBJ_ENCODING_HT 2 /* Encoded as hash table */
-#define OBJ_ENCODING_ZIPMAP 3 /* Encoded as zipmap */
+#define OBJ_ENCODING_ZIPMAP 3 /* No longer used: old hash encoding. */
#define OBJ_ENCODING_LINKEDLIST 4 /* No longer used: old list encoding. */
-#define OBJ_ENCODING_ZIPLIST 5 /* Encoded as ziplist */
+#define OBJ_ENCODING_ZIPLIST 5 /* No longer used: old list/hash/zset encoding. */
#define OBJ_ENCODING_INTSET 6 /* Encoded as intset */
#define OBJ_ENCODING_SKIPLIST 7 /* Encoded as skiplist */
#define OBJ_ENCODING_EMBSTR 8 /* Embedded sds string encoding */