diff --git a/src/db.cpp b/src/db.cpp index a87b64f8c..b3d355b1a 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -159,7 +159,6 @@ static robj_roptr lookupKeyConst(redisDb *db, robj *key, int flags) { * expiring our key via DELs in the replication link. */ robj_roptr lookupKeyReadWithFlags(redisDb *db, robj *key, int flags) { robj_roptr val; - //serverAssert(GlobalLocksAcquired()); if (expireIfNeeded(db,key) == 1) { /* If we are in the context of a master, expireIfNeeded() returns 1 diff --git a/src/networking.cpp b/src/networking.cpp index b25eeaf71..7ec72e60c 100644 --- a/src/networking.cpp +++ b/src/networking.cpp @@ -530,7 +530,7 @@ void addReplyErrorLength(client *c, const char *s, size_t len) { /* Do some actions after an error reply was sent (Log if needed, updates stats, etc.) */ void afterErrorReply(client *c, const char *s, size_t len, int severity = ERR_CRITICAL) { - /* Increment the global error counter */ + /* Increment the thread error counter */ serverTL->stat_total_error_replies++; /* Increment the error stats * If the string already starts with "-..." then the error prefix diff --git a/src/server.cpp b/src/server.cpp index eb50c18f5..3abbec816 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -4357,7 +4357,6 @@ void call(client *c, int flags) { int client_old_flags = c->flags; struct redisCommand *real_cmd = c->cmd; serverAssert(((flags & CMD_CALL_ASYNC) && (c->cmd->flags & CMD_READONLY)) || GlobalLocksAcquired()); - long long prev_err_count; serverTL->fixed_time_expire++; @@ -4388,7 +4387,7 @@ void call(client *c, int flags) { /* Call the command. */ dirty = g_pserver->dirty; - prev_err_count = serverTL->stat_total_error_replies; + serverTL->prev_err_count = serverTL->stat_total_error_replies; incrementMvccTstamp(); elapsedStart(&call_timer); try { @@ -4413,7 +4412,7 @@ void call(client *c, int flags) { * We leverage a static variable (prev_err_count) to retain * the counter across nested function calls and avoid logging * the same error twice. */ - if ((serverTL->stat_total_error_replies - prev_err_count) > 0) { + if ((serverTL->stat_total_error_replies - serverTL->prev_err_count) > 0) { real_cmd->failed_calls++; } @@ -4579,7 +4578,7 @@ void call(client *c, int flags) { __atomic_fetch_add(&g_pserver->stat_numcommands, 1, __ATOMIC_RELAXED); serverTL->fixed_time_expire--; - prev_err_count = serverTL->stat_total_error_replies; + serverTL->prev_err_count = serverTL->stat_total_error_replies; if (!(flags & CMD_CALL_ASYNC)) { /* Record peak memory after each command and before the eviction that runs diff --git a/src/server.h b/src/server.h index 819690b62..421aed87f 100644 --- a/src/server.h +++ b/src/server.h @@ -2020,6 +2020,7 @@ struct redisServerThreadVars { GarbageCollectorCollection::Epoch gcEpoch; const redisDbPersistentDataSnapshot **rgdbSnapshot = nullptr; long long stat_total_error_replies; /* Total number of issued error replies ( command + rejected errors ) */ + long long prev_err_count; /* per thread marker of exisiting errors during a call */ bool fRetrySetAofEvent = false; bool modulesEnabledThisAeLoop = false; /* In this loop of aeMain, were modules enabled before the thread went to sleep? */