Skip to content

Commit

Permalink
draft
Browse files Browse the repository at this point in the history
  • Loading branch information
Seungmin Lee committed Dec 10, 2024
1 parent b4c2a18 commit 30d0e6b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -3344,7 +3344,7 @@ standardConfig static_configs[] = {

/* Size_t configs */
createSizeTConfig("hash-max-listpack-entries", "hash-max-ziplist-entries", MODIFIABLE_CONFIG, 0, LONG_MAX, server.hash_max_listpack_entries, 512, INTEGER_CONFIG, NULL, NULL),
createSizeTConfig("set-max-intset-entries", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.set_max_intset_entries, 512, INTEGER_CONFIG, NULL, NULL),
createSizeTConfig("set-max-intset-entries", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.set_max_intset_entries, 2, INTEGER_CONFIG, NULL, NULL),
createSizeTConfig("set-max-listpack-entries", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.set_max_listpack_entries, 128, INTEGER_CONFIG, NULL, NULL),
createSizeTConfig("set-max-listpack-value", NULL, MODIFIABLE_CONFIG, 0, LONG_MAX, server.set_max_listpack_value, 64, INTEGER_CONFIG, NULL, NULL),
createSizeTConfig("zset-max-listpack-entries", "zset-max-ziplist-entries", MODIFIABLE_CONFIG, 0, LONG_MAX, server.zset_max_listpack_entries, 128, INTEGER_CONFIG, NULL, NULL),
Expand Down
4 changes: 3 additions & 1 deletion src/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,9 @@ int dbAddRDBLoad(serverDb *db, sds key, robj *val) {
int dict_index = getKVStoreIndexForKey(key);
dictEntry *de = kvstoreDictAddRaw(db->keys, dict_index, key, NULL);
if (de == NULL) return 0;
initObjectLRUOrLFU(val);
if (val != NULL) {
initObjectLRUOrLFU(val);
}
kvstoreDictSetVal(db->keys, dict_index, de, val);
return 1;
}
Expand Down
1 change: 1 addition & 0 deletions src/intset.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ size_t intsetBlobLen(intset *is) {
* when `deep` is 0, only the integrity of the header is validated.
* when `deep` is 1, we make sure there are no duplicate or out of order records. */
int intsetValidateIntegrity(const unsigned char *p, size_t size, int deep) {
return 1;
intset *is = (intset *)p;
/* check that we can actually read the header. */
if (size < sizeof(*is)) return 0;
Expand Down
27 changes: 14 additions & 13 deletions src/rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -3272,19 +3272,20 @@ int rdbLoadRioWithLoadingCtx(rio *rdb, int rdbflags, rdbSaveInfo *rsi, rdbLoadin
* Similarly, if the base AOF is RDB format, we want to load all
* the keys they are, since the log of operations in the incr AOF
* is assumed to work in the exact keyspace state. */
if (val == NULL) {
/* Since we used to have bug that could lead to empty keys
* (See #8453), we rather not fail when empty key is encountered
* in an RDB file, instead we will silently discard it and
* continue loading. */
if (error == RDB_LOAD_ERR_EMPTY_KEY) {
if (empty_keys_skipped++ < 10) serverLog(LL_NOTICE, "rdbLoadObject skipping empty key: %s", key);
sdsfree(key);
} else {
sdsfree(key);
goto eoferr;
}
} else if (iAmPrimary() && !(rdbflags & RDBFLAGS_AOF_PREAMBLE) && expiretime != -1 && expiretime < now) {
// if (val == NULL) {
// /* Since we used to have bug that could lead to empty keys
// * (See #8453), we rather not fail when empty key is encountered
// * in an RDB file, instead we will silently discard it and
// * continue loading. */
// if (error == RDB_LOAD_ERR_EMPTY_KEY) {
// if (empty_keys_skipped++ < 10) serverLog(LL_NOTICE, "rdbLoadObject skipping empty key: %s", key);
// sdsfree(key);
// } else {
// sdsfree(key);
// goto eoferr;
// }
// } else
if (iAmPrimary() && !(rdbflags & RDBFLAGS_AOF_PREAMBLE) && expiretime != -1 && expiretime < now) {
if (rdbflags & RDBFLAGS_FEED_REPL) {
/* Caller should have created replication backlog,
* and now this path only works when rebooting,
Expand Down
8 changes: 6 additions & 2 deletions src/t_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,9 @@ void saddCommand(client *c) {
int j, added = 0;

set = lookupKeyWrite(c->db, c->argv[1]);
// if set == empty set
// db delete
// set = null
if (checkType(c, set, OBJ_SET)) return;

if (set == NULL) {
Expand Down Expand Up @@ -621,8 +624,9 @@ void sremCommand(client *c) {
if (setTypeRemove(set, c->argv[j]->ptr)) {
deleted++;
if (setTypeSize(set) == 0) {
dbDelete(c->db, c->argv[1]);
keyremoved = 1;
// dbDelete(c->db, c->argv[1]);
// keyremoved = 1;
// Create empty set and add it to db
break;
}
}
Expand Down

0 comments on commit 30d0e6b

Please sign in to comment.