3 fixes, 0 array access on boot, getAsync is useless on single theaded, and don't print COW info for BG thread work since it will be inaccurate

Former-commit-id: 09362ff44afed8525816437aead84f215eb59c36
This commit is contained in:
John Sully 2020-02-02 23:30:42 -05:00
parent 88a148d86e
commit 6ead122691

View File

@ -2596,7 +2596,7 @@ void initServerConfig(void) {
// This will get dereferenced before the second stage init where we have the true db count
// so make sure its zero and initialized
g_pserver->db = (redisDb**)zcalloc(sizeof(redisDb*)*cserver.dbnum, MALLOC_LOCAL);
g_pserver->db = (redisDb**)zcalloc(sizeof(redisDb*)*std::max(cserver.dbnum, 1), MALLOC_LOCAL);
initConfigValues();
}
@ -3907,7 +3907,7 @@ int processCommand(client *c, int callFlags) {
queueMultiCommand(c);
addReply(c,shared.queued);
} else {
if (listLength(g_pserver->monitors) == 0 && c->cmd->proc == getCommand)
if (cserver.cthreads >= 2 && listLength(g_pserver->monitors) == 0 && c->cmd->proc == getCommand)
{
if (getCommandAsync(c))
return C_OK;
@ -5126,11 +5126,14 @@ int redisFork() {
void sendChildCOWInfo(int ptype, const char *pname) {
size_t private_dirty = zmalloc_get_private_dirty(-1);
if (ptype != CHILD_INFO_TYPE_RDB)
{
if (private_dirty) {
serverLog(LL_NOTICE,
"%s: %zu MB of memory used by copy-on-write",
pname, private_dirty/(1024*1024));
}
}
g_pserver->child_info_data.cow_size = private_dirty;
sendChildInfo(ptype);