Merge pull request #20306 from taosdata/feat/add-reboot-time

feat/add-reboot-time
This commit is contained in:
Shengliang Guan 2023-03-08 15:46:55 +08:00 committed by GitHub
commit 1439bdcd36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 25 deletions

View File

@ -33,6 +33,7 @@ static const SSysDbTableSchema dnodesSchema[] = {
{.name = "support_vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true},
{.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
{.name = "reboot_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
{.name = "note", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
};
@ -42,6 +43,7 @@ static const SSysDbTableSchema mnodesSchema[] = {
{.name = "role", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
{.name = "status", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
{.name = "reboot_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
};
static const SSysDbTableSchema modulesSchema[] = {

View File

@ -1074,6 +1074,9 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->createdTime, false);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->rebootTime, false);
char *b = taosMemoryCalloc(VARSTR_HEADER_SIZE + strlen(offlineReason[pDnode->offlineReason]) + 1, 1);
STR_TO_VARSTR(b, online ? "" : offlineReason[pDnode->offlineReason]);

View File

@ -644,6 +644,9 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->createdTime, false);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->stateStartTime, false);
numOfRows++;
sdbRelease(pSdb, pObj);
}

View File

@ -8,10 +8,10 @@ sql connect
sql create dnode $hostname port 7200
sql select * from information_schema.ins_dnodes
print dnode1 off: $data(1)[6]
print dnode2 off: $data(2)[6]
print dnode1 off: $data(1)[7]
print dnode2 off: $data(2)[7]
if $data(2)[6] != @status not received@ then
if $data(2)[7] != @status not received@ then
return -1
endi
@ -50,9 +50,9 @@ step3:
return -1
endi
sql select * from information_schema.ins_dnodes
print dnode1 off: $data(1)[6]
print dnode2 off: $data(2)[6]
if $data(2)[6] != @status msg timeout@ then
print dnode1 off: $data(1)[7]
print dnode2 off: $data(2)[7]
if $data(2)[7] != @status msg timeout@ then
goto step3
endi
@ -77,9 +77,9 @@ step5:
endi
sql select * from information_schema.ins_dnodes
print dnode1 off: $data(1)[6]
print dnode2 off: $data(3)[6]
if $data(3)[6] != @dnodeId not match@ then
print dnode1 off: $data(1)[7]
print dnode2 off: $data(3)[7]
if $data(3)[7] != @dnodeId not match@ then
goto step5
endi
@ -98,10 +98,10 @@ step6:
endi
sql select * from information_schema.ins_dnodes
print dnode1 off: $data(1)[6]
print dnode2 off: $data(3)[6]
print dnode3 off: $data(4)[6]
if $data(4)[6] != @interval not match@ then
print dnode1 off: $data(1)[7]
print dnode2 off: $data(3)[7]
print dnode3 off: $data(4)[67
if $data(4)[7] != @interval not match@ then
goto step6
endi
@ -120,11 +120,11 @@ step7:
endi
sql select * from information_schema.ins_dnodes
print dnode1 off: $data(1)[6]
print dnode3 off: $data(3)[6]
print dnode4 off: $data(4)[6]
print dnode5 off: $data(5)[6]
if $data(5)[6] != @locale not match@ then
print dnode1 off: $data(1)[7]
print dnode3 off: $data(3)[7]
print dnode4 off: $data(4)[7]
print dnode5 off: $data(5)[7]
if $data(5)[7] != @locale not match@ then
goto step7
endi
@ -143,12 +143,12 @@ step8:
endi
sql select * from information_schema.ins_dnodes
print dnode1 off: $data(1)[6]
print dnode3 off: $data(3)[6]
print dnode4 off: $data(4)[6]
print dnode5 off: $data(5)[6]
print dnode6 off: $data(6)[6]
if $data(6)[6] != @charset not match@ then
print dnode1 off: $data(1)[7]
print dnode3 off: $data(3)[7]
print dnode4 off: $data(4)[7]
print dnode5 off: $data(5)[7]
print dnode6 off: $data(6)[7]
if $data(6)[7] != @charset not match@ then
goto step8
endi

View File

@ -22,7 +22,7 @@ class TDTestCase:
tdSql.execute("insert into db.ctb using db.stb tags(1) (ts, c1) values (now, 1)")
tdSql.query("select count(*) from information_schema.ins_columns")
tdSql.checkData(0, 0, 269)
tdSql.checkData(0, 0, 271)
tdSql.query("select * from information_schema.ins_columns where table_name = 'ntb'")
tdSql.checkRows(14)