From d128c3927ddcea1c42e423e69919cfdb6603de2d Mon Sep 17 00:00:00 2001 From: dmchen Date: Wed, 12 Feb 2025 02:04:13 +0000 Subject: [PATCH] fix/TS-5805-check-arb-fix-comment --- source/common/src/systable.c | 2 +- source/dnode/mnode/impl/src/mndArbGroup.c | 17 ++++------------- tests/army/cluster/arbgroup_sync.py | 2 +- tests/army/cluster/arbitrator.py | 2 +- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/source/common/src/systable.c b/source/common/src/systable.c index bc2c52e570..4deb1bba24 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -73,7 +73,7 @@ static const SSysDbTableSchema arbGroupsSchema[] = { {.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 = "v2_dnode", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true}, - {.name = "is_sync", .bytes = 6, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, + {.name = "is_sync", .bytes = 1, .type = TSDB_DATA_TYPE_BOOL, .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_token", .bytes = TSDB_ARB_TOKEN_SIZE + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, diff --git a/source/dnode/mnode/impl/src/mndArbGroup.c b/source/dnode/mnode/impl/src/mndArbGroup.c index 03aeb2e0c0..aa893b667a 100644 --- a/source/dnode/mnode/impl/src/mndArbGroup.c +++ b/source/dnode/mnode/impl/src/mndArbGroup.c @@ -1352,25 +1352,16 @@ static int32_t mndRetrieveArbGroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock &lino, _OVER); } - mInfo("vgId:%d, arb group sync:%d, code:%d, update time:%" PRId64, pGroup->vgId, pGroup->isSync, pGroup->code, - pGroup->updateTimeMs); + mInfo("vgId:%d, arb group sync:%d, code:%s, update time:%" PRId64, pGroup->vgId, pGroup->isSync, + tstrerror(pGroup->code), pGroup->updateTimeMs); - char strSync[6] = {0}; - if (pGroup->isSync == 1) { - tsnprintf(strSync, 6, "true"); - } else { - tsnprintf(strSync, 6, "false"); - } - - char sync[100 + VARSTR_HEADER_SIZE] = {0}; - STR_WITH_MAXSIZE_TO_VARSTR(sync, strSync, 100 + VARSTR_HEADER_SIZE); 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 *)&pGroup->isSync, 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); + tsnprintf(strCheckSyncCode, 100, "%s(%s)", tstrerror(pGroup->code), bufUpdateTime); char checkSyncCode[100 + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(checkSyncCode, strCheckSyncCode, 100 + VARSTR_HEADER_SIZE); diff --git a/tests/army/cluster/arbgroup_sync.py b/tests/army/cluster/arbgroup_sync.py index 9152263a59..ccf45d2dc9 100644 --- a/tests/army/cluster/arbgroup_sync.py +++ b/tests/army/cluster/arbgroup_sync.py @@ -40,7 +40,7 @@ class TDTestCase(TBase): while count < 100: tdSql.query("show arbgroups;") - if tdSql.getData(0, 4) == 'true': + if tdSql.getData(0, 4) == True: break tdLog.info("wait %d seconds for is sync"%count) diff --git a/tests/army/cluster/arbitrator.py b/tests/army/cluster/arbitrator.py index 947397b395..98881c5fc4 100644 --- a/tests/army/cluster/arbitrator.py +++ b/tests/army/cluster/arbitrator.py @@ -46,7 +46,7 @@ class TDTestCase(TBase): while count < 100: tdSql.query("show arbgroups;") - if tdSql.getData(0, 4) == 'true': + if tdSql.getData(0, 4) == True: break tdLog.info("wait %d seconds for is sync"%count)