[TD-5235]<feature>:offload msg processing from rpc thread to tsc scheduler
This commit is contained in:
parent
da3e784721
commit
7032e5a00b
|
@ -484,7 +484,7 @@ int32_t loadTableMeta(TAOS* taos, char* tableName, SSmlSTableSchema* schema, SSm
|
||||||
size_t tagIndex = taosArrayGetSize(schema->tags) - 1;
|
size_t tagIndex = taosArrayGetSize(schema->tags) - 1;
|
||||||
taosHashPut(schema->tagHash, field.name, strlen(field.name), &tagIndex, sizeof(tagIndex));
|
taosHashPut(schema->tagHash, field.name, strlen(field.name), &tagIndex, sizeof(tagIndex));
|
||||||
}
|
}
|
||||||
tscDebug("SML:0x%"PRIx64 "load table meta succeed. %s, columns number: %d, tag number: %d, precision: %d",
|
tscDebug("SML:0x%"PRIx64 " load table meta succeed. table name: %s, columns number: %d, tag number: %d, precision: %d",
|
||||||
info->id, tableName, tableMeta->tableInfo.numOfColumns, tableMeta->tableInfo.numOfTags, schema->precision);
|
info->id, tableName, tableMeta->tableInfo.numOfColumns, tableMeta->tableInfo.numOfTags, schema->precision);
|
||||||
free(tableMeta); tableMeta = NULL;
|
free(tableMeta); tableMeta = NULL;
|
||||||
return code;
|
return code;
|
||||||
|
|
|
@ -337,11 +337,16 @@ int tscSendMsgToServer(SSqlObj *pSql) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
|
static void doProcessMsgFromServer(SSchedMsg* pSchedMsg) {
|
||||||
|
SRpcMsg* rpcMsg = pSchedMsg->ahandle;
|
||||||
|
SRpcEpSet* pEpSet = pSchedMsg->thandle;
|
||||||
|
|
||||||
TSDB_CACHE_PTR_TYPE handle = (TSDB_CACHE_PTR_TYPE) rpcMsg->ahandle;
|
TSDB_CACHE_PTR_TYPE handle = (TSDB_CACHE_PTR_TYPE) rpcMsg->ahandle;
|
||||||
SSqlObj* pSql = (SSqlObj*)taosAcquireRef(tscObjRef, handle);
|
SSqlObj* pSql = (SSqlObj*)taosAcquireRef(tscObjRef, handle);
|
||||||
if (pSql == NULL) {
|
if (pSql == NULL) {
|
||||||
rpcFreeCont(rpcMsg->pCont);
|
rpcFreeCont(rpcMsg->pCont);
|
||||||
|
free(rpcMsg);
|
||||||
|
free(pEpSet);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,6 +364,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
|
||||||
taosRemoveRef(tscObjRef, handle);
|
taosRemoveRef(tscObjRef, handle);
|
||||||
taosReleaseRef(tscObjRef, handle);
|
taosReleaseRef(tscObjRef, handle);
|
||||||
rpcFreeCont(rpcMsg->pCont);
|
rpcFreeCont(rpcMsg->pCont);
|
||||||
|
free(rpcMsg);
|
||||||
|
free(pEpSet);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,6 +377,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
|
||||||
taosRemoveRef(tscObjRef, handle);
|
taosRemoveRef(tscObjRef, handle);
|
||||||
taosReleaseRef(tscObjRef, handle);
|
taosReleaseRef(tscObjRef, handle);
|
||||||
rpcFreeCont(rpcMsg->pCont);
|
rpcFreeCont(rpcMsg->pCont);
|
||||||
|
free(rpcMsg);
|
||||||
|
free(pEpSet);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,6 +431,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
|
||||||
if (rpcMsg->code == TSDB_CODE_TSC_ACTION_IN_PROGRESS) {
|
if (rpcMsg->code == TSDB_CODE_TSC_ACTION_IN_PROGRESS) {
|
||||||
taosReleaseRef(tscObjRef, handle);
|
taosReleaseRef(tscObjRef, handle);
|
||||||
rpcFreeCont(rpcMsg->pCont);
|
rpcFreeCont(rpcMsg->pCont);
|
||||||
|
free(rpcMsg);
|
||||||
|
free(pEpSet);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -499,6 +510,31 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
|
||||||
|
|
||||||
taosReleaseRef(tscObjRef, handle);
|
taosReleaseRef(tscObjRef, handle);
|
||||||
rpcFreeCont(rpcMsg->pCont);
|
rpcFreeCont(rpcMsg->pCont);
|
||||||
|
free(rpcMsg);
|
||||||
|
free(pEpSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
|
||||||
|
SSchedMsg schedMsg = {0};
|
||||||
|
|
||||||
|
schedMsg.fp = doProcessMsgFromServer;
|
||||||
|
|
||||||
|
SRpcMsg* rpcMsgCopy = calloc(1, sizeof(SRpcMsg));
|
||||||
|
memcpy(rpcMsgCopy, rpcMsg, sizeof(struct SRpcMsg));
|
||||||
|
rpcMsgCopy->pCont = rpcMallocCont(rpcMsg->contLen);
|
||||||
|
memcpy(rpcMsgCopy->pCont, rpcMsg->pCont, rpcMsg->contLen);
|
||||||
|
schedMsg.ahandle = (void*)rpcMsgCopy;
|
||||||
|
|
||||||
|
SRpcEpSet* pEpSetCopy = NULL;
|
||||||
|
if (pEpSet != NULL) {
|
||||||
|
pEpSetCopy = calloc(1, sizeof(SRpcEpSet));
|
||||||
|
memcpy(pEpSetCopy, pEpSet, sizeof(SRpcEpSet));
|
||||||
|
}
|
||||||
|
|
||||||
|
schedMsg.thandle = (void*)pEpSetCopy;
|
||||||
|
schedMsg.msg = NULL;
|
||||||
|
|
||||||
|
taosScheduleTask(tscQhandle, &schedMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int doBuildAndSendMsg(SSqlObj *pSql) {
|
int doBuildAndSendMsg(SSqlObj *pSql) {
|
||||||
|
|
Loading…
Reference in New Issue