This commit is contained in:
Shengliang Guan 2020-10-27 14:16:26 +00:00
parent 5b4dc831d6
commit dab726abe9
1 changed files with 10 additions and 1 deletions

View File

@ -273,6 +273,8 @@ static void sdbConfirmForward(void *ahandle, void *param, int32_t code) {
tstrerror(code));
}
if (((SSdbTable *)pOper->table)->tableId == SDB_TABLE_CTABLE)
pOper->retCode = TSDB_CODE_MND_APP_ERROR;
// failed to forward, need revert insert
if (pOper->retCode != TSDB_CODE_SUCCESS) {
SWalHead *pHead = (void *)pOper + sizeof(SSdbOper) + SDB_SYNC_HACK;
@ -281,7 +283,14 @@ static void sdbConfirmForward(void *ahandle, void *param, int32_t code) {
((SSdbTable *)pOper->table)->tableName, pOper->pObj, sdbGetKeyStr(pOper->table, pHead->cont),
pHead->version, action, tstrerror(pOper->retCode));
if (action == SDB_ACTION_INSERT) {
sdbDeleteHash(pOper->table, pOper);
// It's better to create a table in two stages, create it first and then set it success
//sdbDeleteHash(pOper->table, pOper);
SSdbOper oper = {
.type = SDB_OPER_GLOBAL,
.table = pOper->table,
.pObj = pOper->pObj
};
sdbDeleteRow(&oper);
}
}