提交 3b1add19 编写于 作者: S Shengliang Guan

[TD-10430] add dnode trans file

上级 7bcfb460
...@@ -46,6 +46,16 @@ typedef struct { ...@@ -46,6 +46,16 @@ typedef struct {
*/ */
void (*SendRedirectMsg)(struct SRpcMsg *rpcMsg, bool forShell); void (*SendRedirectMsg)(struct SRpcMsg *rpcMsg, bool forShell);
/**
* Get the corresponding endpoint information from dnodeId.
*
* @param dnode, the instance of dDnode module.
* @param dnodeId, the id ot dnode.
* @param ep, the endpoint of dnode.
* @param fqdn, the fqdn of dnode.
* @param port, the port of dnode.
*/
void (*GetDnodeEp)(int32_t dnodeId, char *ep, char *fqdn, uint16_t *port);
} SMnodeFp; } SMnodeFp;
typedef struct { typedef struct {
......
...@@ -68,6 +68,7 @@ extern const int32_t TYPE_BYTES[15]; ...@@ -68,6 +68,7 @@ extern const int32_t TYPE_BYTES[15];
#define TSDB_DATA_NULL_STR "NULL" #define TSDB_DATA_NULL_STR "NULL"
#define TSDB_DATA_NULL_STR_L "null" #define TSDB_DATA_NULL_STR_L "null"
#define TSDB_NETTEST_USER "nettestinternal"
#define TSDB_DEFAULT_USER "root" #define TSDB_DEFAULT_USER "root"
#ifdef _TD_POWER_ #ifdef _TD_POWER_
#define TSDB_DEFAULT_PASS "powerdb" #define TSDB_DEFAULT_PASS "powerdb"
......
...@@ -19,7 +19,9 @@ ...@@ -19,7 +19,9 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include "os.h"
#include "taosmsg.h" #include "taosmsg.h"
#include "tglobal.h"
#include "tlog.h" #include "tlog.h"
#include "trpc.h" #include "trpc.h"
#include "dnode.h" #include "dnode.h"
......
...@@ -22,10 +22,10 @@ extern "C" { ...@@ -22,10 +22,10 @@ extern "C" {
#include "dnodeInt.h" #include "dnodeInt.h"
typedef enum { typedef enum {
TD_RUN_STAT_INIT, DN_RUN_STAT_INIT,
TD_RUN_STAT_RUNNING, DN_RUN_STAT_RUNNING,
TD_RUN_STAT_STOPPED DN_RUN_STAT_STOPPED
} RunStat; } EDnRunStat;
int32_t dnodeInitMain(); int32_t dnodeInitMain();
void dnodeCleanupMain(); void dnodeCleanupMain();
...@@ -36,7 +36,7 @@ void dnodeReportStartupFinished(char *name, char *desc); ...@@ -36,7 +36,7 @@ void dnodeReportStartupFinished(char *name, char *desc);
void dnodeProcessStartupReq(SRpcMsg *pMsg); void dnodeProcessStartupReq(SRpcMsg *pMsg);
void dnodeProcessCreateMnodeReq(SRpcMsg *pMsg); void dnodeProcessCreateMnodeReq(SRpcMsg *pMsg);
void dnodeProcessConfigDnodeReq(SRpcMsg *pMsg); void dnodeProcessConfigDnodeReq(SRpcMsg *pMsg);
RunStat dnodeGetRunStat(); EDnRunStat dnodeGetRunStat();
void dnodeSetRunStat(); void dnodeSetRunStat();
void* dnodeGetTimer(); void* dnodeGetTimer();
......
...@@ -25,7 +25,6 @@ int32_t dnodeInitTrans(); ...@@ -25,7 +25,6 @@ int32_t dnodeInitTrans();
void dnodeCleanupTrans(); void dnodeCleanupTrans();
void dnodeSendMsgToMnode(SRpcMsg *rpcMsg); void dnodeSendMsgToMnode(SRpcMsg *rpcMsg);
void dnodeSendMsgToDnode(SRpcEpSet *epSet, SRpcMsg *rpcMsg); void dnodeSendMsgToDnode(SRpcEpSet *epSet, SRpcMsg *rpcMsg);
void dnodeSendMsgToDnodeRecv(SRpcMsg *rpcMsg, SRpcMsg *rpcRsp, SRpcEpSet *epSet);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -46,6 +46,7 @@ static int32_t dnodeInitVnodeModule(void **unused) { ...@@ -46,6 +46,7 @@ static int32_t dnodeInitVnodeModule(void **unused) {
static int32_t dnodeInitMnodeModule(void **unused) { static int32_t dnodeInitMnodeModule(void **unused) {
SMnodePara para; SMnodePara para;
para.fp.GetDnodeEp = dnodeGetDnodeEp;
para.fp.SendMsgToDnode = dnodeSendMsgToDnode; para.fp.SendMsgToDnode = dnodeSendMsgToDnode;
para.fp.SendMsgToMnode = dnodeSendMsgToMnode; para.fp.SendMsgToMnode = dnodeSendMsgToMnode;
para.fp.SendRedirectMsg = dnodeSendRedirectMsg; para.fp.SendRedirectMsg = dnodeSendRedirectMsg;
...@@ -77,7 +78,7 @@ int32_t dnodeInit() { ...@@ -77,7 +78,7 @@ int32_t dnodeInit() {
taosStepExec(tsSteps); taosStepExec(tsSteps);
dnodeSetRunStat(TD_RUN_STAT_RUNNING); dnodeSetRunStat(DN_RUN_STAT_RUNNING);
dnodeReportStartupFinished("TDengine", "initialized successfully"); dnodeReportStartupFinished("TDengine", "initialized successfully");
dInfo("TDengine is initialized successfully"); dInfo("TDengine is initialized successfully");
...@@ -85,8 +86,8 @@ int32_t dnodeInit() { ...@@ -85,8 +86,8 @@ int32_t dnodeInit() {
} }
void dnodeCleanup() { void dnodeCleanup() {
if (dnodeGetRunStat() != TD_RUN_STAT_STOPPED) { if (dnodeGetRunStat() != DN_RUN_STAT_STOPPED) {
dnodeSetRunStat(TD_RUN_STAT_STOPPED); dnodeSetRunStat(DN_RUN_STAT_STOPPED);
taosStepCleanup(tsSteps); taosStepCleanup(tsSteps);
tsSteps = NULL; tsSteps = NULL;
} }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "mnode.h" #include "mnode.h"
static struct { static struct {
RunStat runStatus; EDnRunStat runStatus;
void * dnodeTimer; void * dnodeTimer;
SStartupStep startup; SStartupStep startup;
} tsDmain; } tsDmain;
...@@ -55,7 +55,7 @@ static void dnodeCheckDataDirOpenned(char *dir) { ...@@ -55,7 +55,7 @@ static void dnodeCheckDataDirOpenned(char *dir) {
} }
int32_t dnodeInitMain() { int32_t dnodeInitMain() {
tsDmain.runStatus = TD_RUN_STAT_STOPPED; tsDmain.runStatus = DN_RUN_STAT_STOPPED;
tsDmain.dnodeTimer = taosTmrInit(100, 200, 60000, "DND-TMR"); tsDmain.dnodeTimer = taosTmrInit(100, 200, 60000, "DND-TMR");
if (tsDmain.dnodeTimer == NULL) { if (tsDmain.dnodeTimer == NULL) {
dError("failed to init dnode timer"); dError("failed to init dnode timer");
...@@ -260,8 +260,8 @@ void dnodeProcessConfigDnodeReq(SRpcMsg *pMsg) { ...@@ -260,8 +260,8 @@ void dnodeProcessConfigDnodeReq(SRpcMsg *pMsg) {
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
} }
RunStat dnodeGetRunStat() { return tsDmain.runStatus; } EDnRunStat dnodeGetRunStat() { return tsDmain.runStatus; }
void dnodeSetRunStat(RunStat stat) { tsDmain.runStatus = stat; } void dnodeSetRunStat(EDnRunStat stat) { tsDmain.runStatus = stat; }
void* dnodeGetTimer() { return tsDmain.dnodeTimer; } void* dnodeGetTimer() { return tsDmain.dnodeTimer; }
\ No newline at end of file
...@@ -30,6 +30,7 @@ EMnStatus mnodeGetStatus(); ...@@ -30,6 +30,7 @@ EMnStatus mnodeGetStatus();
void mnodeSendMsgToDnode(struct SRpcEpSet *epSet, struct SRpcMsg *rpcMsg); void mnodeSendMsgToDnode(struct SRpcEpSet *epSet, struct SRpcMsg *rpcMsg);
void mnodeSendMsgToMnode(struct SRpcMsg *rpcMsg); void mnodeSendMsgToMnode(struct SRpcMsg *rpcMsg);
void mnodeSendRedirectMsg(struct SRpcMsg *rpcMsg, bool forShell); void mnodeSendRedirectMsg(struct SRpcMsg *rpcMsg, bool forShell);
void mnodeGetDnodeEp(int32_t dnodeId, char *ep, char *fqdn, uint16_t *port);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -15,7 +15,22 @@ ...@@ -15,7 +15,22 @@
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "os.h" #include "os.h"
#include "mnodeInt.h" #include "mnodeAuth.h"
int32_t mnodeInitAuth() { return 0; } int32_t mnodeInitAuth() { return 0; }
void mnodeCleanupAuth() {} void mnodeCleanupAuth() {}
\ No newline at end of file
int32_t mnodeRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey) {
if (strcmp(user, TSDB_NETTEST_USER) == 0) {
char pass[32] = {0};
taosEncryptPass((uint8_t *)user, strlen(user), pass);
*spi = 0;
*encrypt = 0;
*ckey = 0;
memcpy(secret, pass, TSDB_KEY_LEN);
mDebug("nettest user is authorized");
return 0;
}
return 0;
}
\ No newline at end of file
...@@ -61,6 +61,10 @@ void mnodeSendMsgToMnode(struct SRpcMsg *rpcMsg) { return (*tsMint.fp.SendMsgToM ...@@ -61,6 +61,10 @@ void mnodeSendMsgToMnode(struct SRpcMsg *rpcMsg) { return (*tsMint.fp.SendMsgToM
void mnodeSendRedirectMsg(struct SRpcMsg *rpcMsg, bool forShell) { (*tsMint.fp.SendRedirectMsg)(rpcMsg, forShell); } void mnodeSendRedirectMsg(struct SRpcMsg *rpcMsg, bool forShell) { (*tsMint.fp.SendRedirectMsg)(rpcMsg, forShell); }
void mnodeGetDnodeEp(int32_t dnodeId, char *ep, char *fqdn, uint16_t *port) {
(*tsMint.fp.GetDnodeEp)(dnodeId, ep, fqdn, port);
}
int32_t mnodeGetStatistics(SMnodeStat *stat) { return 0; } int32_t mnodeGetStatistics(SMnodeStat *stat) { return 0; }
static int32_t mnodeSetPara(SMnodePara para) { static int32_t mnodeSetPara(SMnodePara para) {
...@@ -242,5 +246,3 @@ void mnodeCleanup() { ...@@ -242,5 +246,3 @@ void mnodeCleanup() {
mInfo("mnode is cleaned up"); mInfo("mnode is cleaned up");
} }
} }
int32_t mnodeRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey) { return 0; }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册