TD-13253 serialize user msg
This commit is contained in:
parent
6693b5fa2d
commit
bf6cb839d0
|
@ -129,6 +129,14 @@ typedef enum _mgmt_table {
|
||||||
#define TSDB_FILL_NEXT 5
|
#define TSDB_FILL_NEXT 5
|
||||||
|
|
||||||
#define TSDB_ALTER_USER_PASSWD 0x1
|
#define TSDB_ALTER_USER_PASSWD 0x1
|
||||||
|
#define TSDB_ALTER_USER_SUPERUSER 0x2
|
||||||
|
#define TSDB_ALTER_USER_ADD_READ_DB 0x3
|
||||||
|
#define TSDB_ALTER_USER_REMOVE_READ_DB 0x4
|
||||||
|
#define TSDB_ALTER_USER_CLEAR_READ_DB 0x5
|
||||||
|
#define TSDB_ALTER_USER_ADD_WRITE_DB 0x6
|
||||||
|
#define TSDB_ALTER_USER_REMOVE_WRITE_DB 0x7
|
||||||
|
#define TSDB_ALTER_USER_CLEAR_WRITE_DB 0x7
|
||||||
|
|
||||||
#define TSDB_ALTER_USER_PRIVILEGES 0x2
|
#define TSDB_ALTER_USER_PRIVILEGES 0x2
|
||||||
|
|
||||||
#define TSDB_KILL_MSG_LEN 30
|
#define TSDB_KILL_MSG_LEN 30
|
||||||
|
@ -341,16 +349,36 @@ typedef struct {
|
||||||
int64_t maxStorage; // In unit of GB
|
int64_t maxStorage; // In unit of GB
|
||||||
} SCreateAcctReq, SAlterAcctReq;
|
} SCreateAcctReq, SAlterAcctReq;
|
||||||
|
|
||||||
|
int32_t tSerializeSCreateAcctReq(void** buf, SCreateAcctReq* pReq);
|
||||||
|
void* tDeserializeSCreateAcctReq(void* buf, SCreateAcctReq* pReq);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char user[TSDB_USER_LEN];
|
char user[TSDB_USER_LEN];
|
||||||
} SDropUserReq, SDropAcctReq;
|
} SDropUserReq, SDropAcctReq;
|
||||||
|
|
||||||
|
int32_t tSerializeSDropUserReq(void** buf, SDropUserReq* pReq);
|
||||||
|
void* tDeserializeSDropUserReq(void* buf, SDropUserReq* pReq);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int8_t type;
|
int8_t createType;
|
||||||
|
int8_t superUser; // denote if it is a super user or not
|
||||||
char user[TSDB_USER_LEN];
|
char user[TSDB_USER_LEN];
|
||||||
char pass[TSDB_PASSWORD_LEN];
|
char pass[TSDB_PASSWORD_LEN];
|
||||||
int8_t superUser; // denote if it is a super user or not
|
} SCreateUserReq;
|
||||||
} SCreateUserReq, SAlterUserReq;
|
|
||||||
|
int32_t tSerializeSCreateUserReq(void** buf, SCreateUserReq* pReq);
|
||||||
|
void* tDeserializeSCreateUserReq(void* buf, SCreateUserReq* pReq);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int8_t alterType;
|
||||||
|
char user[TSDB_USER_LEN];
|
||||||
|
char pass[TSDB_PASSWORD_LEN];
|
||||||
|
char dbname[TSDB_DB_FNAME_LEN];
|
||||||
|
int8_t superUser;
|
||||||
|
} SAlterUserReq;
|
||||||
|
|
||||||
|
int32_t tSerializeSAlterUserReq(void** buf, SAlterUserReq* pReq);
|
||||||
|
void* tDeserializeSAlterUserReq(void* buf, SAlterUserReq* pReq);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int16_t colId; // column id
|
int16_t colId; // column id
|
||||||
|
@ -622,7 +650,6 @@ typedef struct {
|
||||||
} SVnodeLoad;
|
} SVnodeLoad;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t mver; // msg version
|
|
||||||
int32_t sver; // software version
|
int32_t sver; // software version
|
||||||
int64_t dver; // dnode table version in sdb
|
int64_t dver; // dnode table version in sdb
|
||||||
int32_t dnodeId;
|
int32_t dnodeId;
|
||||||
|
@ -651,7 +678,6 @@ typedef struct {
|
||||||
} SDnodeEp;
|
} SDnodeEp;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t mver;
|
|
||||||
int64_t dver;
|
int64_t dver;
|
||||||
SDnodeCfg dnodeCfg;
|
SDnodeCfg dnodeCfg;
|
||||||
SArray* pDnodeEps; // Array of SDnodeEp
|
SArray* pDnodeEps; // Array of SDnodeEp
|
||||||
|
@ -661,7 +687,7 @@ int32_t tSerializeSStatusRsp(void** buf, SStatusRsp* pRsp);
|
||||||
void* tDeserializeSStatusRsp(void* buf, SStatusRsp* pRsp);
|
void* tDeserializeSStatusRsp(void* buf, SStatusRsp* pRsp);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t mver;
|
int32_t reserve;
|
||||||
} STransReq;
|
} STransReq;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -199,6 +199,7 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_MND_INVALID_USER_FORMAT TAOS_DEF_ERROR_CODE(0, 0x0373)
|
#define TSDB_CODE_MND_INVALID_USER_FORMAT TAOS_DEF_ERROR_CODE(0, 0x0373)
|
||||||
#define TSDB_CODE_MND_INVALID_PASS_FORMAT TAOS_DEF_ERROR_CODE(0, 0x0374)
|
#define TSDB_CODE_MND_INVALID_PASS_FORMAT TAOS_DEF_ERROR_CODE(0, 0x0374)
|
||||||
#define TSDB_CODE_MND_NO_USER_FROM_CONN TAOS_DEF_ERROR_CODE(0, 0x0375)
|
#define TSDB_CODE_MND_NO_USER_FROM_CONN TAOS_DEF_ERROR_CODE(0, 0x0375)
|
||||||
|
#define TSDB_CODE_MND_INVALID_ALTER_OPER TAOS_DEF_ERROR_CODE(0, 0x0376)
|
||||||
|
|
||||||
// mnode-db
|
// mnode-db
|
||||||
#define TSDB_CODE_MND_DB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0380)
|
#define TSDB_CODE_MND_DB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0380)
|
||||||
|
|
|
@ -464,7 +464,6 @@ int32_t tSerializeSStatusReq(void **buf, SStatusReq *pReq) {
|
||||||
int32_t tlen = 0;
|
int32_t tlen = 0;
|
||||||
|
|
||||||
// status
|
// status
|
||||||
tlen += taosEncodeFixedI32(buf, pReq->mver);
|
|
||||||
tlen += taosEncodeFixedI32(buf, pReq->sver);
|
tlen += taosEncodeFixedI32(buf, pReq->sver);
|
||||||
tlen += taosEncodeFixedI64(buf, pReq->dver);
|
tlen += taosEncodeFixedI64(buf, pReq->dver);
|
||||||
tlen += taosEncodeFixedI32(buf, pReq->dnodeId);
|
tlen += taosEncodeFixedI32(buf, pReq->dnodeId);
|
||||||
|
@ -501,7 +500,6 @@ int32_t tSerializeSStatusReq(void **buf, SStatusReq *pReq) {
|
||||||
|
|
||||||
void *tDeserializeSStatusReq(void *buf, SStatusReq *pReq) {
|
void *tDeserializeSStatusReq(void *buf, SStatusReq *pReq) {
|
||||||
// status
|
// status
|
||||||
buf = taosDecodeFixedI32(buf, &pReq->mver);
|
|
||||||
buf = taosDecodeFixedI32(buf, &pReq->sver);
|
buf = taosDecodeFixedI32(buf, &pReq->sver);
|
||||||
buf = taosDecodeFixedI64(buf, &pReq->dver);
|
buf = taosDecodeFixedI64(buf, &pReq->dver);
|
||||||
buf = taosDecodeFixedI32(buf, &pReq->dnodeId);
|
buf = taosDecodeFixedI32(buf, &pReq->dnodeId);
|
||||||
|
@ -549,8 +547,7 @@ void *tDeserializeSStatusReq(void *buf, SStatusReq *pReq) {
|
||||||
int32_t tSerializeSStatusRsp(void **buf, SStatusRsp *pRsp) {
|
int32_t tSerializeSStatusRsp(void **buf, SStatusRsp *pRsp) {
|
||||||
int32_t tlen = 0;
|
int32_t tlen = 0;
|
||||||
|
|
||||||
// status
|
// status;
|
||||||
tlen += taosEncodeFixedI32(buf, pRsp->mver);
|
|
||||||
tlen += taosEncodeFixedI64(buf, pRsp->dver);
|
tlen += taosEncodeFixedI64(buf, pRsp->dver);
|
||||||
|
|
||||||
// dnode cfg
|
// dnode cfg
|
||||||
|
@ -573,7 +570,6 @@ int32_t tSerializeSStatusRsp(void **buf, SStatusRsp *pRsp) {
|
||||||
|
|
||||||
void *tDeserializeSStatusRsp(void *buf, SStatusRsp *pRsp) {
|
void *tDeserializeSStatusRsp(void *buf, SStatusRsp *pRsp) {
|
||||||
// status
|
// status
|
||||||
buf = taosDecodeFixedI32(buf, &pRsp->mver);
|
|
||||||
buf = taosDecodeFixedI64(buf, &pRsp->dver);
|
buf = taosDecodeFixedI64(buf, &pRsp->dver);
|
||||||
|
|
||||||
// cluster cfg
|
// cluster cfg
|
||||||
|
@ -603,3 +599,75 @@ void *tDeserializeSStatusRsp(void *buf, SStatusRsp *pRsp) {
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t tSerializeSCreateAcctReq(void **buf, SCreateAcctReq *pReq) {
|
||||||
|
int32_t tlen = 0;
|
||||||
|
tlen += taosEncodeString(buf, pReq->user);
|
||||||
|
tlen += taosEncodeString(buf, pReq->pass);
|
||||||
|
tlen += taosEncodeFixedI32(buf, pReq->maxUsers);
|
||||||
|
tlen += taosEncodeFixedI32(buf, pReq->maxDbs);
|
||||||
|
tlen += taosEncodeFixedI32(buf, pReq->maxTimeSeries);
|
||||||
|
tlen += taosEncodeFixedI32(buf, pReq->maxStreams);
|
||||||
|
tlen += taosEncodeFixedI32(buf, pReq->accessState);
|
||||||
|
tlen += taosEncodeFixedI64(buf, pReq->maxStorage);
|
||||||
|
return tlen;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *tDeserializeSCreateAcctReq(void *buf, SCreateAcctReq *pReq) {
|
||||||
|
buf = taosDecodeStringTo(buf, pReq->user);
|
||||||
|
buf = taosDecodeStringTo(buf, pReq->pass);
|
||||||
|
buf = taosDecodeFixedI32(buf, &pReq->maxUsers);
|
||||||
|
buf = taosDecodeFixedI32(buf, &pReq->maxDbs);
|
||||||
|
buf = taosDecodeFixedI32(buf, &pReq->maxTimeSeries);
|
||||||
|
buf = taosDecodeFixedI32(buf, &pReq->maxStreams);
|
||||||
|
buf = taosDecodeFixedI32(buf, &pReq->accessState);
|
||||||
|
buf = taosDecodeFixedI64(buf, &pReq->maxStorage);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t tSerializeSDropUserReq(void **buf, SDropUserReq *pReq) {
|
||||||
|
int32_t tlen = 0;
|
||||||
|
tlen += taosEncodeString(buf, pReq->user);
|
||||||
|
return tlen;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *tDeserializeSDropUserReq(void *buf, SDropUserReq *pReq) {
|
||||||
|
buf = taosDecodeStringTo(buf, pReq->user);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t tSerializeSCreateUserReq(void **buf, SCreateUserReq *pReq) {
|
||||||
|
int32_t tlen = 0;
|
||||||
|
tlen += taosEncodeFixedI8(buf, pReq->createType);
|
||||||
|
tlen += taosEncodeFixedI8(buf, pReq->superUser);
|
||||||
|
tlen += taosEncodeString(buf, pReq->user);
|
||||||
|
tlen += taosEncodeString(buf, pReq->pass);
|
||||||
|
return tlen;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *tDeserializeSCreateUserReq(void *buf, SCreateUserReq *pReq) {
|
||||||
|
buf = taosDecodeFixedI8(buf, &pReq->createType);
|
||||||
|
buf = taosDecodeFixedI8(buf, &pReq->superUser);
|
||||||
|
buf = taosDecodeStringTo(buf, pReq->user);
|
||||||
|
buf = taosDecodeStringTo(buf, pReq->pass);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t tSerializeSAlterUserReq(void **buf, SAlterUserReq *pReq) {
|
||||||
|
int32_t tlen = 0;
|
||||||
|
tlen += taosEncodeFixedI8(buf, pReq->alterType);
|
||||||
|
tlen += taosEncodeString(buf, pReq->user);
|
||||||
|
tlen += taosEncodeString(buf, pReq->pass);
|
||||||
|
tlen += taosEncodeString(buf, pReq->dbname);
|
||||||
|
tlen += taosEncodeFixedI8(buf, pReq->superUser);
|
||||||
|
return tlen;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *tDeserializeSAlterUserReq(void *buf, SAlterUserReq *pReq) {
|
||||||
|
buf = taosDecodeFixedI8(buf, &pReq->alterType);
|
||||||
|
buf = taosDecodeStringTo(buf, pReq->user);
|
||||||
|
buf = taosDecodeStringTo(buf, pReq->pass);
|
||||||
|
buf = taosDecodeStringTo(buf, pReq->dbname);
|
||||||
|
buf = taosDecodeFixedI8(buf, &pReq->superUser);
|
||||||
|
return buf;
|
||||||
|
}
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "mndUser.h"
|
#include "mndUser.h"
|
||||||
|
#include "mndDb.h"
|
||||||
#include "mndShow.h"
|
#include "mndShow.h"
|
||||||
#include "mndTrans.h"
|
#include "mndTrans.h"
|
||||||
#include "tkey.h"
|
#include "tkey.h"
|
||||||
|
@ -206,7 +207,7 @@ USER_DECODE_OVER:
|
||||||
|
|
||||||
static int32_t mndUserActionInsert(SSdb *pSdb, SUserObj *pUser) {
|
static int32_t mndUserActionInsert(SSdb *pSdb, SUserObj *pUser) {
|
||||||
mTrace("user:%s, perform insert action, row:%p", pUser->user, pUser);
|
mTrace("user:%s, perform insert action, row:%p", pUser->user, pUser);
|
||||||
|
|
||||||
SAcctObj *pAcct = sdbAcquire(pSdb, SDB_ACCT, pUser->acct);
|
SAcctObj *pAcct = sdbAcquire(pSdb, SDB_ACCT, pUser->acct);
|
||||||
if (pAcct == NULL) {
|
if (pAcct == NULL) {
|
||||||
terrno = TSDB_CODE_MND_ACCT_NOT_EXIST;
|
terrno = TSDB_CODE_MND_ACCT_NOT_EXIST;
|
||||||
|
@ -291,47 +292,50 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, char *user, char *pass,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndProcessCreateUserReq(SMnodeMsg *pReq) {
|
static int32_t mndProcessCreateUserReq(SMnodeMsg *pReq) {
|
||||||
SMnode *pMnode = pReq->pMnode;
|
SMnode *pMnode = pReq->pMnode;
|
||||||
SCreateUserReq *pCreate = pReq->rpcMsg.pCont;
|
int32_t code = -1;
|
||||||
|
SUserObj *pUser = NULL;
|
||||||
|
SUserObj *pOperUser = NULL;
|
||||||
|
SCreateUserReq createReq = {0};
|
||||||
|
|
||||||
mDebug("user:%s, start to create", pCreate->user);
|
if (tDeserializeSCreateUserReq(pReq->rpcMsg.pCont, &createReq) == NULL) goto CREATE_USER_OVER;
|
||||||
|
|
||||||
if (pCreate->user[0] == 0) {
|
mDebug("user:%s, start to create", createReq.user);
|
||||||
|
|
||||||
|
if (createReq.user[0] == 0) {
|
||||||
terrno = TSDB_CODE_MND_INVALID_USER_FORMAT;
|
terrno = TSDB_CODE_MND_INVALID_USER_FORMAT;
|
||||||
mError("user:%s, failed to create since %s", pCreate->user, terrstr());
|
goto CREATE_USER_OVER;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pCreate->pass[0] == 0) {
|
if (createReq.pass[0] == 0) {
|
||||||
terrno = TSDB_CODE_MND_INVALID_PASS_FORMAT;
|
terrno = TSDB_CODE_MND_INVALID_PASS_FORMAT;
|
||||||
mError("user:%s, failed to create since %s", pCreate->user, terrstr());
|
goto CREATE_USER_OVER;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SUserObj *pUser = mndAcquireUser(pMnode, pCreate->user);
|
pUser = mndAcquireUser(pMnode, createReq.user);
|
||||||
if (pUser != NULL) {
|
if (pUser != NULL) {
|
||||||
mndReleaseUser(pMnode, pUser);
|
|
||||||
terrno = TSDB_CODE_MND_USER_ALREADY_EXIST;
|
terrno = TSDB_CODE_MND_USER_ALREADY_EXIST;
|
||||||
mError("user:%s, failed to create since %s", pCreate->user, terrstr());
|
goto CREATE_USER_OVER;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SUserObj *pOperUser = mndAcquireUser(pMnode, pReq->user);
|
pOperUser = mndAcquireUser(pMnode, pReq->user);
|
||||||
if (pOperUser == NULL) {
|
if (pOperUser == NULL) {
|
||||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||||
mError("user:%s, failed to create since %s", pCreate->user, terrstr());
|
goto CREATE_USER_OVER;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t code = mndCreateUser(pMnode, pOperUser->acct, pCreate->user, pCreate->pass, pReq);
|
code = mndCreateUser(pMnode, pOperUser->acct, createReq.user, createReq.pass, pReq);
|
||||||
|
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
|
CREATE_USER_OVER:
|
||||||
|
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||||
|
mError("user:%s, failed to create since %s", createReq.user, terrstr());
|
||||||
|
}
|
||||||
|
|
||||||
|
mndReleaseUser(pMnode, pUser);
|
||||||
mndReleaseUser(pMnode, pOperUser);
|
mndReleaseUser(pMnode, pOperUser);
|
||||||
|
|
||||||
if (code != 0) {
|
return code;
|
||||||
mError("user:%s, failed to create since %s", pCreate->user, terrstr());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndUpdateUser(SMnode *pMnode, SUserObj *pOld, SUserObj *pNew, SMnodeMsg *pReq) {
|
static int32_t mndUpdateUser(SMnode *pMnode, SUserObj *pOld, SUserObj *pNew, SMnodeMsg *pReq) {
|
||||||
|
@ -360,56 +364,131 @@ static int32_t mndUpdateUser(SMnode *pMnode, SUserObj *pOld, SUserObj *pNew, SMn
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static SHashObj *mndDupDbHash(SHashObj *pOld) {
|
||||||
|
SHashObj *pNew = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, true);
|
||||||
|
if (pNew == NULL) {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *db = taosHashIterate(pOld, NULL);
|
||||||
|
while (db != NULL) {
|
||||||
|
int32_t len = strlen(db) + 1;
|
||||||
|
if (taosHashPut(pNew, db, len, db, TSDB_DB_FNAME_LEN) != 0) {
|
||||||
|
taosHashCancelIterate(pOld, db);
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
taosHashCleanup(pNew);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
db = taosHashIterate(pOld, db);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pNew;
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t mndProcessAlterUserReq(SMnodeMsg *pReq) {
|
static int32_t mndProcessAlterUserReq(SMnodeMsg *pReq) {
|
||||||
SMnode *pMnode = pReq->pMnode;
|
SMnode *pMnode = pReq->pMnode;
|
||||||
SAlterUserReq *pAlter = pReq->rpcMsg.pCont;
|
int32_t code = -1;
|
||||||
|
SUserObj *pUser = NULL;
|
||||||
|
SUserObj *pOperUser = NULL;
|
||||||
|
SAlterUserReq alterReq = {0};
|
||||||
|
|
||||||
mDebug("user:%s, start to alter", pAlter->user);
|
if (tDeserializeSAlterUserReq(pReq->rpcMsg.pCont, &alterReq) == NULL) goto ALTER_USER_OVER;
|
||||||
|
|
||||||
if (pAlter->user[0] == 0) {
|
mDebug("user:%s, start to alter", alterReq.user);
|
||||||
|
|
||||||
|
if (alterReq.user[0] == 0) {
|
||||||
terrno = TSDB_CODE_MND_INVALID_USER_FORMAT;
|
terrno = TSDB_CODE_MND_INVALID_USER_FORMAT;
|
||||||
mError("user:%s, failed to alter since %s", pAlter->user, terrstr());
|
goto ALTER_USER_OVER;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pAlter->pass[0] == 0) {
|
if (alterReq.pass[0] == 0) {
|
||||||
terrno = TSDB_CODE_MND_INVALID_PASS_FORMAT;
|
terrno = TSDB_CODE_MND_INVALID_PASS_FORMAT;
|
||||||
mError("user:%s, failed to alter since %s", pAlter->user, terrstr());
|
goto ALTER_USER_OVER;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SUserObj *pUser = mndAcquireUser(pMnode, pAlter->user);
|
pUser = mndAcquireUser(pMnode, alterReq.user);
|
||||||
if (pUser == NULL) {
|
if (pUser == NULL) {
|
||||||
terrno = TSDB_CODE_MND_USER_NOT_EXIST;
|
terrno = TSDB_CODE_MND_USER_NOT_EXIST;
|
||||||
mError("user:%s, failed to alter since %s", pAlter->user, terrstr());
|
goto ALTER_USER_OVER;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SUserObj *pOperUser = mndAcquireUser(pMnode, pReq->user);
|
pOperUser = mndAcquireUser(pMnode, pReq->user);
|
||||||
if (pOperUser == NULL) {
|
if (pOperUser == NULL) {
|
||||||
mndReleaseUser(pMnode, pUser);
|
|
||||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||||
mError("user:%s, failed to alter since %s", pAlter->user, terrstr());
|
goto ALTER_USER_OVER;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SUserObj newUser = {0};
|
SUserObj newUser = {0};
|
||||||
memcpy(&newUser, pUser, sizeof(SUserObj));
|
memcpy(&newUser, pUser, sizeof(SUserObj));
|
||||||
char pass[TSDB_PASSWORD_LEN + 1] = {0};
|
newUser.readDbs = mndDupDbHash(pUser->readDbs);
|
||||||
taosEncryptPass_c((uint8_t *)pAlter->pass, strlen(pAlter->pass), pass);
|
newUser.writeDbs = mndDupDbHash(pUser->writeDbs);
|
||||||
memcpy(pUser->pass, pass, TSDB_PASSWORD_LEN);
|
if (newUser.readDbs == NULL || newUser.writeDbs == NULL) {
|
||||||
|
goto ALTER_USER_OVER;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t len = strlen(alterReq.dbname) + 1;
|
||||||
|
SDbObj *pDb = mndAcquireDb(pMnode, alterReq.dbname);
|
||||||
|
mndReleaseDb(pMnode, pDb);
|
||||||
|
|
||||||
|
if (alterReq.alterType == TSDB_ALTER_USER_PASSWD) {
|
||||||
|
char pass[TSDB_PASSWORD_LEN + 1] = {0};
|
||||||
|
taosEncryptPass_c((uint8_t *)alterReq.pass, strlen(alterReq.pass), pass);
|
||||||
|
memcpy(pUser->pass, pass, TSDB_PASSWORD_LEN);
|
||||||
|
} else if (alterReq.alterType == TSDB_ALTER_USER_SUPERUSER) {
|
||||||
|
newUser.superUser = alterReq.superUser;
|
||||||
|
} else if (alterReq.alterType == TSDB_ALTER_USER_ADD_READ_DB) {
|
||||||
|
if (pDb == NULL) {
|
||||||
|
terrno = TSDB_CODE_MND_DB_NOT_EXIST;
|
||||||
|
goto ALTER_USER_OVER;
|
||||||
|
}
|
||||||
|
if (taosHashPut(newUser.readDbs, alterReq.dbname, len, alterReq.dbname, TSDB_DB_FNAME_LEN) != 0) {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
goto ALTER_USER_OVER;
|
||||||
|
}
|
||||||
|
} else if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_DB) {
|
||||||
|
if (taosHashRemove(newUser.readDbs, alterReq.dbname, len) != 0) {
|
||||||
|
terrno = TSDB_CODE_MND_DB_NOT_EXIST;
|
||||||
|
goto ALTER_USER_OVER;
|
||||||
|
}
|
||||||
|
} else if (alterReq.alterType == TSDB_ALTER_USER_CLEAR_READ_DB) {
|
||||||
|
taosHashClear(newUser.readDbs);
|
||||||
|
} else if (alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_DB) {
|
||||||
|
if (pDb == NULL) {
|
||||||
|
terrno = TSDB_CODE_MND_DB_NOT_EXIST;
|
||||||
|
goto ALTER_USER_OVER;
|
||||||
|
}
|
||||||
|
if (taosHashPut(newUser.writeDbs, alterReq.dbname, len, alterReq.dbname, TSDB_DB_FNAME_LEN) != 0) {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
goto ALTER_USER_OVER;
|
||||||
|
}
|
||||||
|
} else if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_WRITE_DB) {
|
||||||
|
if (taosHashRemove(newUser.writeDbs, alterReq.dbname, len) != 0) {
|
||||||
|
terrno = TSDB_CODE_MND_DB_NOT_EXIST;
|
||||||
|
goto ALTER_USER_OVER;
|
||||||
|
}
|
||||||
|
} else if (alterReq.alterType == TSDB_ALTER_USER_CLEAR_WRITE_DB) {
|
||||||
|
taosHashClear(newUser.writeDbs);
|
||||||
|
} else {
|
||||||
|
terrno = TSDB_CODE_MND_INVALID_ALTER_OPER;
|
||||||
|
goto ALTER_USER_OVER;
|
||||||
|
}
|
||||||
|
|
||||||
newUser.updateTime = taosGetTimestampMs();
|
newUser.updateTime = taosGetTimestampMs();
|
||||||
|
|
||||||
int32_t code = mndUpdateUser(pMnode, pUser, &newUser, pReq);
|
code = mndUpdateUser(pMnode, pUser, &newUser, pReq);
|
||||||
|
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
|
ALTER_USER_OVER:
|
||||||
|
|
||||||
|
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||||
|
mError("user:%s, failed to alter since %s", alterReq.user, terrstr());
|
||||||
|
}
|
||||||
|
|
||||||
mndReleaseUser(pMnode, pOperUser);
|
mndReleaseUser(pMnode, pOperUser);
|
||||||
mndReleaseUser(pMnode, pUser);
|
mndReleaseUser(pMnode, pUser);
|
||||||
|
|
||||||
if (code != 0) {
|
return code;
|
||||||
mError("user:%s, failed to alter since %s", pAlter->user, terrstr());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndDropUser(SMnode *pMnode, SMnodeMsg *pReq, SUserObj *pUser) {
|
static int32_t mndDropUser(SMnode *pMnode, SMnodeMsg *pReq, SUserObj *pUser) {
|
||||||
|
@ -439,42 +518,45 @@ static int32_t mndDropUser(SMnode *pMnode, SMnodeMsg *pReq, SUserObj *pUser) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndProcessDropUserReq(SMnodeMsg *pReq) {
|
static int32_t mndProcessDropUserReq(SMnodeMsg *pReq) {
|
||||||
SMnode *pMnode = pReq->pMnode;
|
SMnode *pMnode = pReq->pMnode;
|
||||||
SDropUserReq *pDrop = pReq->rpcMsg.pCont;
|
int32_t code = -1;
|
||||||
|
SUserObj *pUser = NULL;
|
||||||
|
SUserObj *pOperUser = NULL;
|
||||||
|
SDropUserReq dropReq = {0};
|
||||||
|
|
||||||
mDebug("user:%s, start to drop", pDrop->user);
|
if (tDeserializeSDropUserReq(pReq->rpcMsg.pCont, &dropReq) == NULL) goto DROP_USER_OVER;
|
||||||
|
|
||||||
if (pDrop->user[0] == 0) {
|
mDebug("user:%s, start to drop", dropReq.user);
|
||||||
|
|
||||||
|
if (dropReq.user[0] == 0) {
|
||||||
terrno = TSDB_CODE_MND_INVALID_USER_FORMAT;
|
terrno = TSDB_CODE_MND_INVALID_USER_FORMAT;
|
||||||
mError("user:%s, failed to drop since %s", pDrop->user, terrstr());
|
goto DROP_USER_OVER;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SUserObj *pUser = mndAcquireUser(pMnode, pDrop->user);
|
pUser = mndAcquireUser(pMnode, dropReq.user);
|
||||||
if (pUser == NULL) {
|
if (pUser == NULL) {
|
||||||
terrno = TSDB_CODE_MND_USER_NOT_EXIST;
|
terrno = TSDB_CODE_MND_USER_NOT_EXIST;
|
||||||
mError("user:%s, failed to drop since %s", pDrop->user, terrstr());
|
goto DROP_USER_OVER;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SUserObj *pOperUser = mndAcquireUser(pMnode, pReq->user);
|
pOperUser = mndAcquireUser(pMnode, pReq->user);
|
||||||
if (pOperUser == NULL) {
|
if (pOperUser == NULL) {
|
||||||
mndReleaseUser(pMnode, pUser);
|
|
||||||
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
terrno = TSDB_CODE_MND_NO_USER_FROM_CONN;
|
||||||
mError("user:%s, failed to drop since %s", pDrop->user, terrstr());
|
goto DROP_USER_OVER;
|
||||||
return -1;
|
}
|
||||||
|
|
||||||
|
code = mndDropUser(pMnode, pReq, pUser);
|
||||||
|
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
|
DROP_USER_OVER:
|
||||||
|
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
|
||||||
|
mError("user:%s, failed to drop since %s", dropReq.user, terrstr());
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t code = mndDropUser(pMnode, pReq, pUser);
|
|
||||||
mndReleaseUser(pMnode, pOperUser);
|
mndReleaseUser(pMnode, pOperUser);
|
||||||
mndReleaseUser(pMnode, pUser);
|
mndReleaseUser(pMnode, pUser);
|
||||||
|
|
||||||
if (code != 0) {
|
return code;
|
||||||
mError("user:%s, failed to drop since %s", pDrop->user, terrstr());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TSDB_CODE_MND_ACTION_IN_PROGRESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndGetUserMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) {
|
static int32_t mndGetUserMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) {
|
||||||
|
|
|
@ -63,11 +63,14 @@ TestServer MndTestTrans::server2;
|
||||||
|
|
||||||
TEST_F(MndTestTrans, 01_Create_User_Crash) {
|
TEST_F(MndTestTrans, 01_Create_User_Crash) {
|
||||||
{
|
{
|
||||||
int32_t contLen = sizeof(SCreateUserReq);
|
SCreateUserReq createReq = {0};
|
||||||
|
strcpy(createReq.user, "u1");
|
||||||
|
strcpy(createReq.pass, "p1");
|
||||||
|
|
||||||
SCreateUserReq* pReq = (SCreateUserReq*)rpcMallocCont(contLen);
|
int32_t contLen = tSerializeSCreateUserReq(NULL, &createReq);
|
||||||
strcpy(pReq->user, "u1");
|
void* pReq = rpcMallocCont(contLen);
|
||||||
strcpy(pReq->pass, "p1");
|
void* pBuf = pReq;
|
||||||
|
tSerializeSCreateUserReq(&pBuf, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_USER, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_USER, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
|
|
@ -45,11 +45,14 @@ TEST_F(MndTestUser, 01_Show_User) {
|
||||||
|
|
||||||
TEST_F(MndTestUser, 02_Create_User) {
|
TEST_F(MndTestUser, 02_Create_User) {
|
||||||
{
|
{
|
||||||
int32_t contLen = sizeof(SCreateUserReq);
|
SCreateUserReq createReq = {0};
|
||||||
|
strcpy(createReq.user, "");
|
||||||
|
strcpy(createReq.pass, "p1");
|
||||||
|
|
||||||
SCreateUserReq* pReq = (SCreateUserReq*)rpcMallocCont(contLen);
|
int32_t contLen = tSerializeSCreateUserReq(NULL, &createReq);
|
||||||
strcpy(pReq->user, "");
|
void* pReq = rpcMallocCont(contLen);
|
||||||
strcpy(pReq->pass, "p1");
|
void* pBuf = pReq;
|
||||||
|
tSerializeSCreateUserReq(&pBuf, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_USER, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_USER, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -57,11 +60,14 @@ TEST_F(MndTestUser, 02_Create_User) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t contLen = sizeof(SCreateUserReq);
|
SCreateUserReq createReq = {0};
|
||||||
|
strcpy(createReq.user, "u1");
|
||||||
|
strcpy(createReq.pass, "");
|
||||||
|
|
||||||
SCreateUserReq* pReq = (SCreateUserReq*)rpcMallocCont(contLen);
|
int32_t contLen = tSerializeSCreateUserReq(NULL, &createReq);
|
||||||
strcpy(pReq->user, "u1");
|
void* pReq = rpcMallocCont(contLen);
|
||||||
strcpy(pReq->pass, "");
|
void* pBuf = pReq;
|
||||||
|
tSerializeSCreateUserReq(&pBuf, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_USER, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_USER, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -69,11 +75,14 @@ TEST_F(MndTestUser, 02_Create_User) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t contLen = sizeof(SCreateUserReq);
|
SCreateUserReq createReq = {0};
|
||||||
|
strcpy(createReq.user, "root");
|
||||||
|
strcpy(createReq.pass, "1");
|
||||||
|
|
||||||
SCreateUserReq* pReq = (SCreateUserReq*)rpcMallocCont(contLen);
|
int32_t contLen = tSerializeSCreateUserReq(NULL, &createReq);
|
||||||
strcpy(pReq->user, "root");
|
void* pReq = rpcMallocCont(contLen);
|
||||||
strcpy(pReq->pass, "1");
|
void* pBuf = pReq;
|
||||||
|
tSerializeSCreateUserReq(&pBuf, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_USER, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_USER, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -81,11 +90,14 @@ TEST_F(MndTestUser, 02_Create_User) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t contLen = sizeof(SCreateUserReq);
|
SCreateUserReq createReq = {0};
|
||||||
|
strcpy(createReq.user, "u1");
|
||||||
|
strcpy(createReq.pass, "p1");
|
||||||
|
|
||||||
SCreateUserReq* pReq = (SCreateUserReq*)rpcMallocCont(contLen);
|
int32_t contLen = tSerializeSCreateUserReq(NULL, &createReq);
|
||||||
strcpy(pReq->user, "u1");
|
void* pReq = rpcMallocCont(contLen);
|
||||||
strcpy(pReq->pass, "p1");
|
void* pBuf = pReq;
|
||||||
|
tSerializeSCreateUserReq(&pBuf, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_USER, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_USER, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -101,11 +113,15 @@ TEST_F(MndTestUser, 02_Create_User) {
|
||||||
|
|
||||||
TEST_F(MndTestUser, 03_Alter_User) {
|
TEST_F(MndTestUser, 03_Alter_User) {
|
||||||
{
|
{
|
||||||
int32_t contLen = sizeof(SAlterUserReq);
|
SAlterUserReq alterReq = {0};
|
||||||
|
alterReq.alterType = TSDB_ALTER_USER_PASSWD;
|
||||||
|
strcpy(alterReq.user, "");
|
||||||
|
strcpy(alterReq.pass, "p1");
|
||||||
|
|
||||||
SAlterUserReq* pReq = (SAlterUserReq*)rpcMallocCont(contLen);
|
int32_t contLen = tSerializeSAlterUserReq(NULL, &alterReq);
|
||||||
strcpy(pReq->user, "");
|
void* pReq = rpcMallocCont(contLen);
|
||||||
strcpy(pReq->pass, "p1");
|
void* pBuf = pReq;
|
||||||
|
tSerializeSAlterUserReq(&pBuf, &alterReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_USER, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_USER, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -113,11 +129,15 @@ TEST_F(MndTestUser, 03_Alter_User) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t contLen = sizeof(SAlterUserReq);
|
SAlterUserReq alterReq = {0};
|
||||||
|
alterReq.alterType = TSDB_ALTER_USER_PASSWD;
|
||||||
|
strcpy(alterReq.user, "u1");
|
||||||
|
strcpy(alterReq.pass, "");
|
||||||
|
|
||||||
SAlterUserReq* pReq = (SAlterUserReq*)rpcMallocCont(contLen);
|
int32_t contLen = tSerializeSAlterUserReq(NULL, &alterReq);
|
||||||
strcpy(pReq->user, "u1");
|
void* pReq = rpcMallocCont(contLen);
|
||||||
strcpy(pReq->pass, "");
|
void* pBuf = pReq;
|
||||||
|
tSerializeSAlterUserReq(&pBuf, &alterReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_USER, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_USER, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -125,11 +145,15 @@ TEST_F(MndTestUser, 03_Alter_User) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t contLen = sizeof(SAlterUserReq);
|
SAlterUserReq alterReq = {0};
|
||||||
|
alterReq.alterType = TSDB_ALTER_USER_PASSWD;
|
||||||
|
strcpy(alterReq.user, "u4");
|
||||||
|
strcpy(alterReq.pass, "1");
|
||||||
|
|
||||||
SAlterUserReq* pReq = (SAlterUserReq*)rpcMallocCont(contLen);
|
int32_t contLen = tSerializeSAlterUserReq(NULL, &alterReq);
|
||||||
strcpy(pReq->user, "u4");
|
void* pReq = rpcMallocCont(contLen);
|
||||||
strcpy(pReq->pass, "1");
|
void* pBuf = pReq;
|
||||||
|
tSerializeSAlterUserReq(&pBuf, &alterReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_USER, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_USER, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -137,11 +161,15 @@ TEST_F(MndTestUser, 03_Alter_User) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t contLen = sizeof(SAlterUserReq);
|
SAlterUserReq alterReq = {0};
|
||||||
|
alterReq.alterType = TSDB_ALTER_USER_PASSWD;
|
||||||
|
strcpy(alterReq.user, "u1");
|
||||||
|
strcpy(alterReq.pass, "1");
|
||||||
|
|
||||||
SAlterUserReq* pReq = (SAlterUserReq*)rpcMallocCont(contLen);
|
int32_t contLen = tSerializeSAlterUserReq(NULL, &alterReq);
|
||||||
strcpy(pReq->user, "u1");
|
void* pReq = rpcMallocCont(contLen);
|
||||||
strcpy(pReq->pass, "1");
|
void* pBuf = pReq;
|
||||||
|
tSerializeSAlterUserReq(&pBuf, &alterReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_USER, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_USER, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -151,10 +179,13 @@ TEST_F(MndTestUser, 03_Alter_User) {
|
||||||
|
|
||||||
TEST_F(MndTestUser, 04_Drop_User) {
|
TEST_F(MndTestUser, 04_Drop_User) {
|
||||||
{
|
{
|
||||||
int32_t contLen = sizeof(SDropUserReq);
|
SDropUserReq dropReq = {0};
|
||||||
|
strcpy(dropReq.user, "");
|
||||||
|
|
||||||
SDropUserReq* pReq = (SDropUserReq*)rpcMallocCont(contLen);
|
int32_t contLen = tSerializeSDropUserReq(NULL, &dropReq);
|
||||||
strcpy(pReq->user, "");
|
void* pReq = rpcMallocCont(contLen);
|
||||||
|
void* pBuf = pReq;
|
||||||
|
tSerializeSDropUserReq(&pBuf, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_USER, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_USER, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -162,10 +193,13 @@ TEST_F(MndTestUser, 04_Drop_User) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t contLen = sizeof(SDropUserReq);
|
SDropUserReq dropReq = {0};
|
||||||
|
strcpy(dropReq.user, "u4");
|
||||||
|
|
||||||
SDropUserReq* pReq = (SDropUserReq*)rpcMallocCont(contLen);
|
int32_t contLen = tSerializeSDropUserReq(NULL, &dropReq);
|
||||||
strcpy(pReq->user, "u4");
|
void* pReq = rpcMallocCont(contLen);
|
||||||
|
void* pBuf = pReq;
|
||||||
|
tSerializeSDropUserReq(&pBuf, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_USER, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_USER, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -173,10 +207,13 @@ TEST_F(MndTestUser, 04_Drop_User) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t contLen = sizeof(SDropUserReq);
|
SDropUserReq dropReq = {0};
|
||||||
|
strcpy(dropReq.user, "u1");
|
||||||
|
|
||||||
SDropUserReq* pReq = (SDropUserReq*)rpcMallocCont(contLen);
|
int32_t contLen = tSerializeSDropUserReq(NULL, &dropReq);
|
||||||
strcpy(pReq->user, "u1");
|
void* pReq = rpcMallocCont(contLen);
|
||||||
|
void* pBuf = pReq;
|
||||||
|
tSerializeSDropUserReq(&pBuf, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_USER, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_USER, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -192,11 +229,14 @@ TEST_F(MndTestUser, 04_Drop_User) {
|
||||||
|
|
||||||
TEST_F(MndTestUser, 05_Create_Drop_Alter_User) {
|
TEST_F(MndTestUser, 05_Create_Drop_Alter_User) {
|
||||||
{
|
{
|
||||||
int32_t contLen = sizeof(SCreateUserReq);
|
SCreateUserReq createReq = {0};
|
||||||
|
strcpy(createReq.user, "u1");
|
||||||
|
strcpy(createReq.pass, "p1");
|
||||||
|
|
||||||
SCreateUserReq* pReq = (SCreateUserReq*)rpcMallocCont(contLen);
|
int32_t contLen = tSerializeSCreateUserReq(NULL, &createReq);
|
||||||
strcpy(pReq->user, "u1");
|
void* pReq = rpcMallocCont(contLen);
|
||||||
strcpy(pReq->pass, "p1");
|
void* pBuf = pReq;
|
||||||
|
tSerializeSCreateUserReq(&pBuf, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_USER, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_USER, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -204,11 +244,14 @@ TEST_F(MndTestUser, 05_Create_Drop_Alter_User) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t contLen = sizeof(SCreateUserReq);
|
SCreateUserReq createReq = {0};
|
||||||
|
strcpy(createReq.user, "u2");
|
||||||
|
strcpy(createReq.pass, "p2");
|
||||||
|
|
||||||
SCreateUserReq* pReq = (SCreateUserReq*)rpcMallocCont(contLen);
|
int32_t contLen = tSerializeSCreateUserReq(NULL, &createReq);
|
||||||
strcpy(pReq->user, "u2");
|
void* pReq = rpcMallocCont(contLen);
|
||||||
strcpy(pReq->pass, "p2");
|
void* pBuf = pReq;
|
||||||
|
tSerializeSCreateUserReq(&pBuf, &createReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_USER, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_CREATE_USER, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -235,11 +278,15 @@ TEST_F(MndTestUser, 05_Create_Drop_Alter_User) {
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
CheckBinary("root", TSDB_USER_LEN);
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t contLen = sizeof(SAlterUserReq);
|
SAlterUserReq alterReq = {0};
|
||||||
|
alterReq.alterType = TSDB_ALTER_USER_PASSWD;
|
||||||
|
strcpy(alterReq.user, "u1");
|
||||||
|
strcpy(alterReq.pass, "p2");
|
||||||
|
|
||||||
SAlterUserReq* pReq = (SAlterUserReq*)rpcMallocCont(contLen);
|
int32_t contLen = tSerializeSAlterUserReq(NULL, &alterReq);
|
||||||
strcpy(pReq->user, "u1");
|
void* pReq = rpcMallocCont(contLen);
|
||||||
strcpy(pReq->pass, "p2");
|
void* pBuf = pReq;
|
||||||
|
tSerializeSAlterUserReq(&pBuf, &alterReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_USER, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_ALTER_USER, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
@ -266,10 +313,13 @@ TEST_F(MndTestUser, 05_Create_Drop_Alter_User) {
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
CheckBinary("root", TSDB_USER_LEN);
|
||||||
|
|
||||||
{
|
{
|
||||||
int32_t contLen = sizeof(SDropUserReq);
|
SDropUserReq dropReq = {0};
|
||||||
|
strcpy(dropReq.user, "u1");
|
||||||
|
|
||||||
SDropUserReq* pReq = (SDropUserReq*)rpcMallocCont(contLen);
|
int32_t contLen = tSerializeSDropUserReq(NULL, &dropReq);
|
||||||
strcpy(pReq->user, "u1");
|
void* pReq = rpcMallocCont(contLen);
|
||||||
|
void* pBuf = pReq;
|
||||||
|
tSerializeSDropUserReq(&pBuf, &dropReq);
|
||||||
|
|
||||||
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_USER, pReq, contLen);
|
SRpcMsg* pRsp = test.SendReq(TDMT_MND_DROP_USER, pReq, contLen);
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
#include "tmsg.h"
|
#include "tmsg.h"
|
||||||
|
|
||||||
|
|
||||||
SCreateUserReq* buildUserManipulationMsg(SSqlInfo* pInfo, int32_t* outputLen, int64_t id, char* msgBuf, int32_t msgLen);
|
char* buildUserManipulationMsg(SSqlInfo* pInfo, int32_t* outputLen, int64_t id, char* msgBuf, int32_t msgLen);
|
||||||
SCreateAcctReq* buildAcctManipulationMsg(SSqlInfo* pInfo, int32_t* outputLen, int64_t id, char* msgBuf, int32_t msgLen);
|
char* buildAcctManipulationMsg(SSqlInfo* pInfo, int32_t* outputLen, int64_t id, char* msgBuf, int32_t msgLen);
|
||||||
SDropUserReq* buildDropUserMsg(SSqlInfo* pInfo, int32_t* outputLen, int64_t id, char* msgBuf, int32_t msgLen);
|
char* buildDropUserMsg(SSqlInfo* pInfo, int32_t* outputLen, int64_t id, char* msgBuf, int32_t msgLen);
|
||||||
SShowReq* buildShowMsg(SShowInfo* pShowInfo, SParseContext* pParseCtx, SMsgBuf* pMsgBuf);
|
SShowReq* buildShowMsg(SShowInfo* pShowInfo, SParseContext* pParseCtx, SMsgBuf* pMsgBuf);
|
||||||
SCreateDbReq* buildCreateDbMsg(SCreateDbInfo* pCreateDbInfo, SParseContext *pCtx, SMsgBuf* pMsgBuf);
|
SCreateDbReq* buildCreateDbMsg(SCreateDbInfo* pCreateDbInfo, SParseContext *pCtx, SMsgBuf* pMsgBuf);
|
||||||
char* buildCreateStbReq(SCreateTableSql* pCreateTableSql, int32_t* len, SParseContext* pParseCtx, SMsgBuf* pMsgBuf);
|
char* buildCreateStbReq(SCreateTableSql* pCreateTableSql, int32_t* len, SParseContext* pParseCtx, SMsgBuf* pMsgBuf);
|
||||||
|
|
|
@ -2,87 +2,101 @@
|
||||||
#include "astGenerator.h"
|
#include "astGenerator.h"
|
||||||
#include "parserUtil.h"
|
#include "parserUtil.h"
|
||||||
|
|
||||||
SCreateUserReq* buildUserManipulationMsg(SSqlInfo* pInfo, int32_t* outputLen, int64_t id, char* msgBuf, int32_t msgLen) {
|
char* buildUserManipulationMsg(SSqlInfo* pInfo, int32_t* outputLen, int64_t id, char* msgBuf, int32_t msgLen) {
|
||||||
SCreateUserReq* pMsg = (SCreateUserReq*)calloc(1, sizeof(SCreateUserReq));
|
SCreateUserReq createReq = {0};
|
||||||
if (pMsg == NULL) {
|
|
||||||
// tscError("0x%" PRIx64 " failed to malloc for query msg", id);
|
|
||||||
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
SUserInfo* pUser = &pInfo->pMiscInfo->user;
|
SUserInfo* pUser = &pInfo->pMiscInfo->user;
|
||||||
strncpy(pMsg->user, pUser->user.z, pUser->user.n);
|
strncpy(createReq.user, pUser->user.z, pUser->user.n);
|
||||||
pMsg->type = pUser->type;
|
createReq.createType = pUser->type;
|
||||||
pMsg->superUser = (int8_t)pUser->type;
|
createReq.superUser = (int8_t)pUser->type;
|
||||||
|
|
||||||
if (pUser->type == TSDB_ALTER_USER_PRIVILEGES) {
|
if (pUser->type == TSDB_ALTER_USER_PRIVILEGES) {
|
||||||
// pMsg->privilege = (char)pCmd->count;
|
// pMsg->privilege = (char)pCmd->count;
|
||||||
} else {
|
} else {
|
||||||
strncpy(pMsg->pass, pUser->passwd.z, pUser->passwd.n);
|
strncpy(createReq.pass, pUser->passwd.z, pUser->passwd.n);
|
||||||
}
|
}
|
||||||
|
|
||||||
*outputLen = sizeof(SUserInfo);
|
int32_t tlen = tSerializeSCreateUserReq(NULL, &createReq);
|
||||||
return pMsg;
|
void* pReq = malloc(tlen);
|
||||||
}
|
if (pReq == NULL) {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
SCreateAcctReq* buildAcctManipulationMsg(SSqlInfo* pInfo, int32_t* outputLen, int64_t id, char* msgBuf, int32_t msgLen) {
|
|
||||||
SCreateAcctReq *pCreateMsg = (SCreateAcctReq *) calloc(1, sizeof(SCreateAcctReq));
|
|
||||||
if (pCreateMsg == NULL) {
|
|
||||||
qError("0x%" PRIx64 " failed to malloc for query msg", id);
|
|
||||||
terrno = TSDB_CODE_QRY_OUT_OF_MEMORY;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SToken *pName = &pInfo->pMiscInfo->user.user;
|
void* pBuf = pReq;
|
||||||
SToken *pPwd = &pInfo->pMiscInfo->user.passwd;
|
tSerializeSCreateUserReq(&pBuf, &createReq);
|
||||||
|
*outputLen = tlen;
|
||||||
|
return pReq;
|
||||||
|
}
|
||||||
|
|
||||||
strncpy(pCreateMsg->user, pName->z, pName->n);
|
char* buildAcctManipulationMsg(SSqlInfo* pInfo, int32_t* outputLen, int64_t id, char* msgBuf, int32_t msgLen) {
|
||||||
strncpy(pCreateMsg->pass, pPwd->z, pPwd->n);
|
SCreateAcctReq createReq = {0};
|
||||||
|
|
||||||
SCreateAcctInfo *pAcctOpt = &pInfo->pMiscInfo->acctOpt;
|
SToken* pName = &pInfo->pMiscInfo->user.user;
|
||||||
|
SToken* pPwd = &pInfo->pMiscInfo->user.passwd;
|
||||||
|
|
||||||
pCreateMsg->maxUsers = htonl(pAcctOpt->maxUsers);
|
strncpy(createReq.user, pName->z, pName->n);
|
||||||
pCreateMsg->maxDbs = htonl(pAcctOpt->maxDbs);
|
strncpy(createReq.pass, pPwd->z, pPwd->n);
|
||||||
pCreateMsg->maxTimeSeries = htonl(pAcctOpt->maxTimeSeries);
|
|
||||||
pCreateMsg->maxStreams = htonl(pAcctOpt->maxStreams);
|
SCreateAcctInfo* pAcctOpt = &pInfo->pMiscInfo->acctOpt;
|
||||||
// pCreateMsg->maxPointsPerSecond = htonl(pAcctOpt->maxPointsPerSecond);
|
|
||||||
pCreateMsg->maxStorage = htobe64(pAcctOpt->maxStorage);
|
createReq.maxUsers = htonl(pAcctOpt->maxUsers);
|
||||||
// pCreateMsg->maxQueryTime = htobe64(pAcctOpt->maxQueryTime);
|
createReq.maxDbs = htonl(pAcctOpt->maxDbs);
|
||||||
// pCreateMsg->maxConnections = htonl(pAcctOpt->maxConnections);
|
createReq.maxTimeSeries = htonl(pAcctOpt->maxTimeSeries);
|
||||||
|
createReq.maxStreams = htonl(pAcctOpt->maxStreams);
|
||||||
|
// createReq.maxPointsPerSecond = htonl(pAcctOpt->maxPointsPerSecond);
|
||||||
|
createReq.maxStorage = htobe64(pAcctOpt->maxStorage);
|
||||||
|
// createReq.maxQueryTime = htobe64(pAcctOpt->maxQueryTime);
|
||||||
|
// createReq.maxConnections = htonl(pAcctOpt->maxConnections);
|
||||||
|
|
||||||
if (pAcctOpt->stat.n == 0) {
|
if (pAcctOpt->stat.n == 0) {
|
||||||
pCreateMsg->accessState = -1;
|
createReq.accessState = -1;
|
||||||
} else {
|
} else {
|
||||||
if (pAcctOpt->stat.z[0] == 'r' && pAcctOpt->stat.n == 1) {
|
if (pAcctOpt->stat.z[0] == 'r' && pAcctOpt->stat.n == 1) {
|
||||||
pCreateMsg->accessState = TSDB_VN_READ_ACCCESS;
|
createReq.accessState = TSDB_VN_READ_ACCCESS;
|
||||||
} else if (pAcctOpt->stat.z[0] == 'w' && pAcctOpt->stat.n == 1) {
|
} else if (pAcctOpt->stat.z[0] == 'w' && pAcctOpt->stat.n == 1) {
|
||||||
pCreateMsg->accessState = TSDB_VN_WRITE_ACCCESS;
|
createReq.accessState = TSDB_VN_WRITE_ACCCESS;
|
||||||
} else if (strncmp(pAcctOpt->stat.z, "all", 3) == 0 && pAcctOpt->stat.n == 3) {
|
} else if (strncmp(pAcctOpt->stat.z, "all", 3) == 0 && pAcctOpt->stat.n == 3) {
|
||||||
pCreateMsg->accessState = TSDB_VN_ALL_ACCCESS;
|
createReq.accessState = TSDB_VN_ALL_ACCCESS;
|
||||||
} else if (strncmp(pAcctOpt->stat.z, "no", 2) == 0 && pAcctOpt->stat.n == 2) {
|
} else if (strncmp(pAcctOpt->stat.z, "no", 2) == 0 && pAcctOpt->stat.n == 2) {
|
||||||
pCreateMsg->accessState = 0;
|
createReq.accessState = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*outputLen = sizeof(SCreateAcctReq);
|
int32_t tlen = tSerializeSCreateAcctReq(NULL, &createReq);
|
||||||
return pCreateMsg;
|
void* pReq = malloc(tlen);
|
||||||
|
if (pReq == NULL) {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* pBuf = pReq;
|
||||||
|
tSerializeSCreateAcctReq(&pBuf, &createReq);
|
||||||
|
*outputLen = tlen;
|
||||||
|
return pReq;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDropUserReq* buildDropUserMsg(SSqlInfo* pInfo, int32_t *msgLen, int64_t id, char* msgBuf, int32_t msgBufLen) {
|
char* buildDropUserMsg(SSqlInfo* pInfo, int32_t* msgLen, int64_t id, char* msgBuf, int32_t msgBufLen) {
|
||||||
|
SDropUserReq dropReq = {0};
|
||||||
|
|
||||||
SToken* pName = taosArrayGet(pInfo->pMiscInfo->a, 0);
|
SToken* pName = taosArrayGet(pInfo->pMiscInfo->a, 0);
|
||||||
if (pName->n >= TSDB_USER_LEN) {
|
if (pName->n >= TSDB_USER_LEN) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDropUserReq* pMsg = calloc(1, sizeof(SDropUserReq));
|
strncpy(dropReq.user, pName->z, pName->n);
|
||||||
if (pMsg == NULL) {
|
|
||||||
terrno = TSDB_CODE_QRY_OUT_OF_MEMORY;
|
int32_t tlen = tSerializeSDropUserReq(NULL, &dropReq);
|
||||||
|
void* pReq = malloc(tlen);
|
||||||
|
if (pReq == NULL) {
|
||||||
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(pMsg->user, pName->z, pName->n);
|
void* pBuf = pReq;
|
||||||
*msgLen = sizeof(SDropUserReq);
|
tSerializeSDropUserReq(&pBuf, &dropReq);
|
||||||
return pMsg;
|
*msgLen = tlen;
|
||||||
|
return pReq;
|
||||||
}
|
}
|
||||||
|
|
||||||
SShowReq* buildShowMsg(SShowInfo* pShowInfo, SParseContext *pCtx, SMsgBuf* pMsgBuf) {
|
SShowReq* buildShowMsg(SShowInfo* pShowInfo, SParseContext *pCtx, SMsgBuf* pMsgBuf) {
|
||||||
|
@ -268,16 +282,16 @@ char* buildCreateStbReq(SCreateTableSql* pCreateTableSql, int32_t* len, SParseCo
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tlen = tSerializeSMCreateStbReq(NULL, &createReq);
|
int32_t tlen = tSerializeSMCreateStbReq(NULL, &createReq);
|
||||||
void* req = malloc(tlen);
|
void* pReq = malloc(tlen);
|
||||||
if (req == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* buf = req;
|
void* pBuf = pReq;
|
||||||
tSerializeSMCreateStbReq(&buf, &createReq);
|
tSerializeSMCreateStbReq(&pBuf, &createReq);
|
||||||
*len = tlen;
|
*len = tlen;
|
||||||
return req;
|
return pReq;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* buildDropStableReq(SSqlInfo* pInfo, int32_t* len, SParseContext* pParseCtx, SMsgBuf* pMsgBuf) {
|
char* buildDropStableReq(SSqlInfo* pInfo, int32_t* len, SParseContext* pParseCtx, SMsgBuf* pMsgBuf) {
|
||||||
|
@ -297,16 +311,16 @@ char* buildDropStableReq(SSqlInfo* pInfo, int32_t* len, SParseContext* pParseCtx
|
||||||
dropReq.igNotExists = pInfo->pMiscInfo->existsCheck ? 1 : 0;
|
dropReq.igNotExists = pInfo->pMiscInfo->existsCheck ? 1 : 0;
|
||||||
|
|
||||||
int32_t tlen = tSerializeSMDropStbReq(NULL, &dropReq);
|
int32_t tlen = tSerializeSMDropStbReq(NULL, &dropReq);
|
||||||
void* req = malloc(tlen);
|
void* pReq = malloc(tlen);
|
||||||
if (req == NULL) {
|
if (pReq == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* buf = req;
|
void* pBuf = pReq;
|
||||||
tSerializeSMDropStbReq(&buf, &dropReq);
|
tSerializeSMDropStbReq(&pBuf, &dropReq);
|
||||||
*len = tlen;
|
*len = tlen;
|
||||||
return req;
|
return pReq;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCreateDnodeReq *buildCreateDnodeMsg(SSqlInfo* pInfo, int32_t* len, SMsgBuf* pMsgBuf) {
|
SCreateDnodeReq *buildCreateDnodeMsg(SSqlInfo* pInfo, int32_t* len, SMsgBuf* pMsgBuf) {
|
||||||
|
|
|
@ -209,6 +209,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_USERS, "Too many users")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_USER_FORMAT, "Invalid user format")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_USER_FORMAT, "Invalid user format")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_PASS_FORMAT, "Invalid password format")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_PASS_FORMAT, "Invalid password format")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_USER_FROM_CONN, "Can not get user from conn")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_USER_FROM_CONN, "Can not get user from conn")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_ALTER_OPER, "Invalid alter operation")
|
||||||
|
|
||||||
// mnode-db
|
// mnode-db
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_ALREADY_EXIST, "Database already exists")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_ALREADY_EXIST, "Database already exists")
|
||||||
|
|
Loading…
Reference in New Issue