提交 cfd3e514 编写于 作者: S slguan

compile for mgmt grant

上级 8fc096e3
......@@ -33,7 +33,6 @@ extern int32_t (*dnodeInitPeers)(int32_t numOfThreads);
extern int32_t (*dnodeCheckSystem)();
extern int32_t (*dnodeInitStorage)();
extern void (*dnodeCleanupStorage)();
extern void (*dnodeParseParameterK)();
extern int32_t tsMaxQueues;
extern void ** tsRpcQhandle;
extern void *tsQueryQhandle;
......
......@@ -19,6 +19,8 @@
#include "tglobalcfg.h"
#include "dnodeSystem.h"
void (*dnodeParseParameterKFp)() = NULL;
/*
* Termination handler
*/
......@@ -63,7 +65,9 @@ int main(int argc, char *argv[]) {
printf("buildinfo: %s\n", buildinfo);
return 0;
} else if (strcmp(argv[i], "-k") == 0) {
dnodeParseParameterK();
if (dnodeParseParameterKFp) {
dnodeParseParameterKFp();
}
#ifdef TAOS_MEM_CHECK
} else if (strcmp(argv[i], "--alloc-random-fail") == 0) {
if ((i < argc - 1) && (argv[i+1][0] != '-')) {
......
......@@ -294,10 +294,6 @@ int32_t dnodeCheckSystemImp() {
int32_t (*dnodeCheckSystem)() = dnodeCheckSystemImp;
void dnodeParseParameterKImp() {}
void (*dnodeParseParameterK)() = dnodeParseParameterKImp;
int32_t dnodeInitPeersImp(int32_t numOfThreads) {
return 0;
}
......
......@@ -42,7 +42,6 @@ extern uint32_t tsRebootTime;
// dnodeCluster
extern void (*dnodeStartModules)();
extern void (*dnodeParseParameterK)();
extern int32_t (*dnodeCheckSystem)();
......
......@@ -31,7 +31,9 @@ int32_t mgmtCheckTimeSeries(uint32_t timeseries);
int32_t mgmtCheckUserGrant();
int32_t mgmtCheckDbGrant();
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
}
......
......@@ -442,7 +442,7 @@ int32_t mgmtModifyChildTableTagValueByName(SChildTableObj *pTable, char *tagName
//
// 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);
//
// if (pTable->isDirty) pTable->isDirty = 0;
......
......@@ -26,6 +26,7 @@
#include "mgmtDb.h"
#include "mgmtDnode.h"
#include "mgmtDnodeInt.h"
#include "mgmtGrant.h"
#include "mgmtProfile.h"
#include "mgmtShell.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) {
if (msgType < 0 || msgType >= TSDB_MSG_TYPE_MAX) {
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_ALTER_STREAM_RSP) {
} 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) {
mgmtProcessDropStableRsp(msgType, pCont, contLen, pConn, code);
mgmtProcessDnodeGrantMsg(pCont, pConn);
} else {
mError("%s from dnode is not processed", taosMsg[(int8_t)msgType]);
}
......
......@@ -18,6 +18,7 @@
#include "mnode.h"
#include "mgmtAcct.h"
#include "mgmtGrant.h"
#include "mgmtUser.h"
int32_t (*mgmtCheckUserGrantFp)() = NULL;
int32_t (*mgmtCheckDbGrantFp)() = NULL;
......@@ -27,6 +28,7 @@ int32_t (*mgmtCheckTimeSeriesFp)(uint32_t timeseries) = NULL;
bool (*mgmtCheckExpiredFp)() = NULL;
int32_t (*mgmtGetGrantsMetaFp)(STableMeta *pMeta, SShowObj *pShow, void *pConn) = NULL;
int32_t (*mgmtRetrieveGrantsFp)(SShowObj *pShow, char *data, int rows, void *pConn) = NULL;
void (*mgmtUpdateGrantInfoFp)(void *pCont) = NULL;
int32_t mgmtCheckUserGrant() {
if (mgmtCheckUserGrantFp) {
......@@ -76,17 +78,19 @@ bool mgmtCheckExpired() {
int32_t mgmtGetGrantsMeta(STableMeta *pMeta, SShowObj *pShow, void *pConn) {
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);
} else {
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) {
return mgmtRetrieveGrantsFp(pShow, data, rows, pConn);
} else {
return 0;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册