mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 08:08:53 -05:00
Remove dead code around should_expand_db (#12767)
when dbExpand is called from rdb.c with try_expand set to 0, it will either panic panic on OOM, or be non-fatal (should not fail RDB loading) At the same time, the log text has been slightly adjusted to make it more unified.
This commit is contained in:
parent
7410d985bc
commit
a3ae2ed37b
4
src/db.c
4
src/db.c
@ -2228,11 +2228,11 @@ int dbExpand(const redisDb *db, uint64_t db_size, dbKeyType keyType, int try_exp
|
|||||||
}
|
}
|
||||||
int result = try_expand ? dictTryExpand(d, db_size) : dictExpand(d, db_size);
|
int result = try_expand ? dictTryExpand(d, db_size) : dictExpand(d, db_size);
|
||||||
if (try_expand && result == DICT_ERR) {
|
if (try_expand && result == DICT_ERR) {
|
||||||
serverLog(LL_WARNING, "Dict expansion failed for type :%s slot: %d",
|
serverLog(LL_WARNING, "Dict expansion failed for db type: %s, slot: %d",
|
||||||
keyType == DB_MAIN ? "main" : "expires", i);
|
keyType == DB_MAIN ? "main" : "expires", i);
|
||||||
return C_ERR;
|
return C_ERR;
|
||||||
} else if (result == DICT_ERR) {
|
} else if (result == DICT_ERR) {
|
||||||
serverLog(LL_DEBUG, "Dict expansion skipped for type :%s slot: %d",
|
serverLog(LL_DEBUG, "Dict expansion skipped for db type: %s, slot: %d",
|
||||||
keyType == DB_MAIN ? "main" : "expires", i);
|
keyType == DB_MAIN ? "main" : "expires", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
src/rdb.c
10
src/rdb.c
@ -3264,14 +3264,8 @@ int rdbLoadRioWithLoadingCtx(rio *rdb, int rdbflags, rdbSaveInfo *rsi, rdbLoadin
|
|||||||
/* If there is no slot info, it means that it's either not cluster mode or we are trying to load legacy RDB file.
|
/* If there is no slot info, it means that it's either not cluster mode or we are trying to load legacy RDB file.
|
||||||
* In this case we want to estimate number of keys per slot and resize accordingly. */
|
* In this case we want to estimate number of keys per slot and resize accordingly. */
|
||||||
if (should_expand_db) {
|
if (should_expand_db) {
|
||||||
if (dbExpand(db, db_size, DB_MAIN, 0) == C_ERR) {
|
dbExpand(db, db_size, DB_MAIN, 0);
|
||||||
serverLog(LL_WARNING, "OOM in dict expand of main dict");
|
dbExpand(db, expires_size, DB_EXPIRES, 0);
|
||||||
return C_ERR;
|
|
||||||
}
|
|
||||||
if (dbExpand(db, expires_size, DB_EXPIRES, 0) == C_ERR) {
|
|
||||||
serverLog(LL_WARNING, "OOM in dict expand of expire dict");
|
|
||||||
return C_ERR;
|
|
||||||
}
|
|
||||||
should_expand_db = 0;
|
should_expand_db = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user