From 9673e0edf25a33404966046d1229e516493fb637 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 15 Dec 2021 13:22:04 +0800 Subject: [PATCH] minor changes --- include/common/taosmsg.h | 16 +++++++++++----- source/dnode/mnode/impl/inc/mndDef.h | 3 +-- source/dnode/mnode/impl/src/mndDb.c | 2 +- source/dnode/mnode/impl/src/mndDnode.c | 1 + source/dnode/mnode/impl/src/mndUser.c | 5 +---- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/include/common/taosmsg.h b/include/common/taosmsg.h index a75c4a7bac..2dc08e85da 100644 --- a/include/common/taosmsg.h +++ b/include/common/taosmsg.h @@ -389,17 +389,20 @@ typedef struct { int32_t maxDbs; int32_t maxTimeSeries; int32_t maxStreams; - int64_t maxStorage; // In unit of GB int32_t accessState; // Configured only by command + int64_t maxStorage; // In unit of GB + int32_t reserve[8]; } SCreateAcctMsg, SAlterAcctMsg; typedef struct { - char user[TSDB_USER_LEN]; + char user[TSDB_USER_LEN]; + int32_t reserve[8]; } SDropUserMsg, SDropAcctMsg; typedef struct { - char user[TSDB_USER_LEN]; - char pass[TSDB_PASSWORD_LEN]; + char user[TSDB_USER_LEN]; + char pass[TSDB_PASSWORD_LEN]; + int32_t reserve[8]; } SCreateUserMsg, SAlterUserMsg; typedef struct { @@ -876,16 +879,19 @@ typedef struct SShowRsp { } SShowRsp; typedef struct { - char ep[TSDB_EP_LEN]; // end point, hostname:port + char ep[TSDB_EP_LEN]; // end point, hostname:port + int32_t reserve[8]; } SCreateDnodeMsg; typedef struct { int32_t dnodeId; + int32_t reserve[8]; } SDropDnodeMsg; typedef struct { int32_t dnodeId; char config[TSDB_DNODE_CONFIG_LEN]; + int32_t reserve[8]; } SCfgDnodeMsg; typedef struct { diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index e86ab1c448..30c18d3e18 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -45,7 +45,6 @@ extern int32_t mDebugFlag; typedef struct SClusterObj SClusterObj; typedef struct SMnodeObj SMnodeObj; typedef struct SAcctObj SAcctObj; -typedef struct SDbObj SDbObj; typedef struct SVgObj SVgObj; typedef struct SFuncObj SFuncObj; typedef struct SOperObj SOperObj; @@ -209,7 +208,7 @@ typedef struct { int8_t cacheLastRow; } SDbCfg; -typedef struct SDbObj { +typedef struct { char name[TSDB_FULL_DB_NAME_LEN]; char acct[TSDB_USER_LEN]; int64_t createdTime; diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 2d1bfefc28..dd8998399e 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -300,7 +300,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SMnodeMsg *pMsg, SCreateDbMsg *pCreat tstrncpy(dbObj.acct, acct, TSDB_USER_LEN); dbObj.createdTime = taosGetTimestampMs(); dbObj.updateTime = dbObj.createdTime; - dbObj.uid = 1234; + dbObj.uid = mndGenerateUid(dbObj.name, TSDB_FULL_DB_NAME_LEN); dbObj.cfg = (SDbCfg){.cacheBlockSize = pCreate->cacheBlockSize, .totalBlocks = pCreate->totalBlocks, .daysPerFile = pCreate->daysPerFile, diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 72be28d2b3..504be58d09 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -175,6 +175,7 @@ static int32_t mndDnodeActionDelete(SSdb *pSdb, SDnodeObj *pDnode) { static int32_t mndDnodeActionUpdate(SSdb *pSdb, SDnodeObj *pOldDnode, SDnodeObj *pNewDnode) { mTrace("dnode:%d, perform update action", pOldDnode->id); + pOldDnode->updateTime = pNewDnode->updateTime; return 0; } diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 2243f787b9..91adc02d72 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -169,12 +169,8 @@ static int32_t mndUserActionDelete(SSdb *pSdb, SUserObj *pUser) { static int32_t mndUserActionUpdate(SSdb *pSdb, SUserObj *pOldUser, SUserObj *pNewUser) { mTrace("user:%s, perform update action", pOldUser->user); - memcpy(pOldUser->user, pNewUser->user, TSDB_USER_LEN); memcpy(pOldUser->pass, pNewUser->pass, TSDB_PASSWORD_LEN); - memcpy(pOldUser->acct, pNewUser->acct, TSDB_USER_LEN); - pOldUser->createdTime = pNewUser->createdTime; pOldUser->updateTime = pNewUser->updateTime; - pOldUser->superUser = pNewUser->superUser; return 0; } @@ -328,6 +324,7 @@ static int32_t mndProcessAlterUserMsg(SMnodeMsg *pMsg) { memcpy(&newUser, pUser, sizeof(SUserObj)); memset(pUser->pass, 0, sizeof(pUser->pass)); taosEncryptPass((uint8_t *)pAlter->pass, strlen(pAlter->pass), pUser->pass); + newUser.updateTime = taosGetTimestampMs(); int32_t code = mndUpdateUser(pMnode, pUser, &newUser, pMsg); sdbRelease(pMnode->pSdb, pOperUser);