From e30edca2bd0e4e628f3979bfe117f9f3370a9736 Mon Sep 17 00:00:00 2001 From: lihui Date: Mon, 6 Jan 2020 12:15:06 +0800 Subject: [PATCH] [#1083] --- src/client/inc/tsclient.h | 3 ++- src/client/src/tscAsync.c | 17 +++++++++++++++-- src/client/src/tscParseInsert.c | 5 +++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index 6adf2f1be1..3b45bdcb73 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 99b9b571d7..9c543952b4 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 ecde02355a..dc74a2fc8b 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; } -- GitLab