提交 fe96d9dc 编写于 作者: S Shengliang Guan

Add fields to acct

上级 d3927b54
...@@ -160,8 +160,14 @@ typedef struct { ...@@ -160,8 +160,14 @@ typedef struct {
typedef struct { typedef struct {
int32_t maxUsers; int32_t maxUsers;
int32_t maxDbs; int32_t maxDbs;
int32_t maxStbs;
int32_t maxTbs;
int32_t maxTimeSeries; int32_t maxTimeSeries;
int32_t maxStreams; int32_t maxStreams;
int32_t maxFuncs;
int32_t maxConsumers;
int32_t maxConns;
int32_t maxTopics;
int64_t maxStorage; // In unit of GB int64_t maxStorage; // In unit of GB
int32_t accessState; // Configured only by command int32_t accessState; // Configured only by command
} SAcctCfg; } SAcctCfg;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "mndShow.h" #include "mndShow.h"
#define TSDB_ACCT_VER_NUMBER 1 #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 int32_t mndCreateDefaultAcct(SMnode *pMnode);
static SSdbRaw *mndAcctActionEncode(SAcctObj *pAcct); static SSdbRaw *mndAcctActionEncode(SAcctObj *pAcct);
...@@ -55,10 +55,16 @@ static int32_t mndCreateDefaultAcct(SMnode *pMnode) { ...@@ -55,10 +55,16 @@ static int32_t mndCreateDefaultAcct(SMnode *pMnode) {
acctObj.createdTime = taosGetTimestampMs(); acctObj.createdTime = taosGetTimestampMs();
acctObj.updateTime = acctObj.createdTime; acctObj.updateTime = acctObj.createdTime;
acctObj.acctId = 1; acctObj.acctId = 1;
acctObj.cfg = (SAcctCfg){.maxUsers = 1024, acctObj.cfg = (SAcctCfg){.maxUsers = INT32_MAX,
.maxDbs = 1024, .maxDbs = INT32_MAX,
.maxStbs = INT32_MAX,
.maxTbs = INT32_MAX,
.maxTimeSeries = 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, .maxStorage = INT64_MAX,
.accessState = TSDB_VN_ALL_ACCCESS}; .accessState = TSDB_VN_ALL_ACCCESS};
...@@ -84,8 +90,14 @@ static SSdbRaw *mndAcctActionEncode(SAcctObj *pAcct) { ...@@ -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->status, ACCT_ENCODE_OVER)
SDB_SET_INT32(pRaw, dataPos, pAcct->cfg.maxUsers, 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.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.maxTimeSeries, ACCT_ENCODE_OVER)
SDB_SET_INT32(pRaw, dataPos, pAcct->cfg.maxStreams, 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_INT64(pRaw, dataPos, pAcct->cfg.maxStorage, ACCT_ENCODE_OVER)
SDB_SET_INT32(pRaw, dataPos, pAcct->cfg.accessState, 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) SDB_SET_RESERVE(pRaw, dataPos, TSDB_ACCT_RESERVE_SIZE, ACCT_ENCODE_OVER)
...@@ -129,8 +141,14 @@ static SSdbRow *mndAcctActionDecode(SSdbRaw *pRaw) { ...@@ -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->status, ACCT_DECODE_OVER)
SDB_GET_INT32(pRaw, dataPos, &pAcct->cfg.maxUsers, 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.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.maxTimeSeries, ACCT_DECODE_OVER)
SDB_GET_INT32(pRaw, dataPos, &pAcct->cfg.maxStreams, 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_INT64(pRaw, dataPos, &pAcct->cfg.maxStorage, ACCT_DECODE_OVER)
SDB_GET_INT32(pRaw, dataPos, &pAcct->cfg.accessState, 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) 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 ...@@ -163,7 +181,7 @@ static int32_t mndAcctActionUpdate(SSdb *pSdb, SAcctObj *pOldAcct, SAcctObj *pNe
pOldAcct->updateTime = pNewAcct->updateTime; pOldAcct->updateTime = pNewAcct->updateTime;
pOldAcct->status = pNewAcct->status; pOldAcct->status = pNewAcct->status;
memcpy(&pOldAcct->cfg, &pNewAcct->cfg, sizeof(SAcctInfo)); memcpy(&pOldAcct->cfg, &pNewAcct->cfg, sizeof(SAcctCfg));
return 0; return 0;
} }
......
...@@ -89,7 +89,7 @@ FUNC_ENCODE_OVER: ...@@ -89,7 +89,7 @@ FUNC_ENCODE_OVER:
return NULL; 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; return pRaw;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册