Merge branch 'async_commands' of https://gitlab.eqalpha.com/keydb-dev/KeyDB-Pro into async_commands

Former-commit-id: 393add1f3d70f7d1e09ecbce60c65508bc06394d
This commit is contained in:
malavan 2021-09-22 19:28:37 +00:00
commit acfa705d48
3 changed files with 5 additions and 6 deletions

View File

@ -2712,7 +2712,7 @@ void readQueryFromClient(connection *conn) {
if (cserver.cthreads > 1) { if (cserver.cthreads > 1) {
parseClientCommandBuffer(c); parseClientCommandBuffer(c);
if (g_pserver->enable_async_commands && (aeLockContention() || g_fTestMode)) if (g_pserver->enable_async_commands && listLength(g_pserver->monitors) == 0 && (aeLockContention() || g_fTestMode))
processInputBuffer(c, false, CMD_CALL_SLOWLOG | CMD_CALL_STATS | CMD_CALL_ASYNC); processInputBuffer(c, false, CMD_CALL_SLOWLOG | CMD_CALL_STATS | CMD_CALL_ASYNC);
if (!c->vecqueuedcmd.empty()) if (!c->vecqueuedcmd.empty())
serverTL->vecclientsProcess.push_back(c); serverTL->vecclientsProcess.push_back(c);

View File

@ -1601,23 +1601,22 @@ robj *deserializeStoredStringObject(const char *data, size_t cb)
newObject = createObject(OBJ_STRING, nullptr); newObject = createObject(OBJ_STRING, nullptr);
newObject->encoding = oT->encoding; newObject->encoding = oT->encoding;
newObject->m_ptr = oT->m_ptr; newObject->m_ptr = oT->m_ptr;
return newObject; break;
case OBJ_ENCODING_EMBSTR: case OBJ_ENCODING_EMBSTR:
newObject = createEmbeddedStringObject(szFromObj(oT), sdslen(szFromObj(oT))); newObject = createEmbeddedStringObject(szFromObj(oT), sdslen(szFromObj(oT)));
return newObject; break;
case OBJ_ENCODING_RAW: case OBJ_ENCODING_RAW:
newObject = createObject(OBJ_STRING, sdsnewlen(SDS_NOINIT,cb-sizeof(robj)-sizeof(uint64_t))); newObject = createObject(OBJ_STRING, sdsnewlen(SDS_NOINIT,cb-sizeof(robj)-sizeof(uint64_t)));
newObject->lru = oT->lru; newObject->lru = oT->lru;
memcpy(newObject->m_ptr, data+sizeof(robj)+sizeof(mvcc), cb-sizeof(robj)-sizeof(mvcc)); memcpy(newObject->m_ptr, data+sizeof(robj)+sizeof(mvcc), cb-sizeof(robj)-sizeof(mvcc));
return newObject; break;
default: default:
serverPanic("Unknown string object encoding from storage"); serverPanic("Unknown string object encoding from storage");
} }
setMvccTstamp(newObject, mvcc); setMvccTstamp(newObject, mvcc);
newObject->setrefcount(1);
return newObject; return newObject;
} }

View File

@ -4777,7 +4777,7 @@ int processCommand(client *c, int callFlags) {
* the event loop since there is a busy Lua script running in timeout * the event loop since there is a busy Lua script running in timeout
* condition, to avoid mixing the propagation of scripts with the * condition, to avoid mixing the propagation of scripts with the
* propagation of DELs due to eviction. */ * propagation of DELs due to eviction. */
if (g_pserver->maxmemory && !g_pserver->lua_timedout) { if (g_pserver->maxmemory && !g_pserver->lua_timedout && !(callFlags & CMD_CALL_ASYNC)) {
int out_of_memory = (performEvictions(false /*fPreSnapshot*/) == EVICT_FAIL); int out_of_memory = (performEvictions(false /*fPreSnapshot*/) == EVICT_FAIL);
/* freeMemoryIfNeeded may flush replica output buffers. This may result /* freeMemoryIfNeeded may flush replica output buffers. This may result
* into a replica, that may be the active client, to be freed. */ * into a replica, that may be the active client, to be freed. */