From fe96d9dcf4071def467782a445fa3a0e286040b2 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 30 Dec 2021 22:32:59 -0800 Subject: [PATCH] Add fields to acct --- source/dnode/mnode/impl/inc/mndDef.h | 6 ++++++ source/dnode/mnode/impl/src/mndAcct.c | 28 ++++++++++++++++++++++----- source/dnode/mnode/impl/src/mndFunc.c | 2 +- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index e26c0c5ae7..267a3f6cf5 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -160,8 +160,14 @@ typedef struct { typedef struct { int32_t maxUsers; int32_t maxDbs; + int32_t maxStbs; + int32_t maxTbs; int32_t maxTimeSeries; int32_t maxStreams; + int32_t maxFuncs; + int32_t maxConsumers; + int32_t maxConns; + int32_t maxTopics; int64_t maxStorage; // In unit of GB int32_t accessState; // Configured only by command } SAcctCfg; diff --git a/source/dnode/mnode/impl/src/mndAcct.c b/source/dnode/mnode/impl/src/mndAcct.c index ae8ffea4ea..2847d19bea 100644 --- a/source/dnode/mnode/impl/src/mndAcct.c +++ b/source/dnode/mnode/impl/src/mndAcct.c @@ -18,7 +18,7 @@ #include "mndShow.h" #define TSDB_ACCT_VER_NUMBER 1 -#define TSDB_ACCT_RESERVE_SIZE 64 +#define TSDB_ACCT_RESERVE_SIZE 128 static int32_t mndCreateDefaultAcct(SMnode *pMnode); static SSdbRaw *mndAcctActionEncode(SAcctObj *pAcct); @@ -55,10 +55,16 @@ static int32_t mndCreateDefaultAcct(SMnode *pMnode) { acctObj.createdTime = taosGetTimestampMs(); acctObj.updateTime = acctObj.createdTime; acctObj.acctId = 1; - acctObj.cfg = (SAcctCfg){.maxUsers = 1024, - .maxDbs = 1024, + acctObj.cfg = (SAcctCfg){.maxUsers = INT32_MAX, + .maxDbs = INT32_MAX, + .maxStbs = INT32_MAX, + .maxTbs = INT32_MAX, .maxTimeSeries = INT32_MAX, - .maxStreams = 8092, + .maxStreams = INT32_MAX, + .maxFuncs = INT32_MAX, + .maxConsumers = INT32_MAX, + .maxConns = INT32_MAX, + .maxTopics = INT32_MAX, .maxStorage = INT64_MAX, .accessState = TSDB_VN_ALL_ACCCESS}; @@ -84,8 +90,14 @@ static SSdbRaw *mndAcctActionEncode(SAcctObj *pAcct) { SDB_SET_INT32(pRaw, dataPos, pAcct->status, ACCT_ENCODE_OVER) SDB_SET_INT32(pRaw, dataPos, pAcct->cfg.maxUsers, ACCT_ENCODE_OVER) SDB_SET_INT32(pRaw, dataPos, pAcct->cfg.maxDbs, ACCT_ENCODE_OVER) + SDB_SET_INT32(pRaw, dataPos, pAcct->cfg.maxStbs, ACCT_ENCODE_OVER) + SDB_SET_INT32(pRaw, dataPos, pAcct->cfg.maxTbs, ACCT_ENCODE_OVER) SDB_SET_INT32(pRaw, dataPos, pAcct->cfg.maxTimeSeries, ACCT_ENCODE_OVER) SDB_SET_INT32(pRaw, dataPos, pAcct->cfg.maxStreams, ACCT_ENCODE_OVER) + SDB_SET_INT32(pRaw, dataPos, pAcct->cfg.maxFuncs, ACCT_ENCODE_OVER) + SDB_SET_INT32(pRaw, dataPos, pAcct->cfg.maxConsumers, ACCT_ENCODE_OVER) + SDB_SET_INT32(pRaw, dataPos, pAcct->cfg.maxConns, ACCT_ENCODE_OVER) + SDB_SET_INT32(pRaw, dataPos, pAcct->cfg.maxTopics, ACCT_ENCODE_OVER) SDB_SET_INT64(pRaw, dataPos, pAcct->cfg.maxStorage, ACCT_ENCODE_OVER) SDB_SET_INT32(pRaw, dataPos, pAcct->cfg.accessState, ACCT_ENCODE_OVER) SDB_SET_RESERVE(pRaw, dataPos, TSDB_ACCT_RESERVE_SIZE, ACCT_ENCODE_OVER) @@ -129,8 +141,14 @@ static SSdbRow *mndAcctActionDecode(SSdbRaw *pRaw) { SDB_GET_INT32(pRaw, dataPos, &pAcct->status, ACCT_DECODE_OVER) SDB_GET_INT32(pRaw, dataPos, &pAcct->cfg.maxUsers, ACCT_DECODE_OVER) SDB_GET_INT32(pRaw, dataPos, &pAcct->cfg.maxDbs, ACCT_DECODE_OVER) + SDB_GET_INT32(pRaw, dataPos, &pAcct->cfg.maxStbs, ACCT_DECODE_OVER) + SDB_GET_INT32(pRaw, dataPos, &pAcct->cfg.maxTbs, ACCT_DECODE_OVER) SDB_GET_INT32(pRaw, dataPos, &pAcct->cfg.maxTimeSeries, ACCT_DECODE_OVER) SDB_GET_INT32(pRaw, dataPos, &pAcct->cfg.maxStreams, ACCT_DECODE_OVER) + SDB_GET_INT32(pRaw, dataPos, &pAcct->cfg.maxFuncs, ACCT_DECODE_OVER) + SDB_GET_INT32(pRaw, dataPos, &pAcct->cfg.maxConsumers, ACCT_DECODE_OVER) + SDB_GET_INT32(pRaw, dataPos, &pAcct->cfg.maxConns, ACCT_DECODE_OVER) + SDB_GET_INT32(pRaw, dataPos, &pAcct->cfg.maxTopics, ACCT_DECODE_OVER) SDB_GET_INT64(pRaw, dataPos, &pAcct->cfg.maxStorage, ACCT_DECODE_OVER) SDB_GET_INT32(pRaw, dataPos, &pAcct->cfg.accessState, ACCT_DECODE_OVER) SDB_GET_RESERVE(pRaw, dataPos, TSDB_ACCT_RESERVE_SIZE, ACCT_DECODE_OVER) @@ -163,7 +181,7 @@ static int32_t mndAcctActionUpdate(SSdb *pSdb, SAcctObj *pOldAcct, SAcctObj *pNe pOldAcct->updateTime = pNewAcct->updateTime; pOldAcct->status = pNewAcct->status; - memcpy(&pOldAcct->cfg, &pNewAcct->cfg, sizeof(SAcctInfo)); + memcpy(&pOldAcct->cfg, &pNewAcct->cfg, sizeof(SAcctCfg)); return 0; } diff --git a/source/dnode/mnode/impl/src/mndFunc.c b/source/dnode/mnode/impl/src/mndFunc.c index 57c94fe5db..f7a39ce9e5 100644 --- a/source/dnode/mnode/impl/src/mndFunc.c +++ b/source/dnode/mnode/impl/src/mndFunc.c @@ -89,7 +89,7 @@ FUNC_ENCODE_OVER: return NULL; } - mTrace("func:%d, encode to raw:%p, row:%p", pFunc->name, pRaw, pFunc); + mTrace("func:%s, encode to raw:%p, row:%p", pFunc->name, pRaw, pFunc); return pRaw; } -- GitLab