提交 8f200866 编写于 作者: W wpan

add retry for reconfigure table

上级 bcba45e3
......@@ -565,16 +565,19 @@ static int32_t insertChildTableBatch(TAOS* taos, char* cTableName, SArray* cols
}
snprintf(sql + strlen(sql)-1, freeBytes-strlen(sql)+1, ")");
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) {
printf("%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) {
printf("%s", taos_stmt_errstr(stmt));
return code;
}
do {
code = taos_stmt_set_tbname(stmt, cTableName);
if (code != 0) {
......@@ -598,14 +601,15 @@ static int32_t insertChildTableBatch(TAOS* taos, char* cTableName, SArray* cols
}
code = taos_stmt_execute(stmt);
if (code != 0) {
printf("%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) {
printf("%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.
先完成此消息的编辑!
想要评论请 注册