feat: support uniq grant
This commit is contained in:
parent
2b1a0cdbfe
commit
93c0890f68
|
@ -30,7 +30,6 @@ extern "C" {
|
|||
|
||||
#define GRANT_HEART_BEAT_MIN 2
|
||||
#define GRANT_ACTIVE_CODE "activeCode"
|
||||
#define GRANT_C_ACTIVE_CODE "cActiveCode"
|
||||
|
||||
typedef enum {
|
||||
TSDB_GRANT_ALL,
|
||||
|
|
|
@ -290,7 +290,6 @@ typedef enum ELogicConditionType {
|
|||
|
||||
#define TSDB_ACTIVE_KEY_LEN 109
|
||||
#define TSDB_CONN_ACTIVE_KEY_LEN 255
|
||||
#define TSDB_UNIQ_ACTIVE_KEY_LEN 249
|
||||
|
||||
#define TSDB_DEFAULT_PKT_SIZE 65480 // same as RPC_MAX_UDP_SIZE
|
||||
#define TSDB_SNAP_DATA_PAYLOAD_SIZE (1 * 1024 * 1024)
|
||||
|
|
|
@ -352,7 +352,7 @@ static const SSysDbTableSchema useGrantsFullSchema[] = {
|
|||
{.name = "grant_name", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||
{.name = "display_name", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||
{.name = "expire", .bytes = 32 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||
{.name = "limit", .bytes = 512 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||
{.name = "limits", .bytes = 512 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||
};
|
||||
|
||||
static const SSysDbTableSchema useGrantsLogSchema[] = {
|
||||
|
|
|
@ -435,8 +435,7 @@ SArray *dmGetMsgHandles() {
|
|||
if (dmSetMgmtHandle(pArray, TDMT_DND_CONFIG_DNODE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_DND_SERVER_STATUS, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_DND_SYSTABLE_RETRIEVE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER;
|
||||
if (dmSetMgmtHandle(pArray, TDMT_DND_ALTER_MNODE_TYPE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER;
|
||||
|
||||
if (dmSetMgmtHandle(pArray, TDMT_DND_ALTER_MNODE_TYPE, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER;
|
||||
|
||||
// Requests handled by MNODE
|
||||
if (dmSetMgmtHandle(pArray, TDMT_MND_GRANT, dmPutNodeMsgToMgmtQueue, 0) == NULL) goto _OVER;
|
||||
|
|
|
@ -290,7 +290,8 @@ static inline int32_t dmSendReq(const SEpSet *pEpSet, SRpcMsg *pMsg) {
|
|||
dError("failed to send rpc msg:%s since %s, handle:%p", TMSG_INFO(pMsg->msgType), terrstr(), pMsg->info.handle);
|
||||
return -1;
|
||||
} else {
|
||||
return rpcSendRequest(pDnode->trans.clientRpc, pEpSet, pMsg, NULL);
|
||||
rpcSendRequest(pDnode->trans.clientRpc, pEpSet, pMsg, NULL);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
static inline int32_t dmSendSyncReq(const SEpSet *pEpSet, SRpcMsg *pMsg) {
|
||||
|
|
|
@ -187,17 +187,12 @@ typedef struct {
|
|||
TdThreadMutex mutex;
|
||||
} STrans;
|
||||
|
||||
typedef struct {
|
||||
char id[TSDB_MACHINE_ID_LEN + 1];
|
||||
} SMachineId;
|
||||
|
||||
typedef struct {
|
||||
int64_t id;
|
||||
char name[TSDB_CLUSTER_ID_LEN];
|
||||
int64_t createdTime;
|
||||
int64_t updateTime;
|
||||
int32_t upTime;
|
||||
char active[TSDB_UNIQ_ACTIVE_KEY_LEN];
|
||||
} SClusterObj;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "tglobal.h"
|
||||
#include "tgrant.h"
|
||||
#include "tqueue.h"
|
||||
#include "tref.h"
|
||||
#include "ttime.h"
|
||||
#include "version.h"
|
||||
#include "wal.h"
|
||||
|
@ -134,10 +133,6 @@ typedef struct SMnode {
|
|||
int64_t ipWhiteVer;
|
||||
} SMnode;
|
||||
|
||||
typedef struct {
|
||||
RefFp freeFp;
|
||||
} SMnodeRefInfo;
|
||||
|
||||
void mndSetMsgHandle(SMnode *pMnode, tmsg_t msgType, MndMsgFp fp);
|
||||
int64_t mndGenerateUid(const char *name, int32_t len);
|
||||
|
||||
|
|
|
@ -742,9 +742,9 @@ _OVER:
|
|||
}
|
||||
|
||||
static int32_t mndCreateDnode(SMnode *pMnode, SRpcMsg *pReq, SCreateDnodeReq *pCreate) {
|
||||
int32_t code = -1;
|
||||
SSdbRaw *pRaw = NULL;
|
||||
STrans *pTrans = NULL;
|
||||
int32_t code = -1;
|
||||
SSdbRaw *pRaw = NULL;
|
||||
STrans *pTrans = NULL;
|
||||
|
||||
SDnodeObj dnodeObj = {0};
|
||||
dnodeObj.id = sdbGetMaxId(pMnode->pSdb, SDB_DNODE);
|
||||
|
@ -753,6 +753,7 @@ static int32_t mndCreateDnode(SMnode *pMnode, SRpcMsg *pReq, SCreateDnodeReq *pC
|
|||
dnodeObj.port = pCreate->port;
|
||||
tstrncpy(dnodeObj.fqdn, pCreate->fqdn, TSDB_FQDN_LEN);
|
||||
snprintf(dnodeObj.ep, TSDB_EP_LEN - 1, "%s:%u", pCreate->fqdn, pCreate->port);
|
||||
|
||||
pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_GLOBAL, pReq, "create-dnode");
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
mInfo("trans:%d, used to create dnode:%s", pTrans->id, dnodeObj.ep);
|
||||
|
|
|
@ -872,12 +872,6 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
|||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
colDataSetVal(pColInfo, numOfRows, (const char *)&roleTimeMs, false);
|
||||
|
||||
// char machineId[25] = "JGQ8Y+huRyiz4lHnR9gHngYx";
|
||||
// char machieIdVar[26] = {0};
|
||||
// STR_WITH_MAXSIZE_TO_VARSTR(machieIdVar, (const char*)&machineId, pShow->pMeta->pSchemas[cols].bytes);
|
||||
// pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||
// colDataSetVal(pColInfo, numOfRows, (const char *)&machineId, false);
|
||||
|
||||
numOfRows++;
|
||||
sdbRelease(pSdb, pObj);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue