enh: support display unlimited for expiration time
This commit is contained in:
parent
c3abd9d554
commit
7c429e5799
|
@ -28,12 +28,13 @@ extern "C" {
|
||||||
#define GRANTS_COL_MAX_LEN 196
|
#define GRANTS_COL_MAX_LEN 196
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GRANT_HEART_BEAT_MIN 2
|
#define GRANT_HEART_BEAT_MIN 2
|
||||||
#define GRANT_UNIQ_UNLIMITED (-1)
|
#define GRANT_MAX_EXPIRE_SEC (31556995201)
|
||||||
#define GRANT_ACTIVE_CODE "activeCode"
|
#define GRANT_EXPIRE_UNLIMITED(v) ((v) == GRANT_MAX_EXPIRE_SEC)
|
||||||
#define GRANT_FLAG_ALL (0x01)
|
#define GRANT_ACTIVE_CODE "activeCode"
|
||||||
#define GRANT_FLAG_AUDIT (0x02)
|
#define GRANT_FLAG_ALL (0x01)
|
||||||
#define GRANT_FLAG_VIEW (0x04)
|
#define GRANT_FLAG_AUDIT (0x02)
|
||||||
|
#define GRANT_FLAG_VIEW (0x04)
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
TSDB_GRANT_ALL,
|
TSDB_GRANT_ALL,
|
||||||
|
|
|
@ -100,7 +100,7 @@ typedef struct {
|
||||||
} SSyncMgmt;
|
} SSyncMgmt;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t expireTimeSec;
|
int64_t expireTimeMS;
|
||||||
int64_t timeseriesAllowed;
|
int64_t timeseriesAllowed;
|
||||||
} SGrantInfo;
|
} SGrantInfo;
|
||||||
|
|
||||||
|
|
|
@ -312,17 +312,16 @@ static int32_t mndRetrieveClusters(SRpcMsg *pMsg, SShowObj *pShow, SSDataBlock *
|
||||||
|
|
||||||
char expireTime[25] = {0};
|
char expireTime[25] = {0};
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
|
||||||
if (tsExpireTime <= 0) {
|
if (GRANT_EXPIRE_UNLIMITED(tsExpireTime / 1000)) {
|
||||||
if (tsExpireTime == GRANT_UNIQ_UNLIMITED) {
|
STR_WITH_MAXSIZE_TO_VARSTR(expireTime, "unlimited", pShow->pMeta->pSchemas[cols].bytes);
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(expireTime, "unlimited", pShow->pMeta->pSchemas[cols].bytes);
|
colDataSetVal(pColInfo, numOfRows, expireTime, false);
|
||||||
colDataSetVal(pColInfo, numOfRows, expireTime, false);
|
} else if (tsExpireTime <= 0) {
|
||||||
} else {
|
colDataSetNULL(pColInfo, numOfRows);
|
||||||
colDataSetNULL(pColInfo, numOfRows);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
char ts[20] = {0};
|
char ts[20] = {0};
|
||||||
|
time_t expireSec = tsExpireTime / 1000;
|
||||||
struct tm ptm;
|
struct tm ptm;
|
||||||
if (taosLocalTime(&tsExpireTime, &ptm, ts) != NULL) {
|
if (taosLocalTime(&expireSec, &ptm, ts) != NULL) {
|
||||||
strftime(ts, 20, "%Y-%m-%d %H:%M:%S", &ptm);
|
strftime(ts, 20, "%Y-%m-%d %H:%M:%S", &ptm);
|
||||||
} else {
|
} else {
|
||||||
ts[0] = 0;
|
ts[0] = 0;
|
||||||
|
|
|
@ -1028,11 +1028,9 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
|
||||||
}
|
}
|
||||||
|
|
||||||
// grant info
|
// grant info
|
||||||
pGrantInfo->expire_time = pMnode->grant.expireTimeSec == GRANT_UNIQ_UNLIMITED
|
pGrantInfo->expire_time = (pMnode->grant.expireTimeMS - ms) / 1000;
|
||||||
? GRANT_UNIQ_UNLIMITED
|
|
||||||
: (pMnode->grant.expireTimeSec - ms / 1000);
|
|
||||||
pGrantInfo->timeseries_total = pMnode->grant.timeseriesAllowed;
|
pGrantInfo->timeseries_total = pMnode->grant.timeseriesAllowed;
|
||||||
if (pMnode->grant.expireTimeSec == 0) {
|
if (pMnode->grant.expireTimeMS == 0) {
|
||||||
pGrantInfo->expire_time = 0;
|
pGrantInfo->expire_time = 0;
|
||||||
pGrantInfo->timeseries_total = 0;
|
pGrantInfo->timeseries_total = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue