fix/TS-5805-check-arb-add-column

This commit is contained in:
dmchen 2025-02-10 06:57:50 +00:00
parent 946a0c1bb5
commit b1dc31a2bd
4 changed files with 37 additions and 14 deletions

View File

@ -73,8 +73,8 @@ static const SSysDbTableSchema arbGroupsSchema[] = {
{.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true}, {.name = "vgroup_id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
{.name = "v1_dnode", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true}, {.name = "v1_dnode", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true},
{.name = "v2_dnode", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true}, {.name = "v2_dnode", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true},
{.name = "is_sync", .bytes = 100, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "is_sync", .bytes = 6, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
//{.name = "sync_code", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true}, {.name = "check_sync_code", .bytes = 100, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
{.name = "assigned_dnode", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true}, {.name = "assigned_dnode", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true},
{.name = "assigned_token", .bytes = TSDB_ARB_TOKEN_SIZE + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, {.name = "assigned_token", .bytes = TSDB_ARB_TOKEN_SIZE + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
{.name = "assigned_acked", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true}, {.name = "assigned_acked", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true},

View File

@ -1355,13 +1355,11 @@ static int32_t mndRetrieveArbGroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
mInfo("vgId:%d, arb group sync:%d, code:%d, update time:%" PRId64, pGroup->vgId, pGroup->isSync, pGroup->code, mInfo("vgId:%d, arb group sync:%d, code:%d, update time:%" PRId64, pGroup->vgId, pGroup->isSync, pGroup->code,
pGroup->updateTimeMs); pGroup->updateTimeMs);
char strSync[100] = {0}; char strSync[6] = {0};
char bufUpdateTime[40] = {0};
(void)formatTimestamp(bufUpdateTime, pGroup->updateTimeMs, TSDB_TIME_PRECISION_MILLI);
if (pGroup->isSync == 1) { if (pGroup->isSync == 1) {
tsnprintf(strSync, 100, "true(code:%d,%s)", pGroup->code, bufUpdateTime); tsnprintf(strSync, 6, "true");
} else { } else {
tsnprintf(strSync, 100, "false(code:%d,%s)", 100, pGroup->code, bufUpdateTime); tsnprintf(strSync, 6, "false");
} }
char sync[100 + VARSTR_HEADER_SIZE] = {0}; char sync[100 + VARSTR_HEADER_SIZE] = {0};
@ -1369,6 +1367,16 @@ static int32_t mndRetrieveArbGroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)sync, false), pGroup, &lino, _OVER); RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)sync, false), pGroup, &lino, _OVER);
char strCheckSyncCode[100] = {0};
char bufUpdateTime[40] = {0};
(void)formatTimestamp(bufUpdateTime, pGroup->updateTimeMs, TSDB_TIME_PRECISION_MILLI);
tsnprintf(strCheckSyncCode, 100, "%d(%s)", pGroup->code, bufUpdateTime);
char checkSyncCode[100 + VARSTR_HEADER_SIZE] = {0};
STR_WITH_MAXSIZE_TO_VARSTR(checkSyncCode, strCheckSyncCode, 100 + VARSTR_HEADER_SIZE);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)checkSyncCode, false), pGroup, &lino, _OVER);
if (pGroup->assignedLeader.dnodeId != 0) { if (pGroup->assignedLeader.dnodeId != 0) {
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pGroup->assignedLeader.dnodeId, false), RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pGroup->assignedLeader.dnodeId, false),

View File

@ -40,14 +40,17 @@ class TDTestCase(TBase):
while count < 100: while count < 100:
tdSql.query("show arbgroups;") tdSql.query("show arbgroups;")
if tdSql.getData(0, 4) == 1: if tdSql.getData(0, 4) == 'true':
break break
tdLog.info("wait 1 seconds for is sync") tdLog.info("wait %d seconds for is sync"%count)
time.sleep(1) time.sleep(1)
count += 1 count += 1
if count == 100:
tdLog.exit("arbgroup sync failed")
return
tdSql.query("show db.vgroups;") tdSql.query("show db.vgroups;")
@ -67,11 +70,15 @@ class TDTestCase(TBase):
if(tdSql.getData(0, 4) == "assigned ") or (tdSql.getData(0, 6) == "assigned "): if(tdSql.getData(0, 4) == "assigned ") or (tdSql.getData(0, 6) == "assigned "):
break break
tdLog.info("wait 1 seconds for set assigned") tdLog.info("wait %d seconds for set assigned"%count)
time.sleep(1) time.sleep(1)
count += 1 count += 1
if count == 100:
tdLog.exit("check assigned failed")
return
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success(f"{__file__} successfully executed") tdLog.success(f"{__file__} successfully executed")

View File

@ -46,14 +46,18 @@ class TDTestCase(TBase):
while count < 100: while count < 100:
tdSql.query("show arbgroups;") tdSql.query("show arbgroups;")
if tdSql.getData(0, 4) == 1: if tdSql.getData(0, 4) == 'true':
break break
tdLog.info("wait 1 seconds for is sync") tdLog.info("wait %d seconds for is sync"%count)
time.sleep(1) time.sleep(1)
count += 1 count += 1
if count == 100:
tdLog.exit("arbgroup sync failed")
return
tdSql.query("show db.vgroups;") tdSql.query("show db.vgroups;")
@ -73,11 +77,15 @@ class TDTestCase(TBase):
if(tdSql.getData(0, 4) == "assigned ") or (tdSql.getData(0, 6) == "assigned "): if(tdSql.getData(0, 4) == "assigned ") or (tdSql.getData(0, 6) == "assigned "):
break break
tdLog.info("wait 1 seconds for set assigned") tdLog.info("wait %d seconds for set assigned"%count)
time.sleep(1) time.sleep(1)
count += 1 count += 1
if count == 100:
tdLog.exit("check assigned failed")
return
tdSql.execute("INSERT INTO d0 VALUES (NOW, 10.3, 219, 0.31);") tdSql.execute("INSERT INTO d0 VALUES (NOW, 10.3, 219, 0.31);")
def stop(self): def stop(self):