提交 9333120d 编写于 作者: wmmhello's avatar wmmhello

feat: add async logic for schemaless

上级 f364ad7b
...@@ -199,7 +199,10 @@ TAOS_RES *taos_query(TAOS *taos, const char *sql) { ...@@ -199,7 +199,10 @@ TAOS_RES *taos_query(TAOS *taos, const char *sql) {
taos_query_a(pTscObj, sql, syncQueryFn, param); taos_query_a(pTscObj, sql, syncQueryFn, param);
tsem_wait(&param->sem); tsem_wait(&param->sem);
return param->pRequest; TAOS_RES *request = param->pRequest;
tsem_destroy(&param->sem);
taosMemoryFree(param);
return request;
#else #else
size_t sqlLen = strlen(sql); size_t sqlLen = strlen(sql);
if (sqlLen > (size_t)TSDB_MAX_ALLOWED_SQL_LEN) { if (sqlLen > (size_t)TSDB_MAX_ALLOWED_SQL_LEN) {
......
...@@ -2261,7 +2261,7 @@ static int smlProcess(SSmlHandle *info, char* lines[], int numLines) { ...@@ -2261,7 +2261,7 @@ static int smlProcess(SSmlHandle *info, char* lines[], int numLines) {
code = smlParseLine(info, lines, numLines); code = smlParseLine(info, lines, numLines);
if (code != 0) { if (code != 0) {
uError("SML:0x%"PRIx64" smlParseLine error : %s", info->id, tstrerror(code)); uError("SML:0x%"PRIx64" smlParseLine error : %s", info->id, tstrerror(code));
goto cleanup; return code;
} }
info->cost.lineNum = numLines; info->cost.lineNum = numLines;
...@@ -2277,20 +2277,16 @@ static int smlProcess(SSmlHandle *info, char* lines[], int numLines) { ...@@ -2277,20 +2277,16 @@ static int smlProcess(SSmlHandle *info, char* lines[], int numLines) {
if (code != 0) { if (code != 0) {
uError("SML:0x%"PRIx64" smlModifyDBSchemas error : %s", info->id, tstrerror(code)); uError("SML:0x%"PRIx64" smlModifyDBSchemas error : %s", info->id, tstrerror(code));
goto cleanup; return code;
} }
info->cost.insertBindTime = taosGetTimestampUs(); info->cost.insertBindTime = taosGetTimestampUs();
code = smlInsertData(info); code = smlInsertData(info);
if (code != 0) { if (code != 0) {
uError("SML:0x%"PRIx64" smlInsertData error : %s", info->id, tstrerror(code)); uError("SML:0x%"PRIx64" smlInsertData error : %s", info->id, tstrerror(code));
goto cleanup; return code;
} }
info->cost.endTime = taosGetTimestampUs();
cleanup:
info->cost.code = code;
smlPrintStatisticInfo(info);
return code; return code;
} }
...@@ -2329,6 +2325,9 @@ static void smlInsertCallback(void* param, void* res, int32_t code) { ...@@ -2329,6 +2325,9 @@ static void smlInsertCallback(void* param, void* res, int32_t code) {
printf("SML:0x%" PRIx64 " insert finished, code: %d, total: %d\n", info->id, code, info->affectedRows); printf("SML:0x%" PRIx64 " insert finished, code: %d, total: %d\n", info->id, code, info->affectedRows);
Params *pParam = info->params; Params *pParam = info->params;
bool isLast = info->isLast; bool isLast = info->isLast;
info->cost.endTime = taosGetTimestampUs();
info->cost.code = code;
smlPrintStatisticInfo(info);
smlDestroyInfo(info); smlDestroyInfo(info);
if(isLast){ if(isLast){
......
...@@ -86,11 +86,15 @@ tb_uid_t metaGetTableEntryUidByName(SMeta *pMeta, const char *name) { ...@@ -86,11 +86,15 @@ tb_uid_t metaGetTableEntryUidByName(SMeta *pMeta, const char *name) {
int nData = 0; int nData = 0;
tb_uid_t uid = 0; tb_uid_t uid = 0;
metaRLock(pMeta);
if (tdbTbGet(pMeta->pNameIdx, name, strlen(name) + 1, &pData, &nData) == 0) { if (tdbTbGet(pMeta->pNameIdx, name, strlen(name) + 1, &pData, &nData) == 0) {
uid = *(tb_uid_t *)pData; uid = *(tb_uid_t *)pData;
tdbFree(pData); tdbFree(pData);
} }
metaULock(pMeta);
return 0; return 0;
} }
......
...@@ -787,7 +787,9 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq ...@@ -787,7 +787,9 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
msgIter.suid = 0; msgIter.suid = 0;
} }
#ifdef TD_DEBUG_PRINT_ROW
vnodeDebugPrintSingleSubmitMsg(pVnode->pMeta, pBlock, &msgIter, "real uid"); vnodeDebugPrintSingleSubmitMsg(pVnode->pMeta, pBlock, &msgIter, "real uid");
#endif
tDecoderClear(&decoder); tDecoderClear(&decoder);
} else { } else {
submitBlkRsp.tblFName = taosMemoryMalloc(TSDB_TABLE_FNAME_LEN); submitBlkRsp.tblFName = taosMemoryMalloc(TSDB_TABLE_FNAME_LEN);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册