fix/insert-when-2-replicas

This commit is contained in:
dmchen 2025-01-17 04:12:57 +00:00
parent afb3a5b90c
commit 2312ed4c28
2 changed files with 10 additions and 1 deletions

View File

@ -3428,7 +3428,8 @@ _out:;
ths->pLogBuf->matchIndex, ths->pLogBuf->endIndex); ths->pLogBuf->matchIndex, ths->pLogBuf->endIndex);
if (code == 0 && ths->state == TAOS_SYNC_STATE_ASSIGNED_LEADER) { if (code == 0 && ths->state == TAOS_SYNC_STATE_ASSIGNED_LEADER) {
TAOS_CHECK_RETURN(syncNodeUpdateAssignedCommitIndex(ths, matchIndex)); int64_t index = syncNodeUpdateAssignedCommitIndex(ths, matchIndex);
sTrace("vgId:%d, update assigned commit index %" PRId64 "", ths->vgId, index);
if (ths->fsmState != SYNC_FSM_STATE_INCOMPLETE && if (ths->fsmState != SYNC_FSM_STATE_INCOMPLETE &&
syncLogBufferCommit(ths->pLogBuf, ths, ths->assignedCommitIndex) < 0) { syncLogBufferCommit(ths->pLogBuf, ths, ths->assignedCommitIndex) < 0) {

View File

@ -35,6 +35,12 @@ class TDTestCase(TBase):
time.sleep(1) time.sleep(1)
tdSql.execute("use db;")
tdSql.execute("CREATE STABLE meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupId int);")
tdSql.execute("CREATE TABLE d0 USING meters TAGS (\"California.SanFrancisco\", 2);");
count = 0 count = 0
while count < 100: while count < 100:
@ -72,6 +78,8 @@ class TDTestCase(TBase):
count += 1 count += 1
tdSql.execute("INSERT INTO d0 VALUES (NOW, 10.3, 219, 0.31);")
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success(f"{__file__} successfully executed") tdLog.success(f"{__file__} successfully executed")