diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index 6adf2f1be161bc73de1891175a56c9b34f26072f..3b45bdcb7332396e0a756a0ec5d641a6c55bae70 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -276,7 +276,8 @@ typedef struct { bool existsCheck; // check if the table exists int8_t showType; // show command type }; - + + int8_t isParseFinish; int8_t isInsertFromFile; // load data from file or not bool import; // import/insert type uint8_t msgType; diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index 99b9b571d7ffe513e87206c5cd0c5d380318ca95..9c543952b4cb7349224ff1fb088f1099a179f280 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -507,8 +507,21 @@ void tscMeterMetaCallBack(void *param, TAOS_RES *res, int code) { if (code == TSDB_CODE_ACTION_IN_PROGRESS) return; } else { // normal async query continues - code = tsParseSql(pSql, pObj->acctId, pObj->db, false); - if (code == TSDB_CODE_ACTION_IN_PROGRESS) return; + if (pCmd->isParseFinish) { + tscTrace("%p resend data to vnode in metermeta callback since sql has been parsed completed", pSql); + + SMeterMetaInfo* pMeterMetaInfo = tscGetMeterMetaInfo(pCmd, 0); + code = tscGetMeterMeta(pSql, pMeterMetaInfo->name, 0); + assert(code == TSDB_CODE_SUCCESS); + + if (pMeterMetaInfo->pMeterMeta) { + code = tscSendMsgToServer(pSql); + if (code == TSDB_CODE_SUCCESS) return; + } + } else { + code = tsParseSql(pSql, pObj->acctId, pObj->db, false); + if (code == TSDB_CODE_ACTION_IN_PROGRESS) return; + } } } else { // stream computing diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index ecde02355a7d64bf08fed33fe5d339455325fb75..dc74a2fc8b8de6e34f48ad56f8daae451aab6631 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -975,7 +975,7 @@ int doParserInsertSql(SSqlObj *pSql, char *str) { str = pSql->asyncTblPos; } - tscTrace("%p create data block list for submit data, %p", pSql, pSql->cmd.pDataBlocks); + tscTrace("%p create data block list for submit data:%p, asyncTblPos:%p, pTableHashList:%p", pSql, pSql->cmd.pDataBlocks, pSql->asyncTblPos, pSql->pTableHashList); while (1) { int32_t index = 0; @@ -1010,7 +1010,7 @@ int doParserInsertSql(SSqlObj *pSql, char *str) { if ((code = tscParseSqlForCreateTableOnDemand(&str, pSql)) != TSDB_CODE_SUCCESS) { if (fp != NULL) { if (TSDB_CODE_ACTION_IN_PROGRESS == code) { - tscTrace("async insert and waiting to get meter meta, then continue parse sql: %s", pSql->asyncTblPos); + tscTrace("async insert and waiting to get meter meta, then continue parse sql: %s, pTableHashList:%p", pSql->asyncTblPos, pSql->pTableHashList); return code; } tscTrace("async insert parse error, code:%d, %s", code, tsError[code]); @@ -1221,6 +1221,7 @@ _clean: taosCleanUpIntHash(pSql->pTableHashList); pSql->pTableHashList = NULL; pSql->asyncTblPos = NULL; + pCmd->isParseFinish = 1; return code; }