提交 4f05897b 编写于 作者: S Shenglian Zhou

merge fix reconfigure table

...@@ -611,16 +611,19 @@ static int32_t insertChildTableBatch(TAOS* taos, char* cTableName, SArray* cols ...@@ -611,16 +611,19 @@ static int32_t insertChildTableBatch(TAOS* taos, char* cTableName, SArray* cols
snprintf(sql + strlen(sql)-1, freeBytes-strlen(sql)+1, ")"); snprintf(sql + strlen(sql)-1, freeBytes-strlen(sql)+1, ")");
tscDebug("insert rows %zu into child table %s. ", taosArrayGetSize(rowsBind), cTableName); tscDebug("insert rows %zu into child table %s. ", taosArrayGetSize(rowsBind), cTableName);
int32_t code = 0; int32_t code = 0;
int32_t try = 0; int32_t try = 0;
do {
TAOS_STMT* stmt = taos_stmt_init(taos);
code = taos_stmt_prepare(stmt, sql, strlen(sql)); TAOS_STMT* stmt = taos_stmt_init(taos);
if (code != 0) {
tscError("%s", taos_stmt_errstr(stmt)); code = taos_stmt_prepare(stmt, sql, strlen(sql));
return code; if (code != 0) {
} tscError("%s", taos_stmt_errstr(stmt));
return code;
}
do {
code = taos_stmt_set_tbname(stmt, cTableName); code = taos_stmt_set_tbname(stmt, cTableName);
if (code != 0) { if (code != 0) {
...@@ -646,12 +649,16 @@ static int32_t insertChildTableBatch(TAOS* taos, char* cTableName, SArray* cols ...@@ -646,12 +649,16 @@ static int32_t insertChildTableBatch(TAOS* taos, char* cTableName, SArray* cols
code = taos_stmt_execute(stmt); code = taos_stmt_execute(stmt);
if (code != 0) { if (code != 0) {
tscError("%s", taos_stmt_errstr(stmt)); tscError("%s", taos_stmt_errstr(stmt));
taos_stmt_close(stmt);
} else {
taos_stmt_close(stmt);
} }
} while (code == TSDB_CODE_TDB_TABLE_RECONFIGURE && try++ < TSDB_MAX_REPLICA); } while (code == TSDB_CODE_TDB_TABLE_RECONFIGURE && try++ < TSDB_MAX_REPLICA);
if (code != 0) {
tscError("%s", taos_stmt_errstr(stmt));
taos_stmt_close(stmt);
} else {
taos_stmt_close(stmt);
}
return code; return code;
} }
......
...@@ -1200,9 +1200,11 @@ static int insertBatchStmtExecute(STscStmt* pStmt) { ...@@ -1200,9 +1200,11 @@ static int insertBatchStmtExecute(STscStmt* pStmt) {
// wait for the callback function to post the semaphore // wait for the callback function to post the semaphore
tsem_wait(&pStmt->pSql->rspSem); tsem_wait(&pStmt->pSql->rspSem);
code = pStmt->pSql->res.code;
insertBatchClean(pStmt); insertBatchClean(pStmt);
return pStmt->pSql->res.code; return code;
} }
int stmtParseInsertTbTags(SSqlObj* pSql, STscStmt* pStmt) { int stmtParseInsertTbTags(SSqlObj* pSql, STscStmt* pStmt) {
...@@ -1647,7 +1649,11 @@ int taos_stmt_close(TAOS_STMT* stmt) { ...@@ -1647,7 +1649,11 @@ int taos_stmt_close(TAOS_STMT* stmt) {
} else { } else {
if (pStmt->multiTbInsert) { if (pStmt->multiTbInsert) {
taosHashCleanup(pStmt->mtb.pTableHash); taosHashCleanup(pStmt->mtb.pTableHash);
pStmt->mtb.pTableBlockHashList = tscDestroyBlockHashTable(pStmt->mtb.pTableBlockHashList, false); bool rmMeta = false;
if (pStmt->pSql && pStmt->pSql->res.code != 0) {
rmMeta = true;
}
pStmt->mtb.pTableBlockHashList = tscDestroyBlockHashTable(pStmt->mtb.pTableBlockHashList, rmMeta);
taosHashCleanup(pStmt->pSql->cmd.insertParam.pTableBlockHashList); taosHashCleanup(pStmt->pSql->cmd.insertParam.pTableBlockHashList);
pStmt->pSql->cmd.insertParam.pTableBlockHashList = NULL; pStmt->pSql->cmd.insertParam.pTableBlockHashList = NULL;
taosArrayDestroy(pStmt->mtb.tags); taosArrayDestroy(pStmt->mtb.tags);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册