From 8df6527287d562c244c60a45e0a2fa09f008ab35 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Sat, 12 Oct 2024 10:01:59 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/3.0' into enh/opt-transport --- source/libs/transport/src/transCli.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 59412cb217..e7bf94cd31 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -102,6 +102,7 @@ typedef struct SCliConn { void* heap; // point to req conn heap int32_t heapMissHit; int64_t lastAddHeapTime; + int8_t forceDelFromHeap; uv_buf_t* buf; int32_t bufSize; @@ -1129,6 +1130,7 @@ static void cliDestroy(uv_handle_t* handle) { tDebug("%s conn %p failed to all reqs since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); } + conn->forceDelFromHeap = 1; code = delConnFromHeapCache(pThrd->connHeapCache, conn); if (code != 0) { tDebug("%s conn %p failed to del conn from heapcach since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); @@ -1242,7 +1244,7 @@ static void cliHandleException(SCliConn* conn) { transDQCancel(((SCliThrd*)conn->hostThrd)->timeoutQueue, conn->task); conn->task = NULL; } - + conn->forceDelFromHeap = 1; code = delConnFromHeapCache(pThrd->connHeapCache, conn); if (code != 0) { tError("%s conn %p failed to del conn from heapcach since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code)); @@ -3881,7 +3883,7 @@ int32_t transHeapDelete(SHeap* heap, SCliConn* p) { return 0; } else { int64_t now = taosGetTimestampMs(); - if (now - p->lastAddHeapTime < 10000) { + if (p->forceDelFromHeap == 0 && now - p->lastAddHeapTime < 10000) { tTrace("conn %p not added/delete to heap frequently", p); return 0; }