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

merge fix reconfigure table

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