Skip to content

Commit 14d96f8

Browse files
committed
remove keyinfo information
1 parent 004a6ea commit 14d96f8

File tree

3 files changed

+4
-55
lines changed

3 files changed

+4
-55
lines changed

src/server.c

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -886,18 +886,7 @@ void trackInstantaneousMetric(int metric, long long current_value, long long cur
886886
server.inst_metric[metric].last_sample_value = current_value;
887887
}
888888

889-
size_t getStringValueMemoryUsage(robj *obj) {
890-
size_t asize = 0;
891-
if (obj->encoding == OBJ_ENCODING_INT) {
892-
asize = sizeof(*obj);
893-
} else if (obj->encoding == OBJ_ENCODING_RAW) {
894-
asize = sdsAllocSize(obj->ptr) + sizeof(*obj);
895-
} else if (obj->encoding == OBJ_ENCODING_EMBSTR) {
896-
asize = zmalloc_size((void *)obj);
897-
}
898-
return asize;
899-
}
900-
889+
/*
901890
void displayUpdate(int pre_value, int current_value) {
902891
serverLog(LL_WARNING, "This is for testing, previous item number is %d, and current item number is %d", pre_value,
903892
current_value);
@@ -909,6 +898,7 @@ void displayDataTypeArray(keysizeInfo *keysize_array, int length) {
909898
serverLog(LL_WARNING, "Item %lld and value is %lld", keysize_array[i].element_size, keysize_array[i].num);
910899
}
911900
}
901+
*/
912902

913903
void updateKeySizeArray(serverDb *db, robj *dstkey) {
914904
robj *t_obj = lookupKeyWrite(db, dstkey);
@@ -2856,20 +2846,6 @@ serverDb *createDatabase(int id) {
28562846
db->ready_keys = dictCreate(&objectKeyPointerValueDictType);
28572847
db->watched_keys = dictCreate(&keylistDictType);
28582848
db->id = id;
2859-
db->list_array_length = KEYSIZE_ARRAY_SIZE;
2860-
db->set_array_length = KEYSIZE_ARRAY_SIZE;
2861-
db->hash_array_length = KEYSIZE_ARRAY_SIZE;
2862-
db->zset_array_length = KEYSIZE_ARRAY_SIZE;
2863-
db->string_array_length = KEYSIZE_ARRAY_SIZE;
2864-
long long i = 1;
2865-
for (int count = 0; count < KEYSIZE_ARRAY_SIZE; count++) {
2866-
db->list_array[count].element_size = i;
2867-
db->set_array[count].element_size = i;
2868-
db->hash_array[count].element_size = i;
2869-
db->zset_array[count].element_size = i;
2870-
db->string_array[count].element_size = i;
2871-
i *= 2;
2872-
}
28732849
resetDbExpiryState(db);
28742850
return db;
28752851
}

src/server.h

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -411,10 +411,6 @@ typedef struct bigkeyEntry {
411411
robj *key;
412412
} bigkeyEntry;
413413

414-
/* Type of keyinfo */
415-
typedef enum { KEYINFO_TYPE_MANY_ELEMENTS = 0,
416-
KEYINFO_TYPE_NUM } keyinfo_type;
417-
418414
/* Replica replication state. Used in server.repl_state for replicas to remember
419415
* what to do next. */
420416
typedef enum {
@@ -876,12 +872,6 @@ typedef struct replBufBlock {
876872
char buf[];
877873
} replBufBlock;
878874

879-
typedef struct keysizeInfo {
880-
long long element_size;
881-
long long num;
882-
} keysizeInfo;
883-
884-
#define KEYSIZE_ARRAY_SIZE 32
885875

886876
/* Database representation. There are multiple databases identified
887877
* by integers from 0 (the default database) up to the max configured
@@ -901,21 +891,6 @@ typedef struct serverDb {
901891
long long avg_ttl; /* Average TTL, just for stats */
902892
unsigned long cursor; /* Cursor of the active expire cycle. */
903893
} expiry[ACTIVE_EXPIRY_TYPE_COUNT];
904-
keysizeInfo list_array[KEYSIZE_ARRAY_SIZE];
905-
int list_array_length;
906-
unsigned long long list_number_of_keys;
907-
keysizeInfo set_array[KEYSIZE_ARRAY_SIZE];
908-
int set_array_length;
909-
unsigned long long set_number_of_keys;
910-
keysizeInfo hash_array[KEYSIZE_ARRAY_SIZE];
911-
int hash_array_length;
912-
unsigned long long hash_number_of_keys;
913-
keysizeInfo zset_array[KEYSIZE_ARRAY_SIZE];
914-
int zset_array_length;
915-
unsigned long long zset_number_of_keys;
916-
keysizeInfo string_array[KEYSIZE_ARRAY_SIZE];
917-
int string_array_length;
918-
unsigned long long string_number_of_keys;
919894
} serverDb;
920895

921896
/* forward declaration for functions ctx */
@@ -3051,9 +3026,8 @@ void freeSetObject(robj *o);
30513026
void freeZsetObject(robj *o);
30523027
void freeHashObject(robj *o);
30533028
void dismissObject(robj *o, size_t dump_size);
3054-
size_t getStringValueMemoryUsage(robj *obj);
3055-
void displayUpdate(int pre_value, int current_value);
3056-
void displayDataTypeArray(keysizeInfo *keysize_array, int length);
3029+
//void displayUpdate(int pre_value, int current_value);
3030+
//void displayDataTypeArray(keysizeInfo *keysize_array, int length);
30573031
void updateKeySizeArray(serverDb *db, robj *key);
30583032
robj *createObject(int type, void *ptr);
30593033
void initObjectLRUOrLFU(robj *o);

src/t_list.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,6 @@ void pushGenericCommand(client *c, int where, int xx) {
475475
lobj = createListListpackObject();
476476
dbAdd(c->db, c->argv[1], &lobj);
477477
previous_element_number = 0;
478-
c->db->list_number_of_keys++;
479478
} else {
480479
previous_element_number = listTypeLength(lobj);
481480
}

0 commit comments

Comments
 (0)