compile for mgmt grant
This commit is contained in:
parent
8fc096e3fc
commit
cfd3e5149c
|
@ -33,7 +33,6 @@ extern int32_t (*dnodeInitPeers)(int32_t numOfThreads);
|
||||||
extern int32_t (*dnodeCheckSystem)();
|
extern int32_t (*dnodeCheckSystem)();
|
||||||
extern int32_t (*dnodeInitStorage)();
|
extern int32_t (*dnodeInitStorage)();
|
||||||
extern void (*dnodeCleanupStorage)();
|
extern void (*dnodeCleanupStorage)();
|
||||||
extern void (*dnodeParseParameterK)();
|
|
||||||
extern int32_t tsMaxQueues;
|
extern int32_t tsMaxQueues;
|
||||||
extern void ** tsRpcQhandle;
|
extern void ** tsRpcQhandle;
|
||||||
extern void *tsQueryQhandle;
|
extern void *tsQueryQhandle;
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#include "tglobalcfg.h"
|
#include "tglobalcfg.h"
|
||||||
#include "dnodeSystem.h"
|
#include "dnodeSystem.h"
|
||||||
|
|
||||||
|
void (*dnodeParseParameterKFp)() = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Termination handler
|
* Termination handler
|
||||||
*/
|
*/
|
||||||
|
@ -63,7 +65,9 @@ int main(int argc, char *argv[]) {
|
||||||
printf("buildinfo: %s\n", buildinfo);
|
printf("buildinfo: %s\n", buildinfo);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (strcmp(argv[i], "-k") == 0) {
|
} else if (strcmp(argv[i], "-k") == 0) {
|
||||||
dnodeParseParameterK();
|
if (dnodeParseParameterKFp) {
|
||||||
|
dnodeParseParameterKFp();
|
||||||
|
}
|
||||||
#ifdef TAOS_MEM_CHECK
|
#ifdef TAOS_MEM_CHECK
|
||||||
} else if (strcmp(argv[i], "--alloc-random-fail") == 0) {
|
} else if (strcmp(argv[i], "--alloc-random-fail") == 0) {
|
||||||
if ((i < argc - 1) && (argv[i+1][0] != '-')) {
|
if ((i < argc - 1) && (argv[i+1][0] != '-')) {
|
||||||
|
|
|
@ -294,10 +294,6 @@ int32_t dnodeCheckSystemImp() {
|
||||||
|
|
||||||
int32_t (*dnodeCheckSystem)() = dnodeCheckSystemImp;
|
int32_t (*dnodeCheckSystem)() = dnodeCheckSystemImp;
|
||||||
|
|
||||||
void dnodeParseParameterKImp() {}
|
|
||||||
|
|
||||||
void (*dnodeParseParameterK)() = dnodeParseParameterKImp;
|
|
||||||
|
|
||||||
int32_t dnodeInitPeersImp(int32_t numOfThreads) {
|
int32_t dnodeInitPeersImp(int32_t numOfThreads) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@ extern uint32_t tsRebootTime;
|
||||||
|
|
||||||
// dnodeCluster
|
// dnodeCluster
|
||||||
extern void (*dnodeStartModules)();
|
extern void (*dnodeStartModules)();
|
||||||
extern void (*dnodeParseParameterK)();
|
|
||||||
extern int32_t (*dnodeCheckSystem)();
|
extern int32_t (*dnodeCheckSystem)();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,9 @@ int32_t mgmtCheckTimeSeries(uint32_t timeseries);
|
||||||
int32_t mgmtCheckUserGrant();
|
int32_t mgmtCheckUserGrant();
|
||||||
int32_t mgmtCheckDbGrant();
|
int32_t mgmtCheckDbGrant();
|
||||||
int32_t mgmtGetGrantsMeta(STableMeta *pMeta, SShowObj *pShow, void *pConn);
|
int32_t mgmtGetGrantsMeta(STableMeta *pMeta, SShowObj *pShow, void *pConn);
|
||||||
int32_t mgmtRetrieveGrants(SShowObj *pShow, char *data, int rows, void *pConn);
|
int32_t mgmtRetrieveGrants(SShowObj *pShow, char *data, int32_t rows, void *pConn);
|
||||||
|
|
||||||
|
extern void (*mgmtUpdateGrantInfoFp)(void *pCont);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -442,7 +442,7 @@ int32_t mgmtModifyChildTableTagValueByName(SChildTableObj *pTable, char *tagName
|
||||||
//
|
//
|
||||||
// mgmtMeterActionEncode(pTable, msg, size, &rowSize);
|
// mgmtMeterActionEncode(pTable, msg, size, &rowSize);
|
||||||
//
|
//
|
||||||
// int32_t ret = sdbUpdateRow(meterSdb, msg, rowSize, 1); // Need callback function
|
// int32_t ret = sdbUpdateRow(tsChildTableSdb, msg, rowSize, 1); // Need callback function
|
||||||
// tfree(msg);
|
// tfree(msg);
|
||||||
//
|
//
|
||||||
// if (pTable->isDirty) pTable->isDirty = 0;
|
// if (pTable->isDirty) pTable->isDirty = 0;
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "mgmtDb.h"
|
#include "mgmtDb.h"
|
||||||
#include "mgmtDnode.h"
|
#include "mgmtDnode.h"
|
||||||
#include "mgmtDnodeInt.h"
|
#include "mgmtDnodeInt.h"
|
||||||
|
#include "mgmtGrant.h"
|
||||||
#include "mgmtProfile.h"
|
#include "mgmtProfile.h"
|
||||||
#include "mgmtShell.h"
|
#include "mgmtShell.h"
|
||||||
#include "mgmtTable.h"
|
#include "mgmtTable.h"
|
||||||
|
@ -230,6 +231,14 @@ void mgmtSendCreateVnodeMsg(SVgObj *pVgroup, int32_t vnode, SRpcIpSet *ipSet, vo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void mgmtProcessDnodeGrantMsg(void *pCont, void *thandle) {
|
||||||
|
if (mgmtUpdateGrantInfoFp) {
|
||||||
|
mgmtUpdateGrantInfoFp(pCont);
|
||||||
|
mTrace("grant info is updated");
|
||||||
|
}
|
||||||
|
rpcSendResponse(thandle, TSDB_CODE_SUCCESS, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void mgmtProcessMsgFromDnode(char msgType, void *pCont, int32_t contLen, void *pConn, int32_t code) {
|
void mgmtProcessMsgFromDnode(char msgType, void *pCont, int32_t contLen, void *pConn, int32_t code) {
|
||||||
if (msgType < 0 || msgType >= TSDB_MSG_TYPE_MAX) {
|
if (msgType < 0 || msgType >= TSDB_MSG_TYPE_MAX) {
|
||||||
mError("invalid msg type:%d", msgType);
|
mError("invalid msg type:%d", msgType);
|
||||||
|
@ -255,9 +264,9 @@ void mgmtProcessMsgFromDnode(char msgType, void *pCont, int32_t contLen, void *p
|
||||||
} else if (msgType == TSDB_MSG_TYPE_DNODE_CFG_RSP) {
|
} else if (msgType == TSDB_MSG_TYPE_DNODE_CFG_RSP) {
|
||||||
} else if (msgType == TSDB_MSG_TYPE_ALTER_STREAM_RSP) {
|
} else if (msgType == TSDB_MSG_TYPE_ALTER_STREAM_RSP) {
|
||||||
} else if (msgType == TSDB_MSG_TYPE_STATUS) {
|
} else if (msgType == TSDB_MSG_TYPE_STATUS) {
|
||||||
mgmtProcessDnodeStatus(msgType, pConn, contLen, pConn, code);
|
mgmtProcessDnodeStatus(msgType, pCont, contLen, pConn, code);
|
||||||
} else if (msgType == TSDB_MSG_TYPE_GRANT) {
|
} else if (msgType == TSDB_MSG_TYPE_GRANT) {
|
||||||
mgmtProcessDropStableRsp(msgType, pCont, contLen, pConn, code);
|
mgmtProcessDnodeGrantMsg(pCont, pConn);
|
||||||
} else {
|
} else {
|
||||||
mError("%s from dnode is not processed", taosMsg[(int8_t)msgType]);
|
mError("%s from dnode is not processed", taosMsg[(int8_t)msgType]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "mnode.h"
|
#include "mnode.h"
|
||||||
#include "mgmtAcct.h"
|
#include "mgmtAcct.h"
|
||||||
#include "mgmtGrant.h"
|
#include "mgmtGrant.h"
|
||||||
|
#include "mgmtUser.h"
|
||||||
|
|
||||||
int32_t (*mgmtCheckUserGrantFp)() = NULL;
|
int32_t (*mgmtCheckUserGrantFp)() = NULL;
|
||||||
int32_t (*mgmtCheckDbGrantFp)() = NULL;
|
int32_t (*mgmtCheckDbGrantFp)() = NULL;
|
||||||
|
@ -27,6 +28,7 @@ int32_t (*mgmtCheckTimeSeriesFp)(uint32_t timeseries) = NULL;
|
||||||
bool (*mgmtCheckExpiredFp)() = NULL;
|
bool (*mgmtCheckExpiredFp)() = NULL;
|
||||||
int32_t (*mgmtGetGrantsMetaFp)(STableMeta *pMeta, SShowObj *pShow, void *pConn) = NULL;
|
int32_t (*mgmtGetGrantsMetaFp)(STableMeta *pMeta, SShowObj *pShow, void *pConn) = NULL;
|
||||||
int32_t (*mgmtRetrieveGrantsFp)(SShowObj *pShow, char *data, int rows, void *pConn) = NULL;
|
int32_t (*mgmtRetrieveGrantsFp)(SShowObj *pShow, char *data, int rows, void *pConn) = NULL;
|
||||||
|
void (*mgmtUpdateGrantInfoFp)(void *pCont) = NULL;
|
||||||
|
|
||||||
int32_t mgmtCheckUserGrant() {
|
int32_t mgmtCheckUserGrant() {
|
||||||
if (mgmtCheckUserGrantFp) {
|
if (mgmtCheckUserGrantFp) {
|
||||||
|
@ -76,17 +78,19 @@ bool mgmtCheckExpired() {
|
||||||
|
|
||||||
int32_t mgmtGetGrantsMeta(STableMeta *pMeta, SShowObj *pShow, void *pConn) {
|
int32_t mgmtGetGrantsMeta(STableMeta *pMeta, SShowObj *pShow, void *pConn) {
|
||||||
if (mgmtGetGrantsMetaFp) {
|
if (mgmtGetGrantsMetaFp) {
|
||||||
|
SUserObj *pUser = mgmtGetUserFromConn(pConn);
|
||||||
|
if (pUser == NULL) return 0;
|
||||||
|
if (strcmp(pUser->user, "root") != 0) return TSDB_CODE_NO_RIGHTS;
|
||||||
return mgmtGetGrantsMetaFp(pMeta, pShow, pConn);
|
return mgmtGetGrantsMetaFp(pMeta, pShow, pConn);
|
||||||
} else {
|
} else {
|
||||||
return TSDB_CODE_OPS_NOT_SUPPORT;
|
return TSDB_CODE_OPS_NOT_SUPPORT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mgmtRetrieveGrants(SShowObj *pShow, char *data, int rows, void *pConn) {
|
int32_t mgmtRetrieveGrants(SShowObj *pShow, char *data, int32_t rows, void *pConn) {
|
||||||
if (mgmtRetrieveGrantsFp) {
|
if (mgmtRetrieveGrantsFp) {
|
||||||
return mgmtRetrieveGrantsFp(pShow, data, rows, pConn);
|
return mgmtRetrieveGrantsFp(pShow, data, rows, pConn);
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue