diff --git a/include/common/tgrant.h b/include/common/tgrant.h index b707045bd1..fc1e45fb2a 100644 --- a/include/common/tgrant.h +++ b/include/common/tgrant.h @@ -29,6 +29,7 @@ extern "C" { #endif #define GRANT_HEART_BEAT_MIN 2 +#define GRANT_UNIQ_UNLIMITED (-1) #define GRANT_ACTIVE_CODE "activeCode" #define GRANT_FLAG_ALL (0x01) #define GRANT_FLAG_AUDIT (0x02) diff --git a/source/common/src/systable.c b/source/common/src/systable.c index 6558df1fc1..35f2908968 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -85,7 +85,7 @@ static const SSysDbTableSchema clusterSchema[] = { {.name = "uptime", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true}, {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true}, {.name = "version", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, - {.name = "expire_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true}, + {.name = "expire_time", .bytes = 19 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true}, }; static const SSysDbTableSchema userDBSchema[] = { diff --git a/source/dnode/mnode/impl/inc/mndInt.h b/source/dnode/mnode/impl/inc/mndInt.h index 2da14c65d2..0c446182a6 100644 --- a/source/dnode/mnode/impl/inc/mndInt.h +++ b/source/dnode/mnode/impl/inc/mndInt.h @@ -100,7 +100,7 @@ typedef struct { } SSyncMgmt; typedef struct { - int64_t expireTimeMS; + int64_t expireTimeSec; int64_t timeseriesAllowed; } SGrantInfo; diff --git a/source/dnode/mnode/impl/src/mndCluster.c b/source/dnode/mnode/impl/src/mndCluster.c index f2b279276e..ca7544877c 100644 --- a/source/dnode/mnode/impl/src/mndCluster.c +++ b/source/dnode/mnode/impl/src/mndCluster.c @@ -310,11 +310,25 @@ static int32_t mndRetrieveClusters(SRpcMsg *pMsg, SShowObj *pShow, SSDataBlock * pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)ver, false); - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + char expireTime[25] = {0}; + pColInfo = taosArrayGet(pBlock->pDataBlock, cols); if (tsExpireTime <= 0) { - colDataSetNULL(pColInfo, numOfRows); + if (tsExpireTime == GRANT_UNIQ_UNLIMITED) { + STR_WITH_MAXSIZE_TO_VARSTR(expireTime, "unlimited", pShow->pMeta->pSchemas[cols].bytes); + colDataSetVal(pColInfo, numOfRows, expireTime, false); + } else { + colDataSetNULL(pColInfo, numOfRows); + } } else { - colDataSetVal(pColInfo, numOfRows, (const char *)&tsExpireTime, false); + char ts[20] = {0}; + struct tm ptm; + if (taosLocalTime(&tsExpireTime, &ptm, ts) != NULL) { + strftime(ts, 20, "%Y-%m-%d %H:%M:%S", &ptm); + } else { + ts[0] = 0; + } + STR_WITH_MAXSIZE_TO_VARSTR(expireTime, ts, pShow->pMeta->pSchemas[cols].bytes); + colDataSetVal(pColInfo, numOfRows, expireTime, false); } sdbRelease(pSdb, pCluster); diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index cad8c6d745..7c8ef2f0b7 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -1028,9 +1028,11 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr } // grant info - pGrantInfo->expire_time = (pMnode->grant.expireTimeMS - ms) / 1000; + pGrantInfo->expire_time = pMnode->grant.expireTimeSec == GRANT_UNIQ_UNLIMITED + ? GRANT_UNIQ_UNLIMITED + : (pMnode->grant.expireTimeSec - ms / 1000); pGrantInfo->timeseries_total = pMnode->grant.timeseriesAllowed; - if (pMnode->grant.expireTimeMS == 0) { + if (pMnode->grant.expireTimeSec == 0) { pGrantInfo->expire_time = 0; pGrantInfo->timeseries_total = 0; }