Merge remote-tracking branch 'origin/3.0' into enh/opt-transport

This commit is contained in:
yihaoDeng 2024-10-12 09:09:10 +08:00
parent 1a5477f2b5
commit 331235a828
1 changed files with 9 additions and 0 deletions

View File

@ -101,6 +101,7 @@ typedef struct SCliConn {
void* heap; // point to req conn heap void* heap; // point to req conn heap
int32_t heapMissHit; int32_t heapMissHit;
int64_t lastAddHeapTime;
uv_buf_t* buf; uv_buf_t* buf;
int32_t bufSize; int32_t bufSize;
@ -3866,6 +3867,7 @@ int32_t transHeapInsert(SHeap* heap, SCliConn* p) {
heapInsert(heap->heap, &p->node); heapInsert(heap->heap, &p->node);
p->inHeap = 1; p->inHeap = 1;
p->lastAddHeapTime = taosGetTimestampMs();
p->heap = heap; p->heap = heap;
return 0; return 0;
} }
@ -3877,7 +3879,14 @@ int32_t transHeapDelete(SHeap* heap, SCliConn* p) {
if (p->inHeap == 0) { if (p->inHeap == 0) {
tDebug("failed to del conn %p since not in heap", p); tDebug("failed to del conn %p since not in heap", p);
return 0; return 0;
} else {
int64_t now = taosGetTimestampMs();
if (now - p->lastAddHeapTime < 10000) {
tDebug("conn %p not added to heap frequently", p);
return 0;
}
} }
p->inHeap = 0; p->inHeap = 0;
p->reqRefCnt--; p->reqRefCnt--;
if (p->reqRefCnt == 0) { if (p->reqRefCnt == 0) {