opt parameter

This commit is contained in:
yihaoDeng 2024-09-14 18:06:25 +08:00
parent 8902f78f50
commit 7acf61f02b
3 changed files with 11 additions and 10 deletions

View File

@ -494,7 +494,7 @@ int32_t transUtilSWhiteListToStr(SIpWhiteList* pWhiteList, char** ppBuf);
enum { REQ_STATUS_INIT = 0, REQ_STATUS_PROCESSING }; enum { REQ_STATUS_INIT = 0, REQ_STATUS_PROCESSING };
#define BUFFER_LIMIT 8 #define BUFFER_LIMIT 4
typedef struct { typedef struct {
queue q; queue q;

View File

@ -493,9 +493,10 @@ int32_t cliHandleState_mayCreateAhandle(SCliConn* conn, STransMsgHead* pHead, ST
if (pCtx == 0) { if (pCtx == 0) {
return TSDB_CODE_RPC_NO_STATE; return TSDB_CODE_RPC_NO_STATE;
} }
STraceId* trace = &pHead->traceId;
pResp->info.ahandle = transCtxDumpVal(pCtx, pHead->msgType); pResp->info.ahandle = transCtxDumpVal(pCtx, pHead->msgType);
tDebug("%s conn %p construct ahandle %p by %s", CONN_GET_INST_LABEL(conn), conn, pResp->info.ahandle, tGDebug("%s conn %p %s received from %s, local info:%s, qid:%ld, create ahandle %p by %s", CONN_GET_INST_LABEL(conn),
TMSG_INFO(pHead->msgType)); conn, TMSG_INFO(pHead->msgType), conn->dst, conn->src, qId, pResp->info.ahandle, TMSG_INFO(pHead->msgType));
return 0; return 0;
} }
@ -762,7 +763,6 @@ static void addConnToPool(void* pool, SCliConn* conn) {
conn->list->size += 1; conn->list->size += 1;
tDebug("conn %p added to pool, pool size: %d, dst: %s", conn, conn->list->size, conn->dstAddr); tDebug("conn %p added to pool, pool size: %d, dst: %s", conn, conn->list->size, conn->dstAddr);
conn->heap = NULL;
conn->seq = 0; conn->seq = 0;
if (conn->list->size >= 10) { if (conn->list->size >= 10) {
@ -3125,7 +3125,7 @@ static int32_t getOrCreateHeap(SHashObj* pConnHeapCache, char* key, SHeap** pHea
static FORCE_INLINE int8_t shouldSWitchToOtherConn(int32_t reqNum, int32_t sentNum, int32_t stateNum) { static FORCE_INLINE int8_t shouldSWitchToOtherConn(int32_t reqNum, int32_t sentNum, int32_t stateNum) {
int32_t total = reqNum + sentNum + stateNum; int32_t total = reqNum + sentNum + stateNum;
if (total >= 4) { if (total >= BUFFER_LIMIT) {
return 1; return 1;
} }
@ -3165,6 +3165,8 @@ static int32_t addConnToHeapCache(SHashObj* pConnHeapCacahe, SCliConn* pConn) {
if (pConn->heap != NULL) { if (pConn->heap != NULL) {
p = pConn->heap; p = pConn->heap;
tDebug("conn %p add to heap cache for key:%s,status:%d, refCnt:%d, add direct", pConn, pConn->dstAddr,
pConn->inHeap, pConn->reqRefCnt);
} else { } else {
code = getOrCreateHeap(pConnHeapCacahe, pConn->dstAddr, &p); code = getOrCreateHeap(pConnHeapCacahe, pConn->dstAddr, &p);
if (code != 0) { if (code != 0) {
@ -3173,13 +3175,14 @@ static int32_t addConnToHeapCache(SHashObj* pConnHeapCacahe, SCliConn* pConn) {
} }
code = transHeapInsert(p, pConn); code = transHeapInsert(p, pConn);
tDebug("add conn %p to heap cache for key:%s,status:%d, refCnt:%d", pConn, pConn->dstAddr, pConn->inHeap, tDebug("conn %p add to heap cache for key:%s,status:%d, refCnt:%d", pConn, pConn->dstAddr, pConn->inHeap,
pConn->reqRefCnt); pConn->reqRefCnt);
return code; return code;
} }
static int32_t delConnFromHeapCache(SHashObj* pConnHeapCache, SCliConn* pConn) { static int32_t delConnFromHeapCache(SHashObj* pConnHeapCache, SCliConn* pConn) {
if (pConn->heap != NULL) { if (pConn->heap != NULL) {
tDebug("conn %p delete from heap cache direct", pConn);
return transHeapDelete(pConn->heap, pConn); return transHeapDelete(pConn->heap, pConn);
} }
@ -3190,7 +3193,7 @@ static int32_t delConnFromHeapCache(SHashObj* pConnHeapCache, SCliConn* pConn) {
} }
int32_t code = transHeapDelete(p, pConn); int32_t code = transHeapDelete(p, pConn);
if (code != 0) { if (code != 0) {
tDebug("failed to delete conn %p from heap cache since %s", pConn, tstrerror(code)); tDebug("%s conn failed to delete conn %p from heap cache since %s", pConn, tstrerror(code));
} }
return code; return code;
} }
@ -3253,8 +3256,7 @@ int32_t transHeapDelete(SHeap* heap, SCliConn* p) {
p->reqRefCnt--; p->reqRefCnt--;
if (p->reqRefCnt == 0) { if (p->reqRefCnt == 0) {
heapRemove(heap->heap, &p->node); heapRemove(heap->heap, &p->node);
p->heap = NULL; tDebug("conn %p delete from heap", p);
tDebug("delete conn %p delete from heap", p);
} else if (p->reqRefCnt < 0) { } else if (p->reqRefCnt < 0) {
tDebug("conn %p has %d reqs, not delete from heap,assert", p, p->reqRefCnt); tDebug("conn %p has %d reqs, not delete from heap,assert", p, p->reqRefCnt);
} else { } else {

View File

@ -779,7 +779,6 @@ static int32_t uvBuildToSendData(SSvrConn* pConn, uv_buf_t** ppBuf, int32_t* buf
} }
if (count == 0) { if (count == 0) {
taosMemoryFree(pWb);
return 0; return 0;
} }