提交 7435abcf 编写于 作者: S Shengliang Guan

rename files

上级 2bbed649
......@@ -48,7 +48,7 @@ typedef struct {
char secondEp[TSDB_EP_LEN];
SDiskCfg *pDisks;
int32_t numOfDisks;
} SDnodeObjCfg;
} SDndCfg;
typedef enum { DND_EVENT_STOP = 1, DND_EVENT_RELOAD } EDndEvent;
......@@ -58,7 +58,7 @@ typedef enum { DND_EVENT_STOP = 1, DND_EVENT_RELOAD } EDndEvent;
* @param pCfg Config of the dnode.
* @return SDnode* The dnode object.
*/
SDnode *dndCreate(SDnodeObjCfg *pCfg);
SDnode *dndCreate(SDndCfg *pCfg);
/**
* @brief Stop and cleanup the dnode.
......
......@@ -14,6 +14,6 @@ target_include_directories(
add_subdirectory(exec)
#if(${BUILD_TEST})
# add_subdirectory(test)
#endif(${BUILD_TEST})
if(${BUILD_TEST})
add_subdirectory(test)
endif(${BUILD_TEST})
......@@ -64,6 +64,26 @@ typedef enum { DND_ENV_INIT, DND_ENV_READY, DND_ENV_CLEANU } EEnvStat;
typedef void (*DndMsgFp)(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEps);
typedef int32_t (*MndMsgFp)(SDnode *pDnode, SMndMsg *pMsg);
typedef struct SDnode {
EDndStatus status;
SDndCfg cfg;
SDnodeDir dir;
TdFilePtr pLockFile;
SDnodeMgmt dmgmt;
SMndMgmt mmgmt;
SQnodeMgmt qmgmt;
SSnodeMgmt smgmt;
SBnodeMgmt bmgmt;
SVnodesMgmt vmgmt;
STransMgmt tmgmt;
STfs *pTfs;
SStartupReq startup;
EDndEvent event;
} SDnode;
EDndStatus dndGetStatus(SDnode *pDnode);
void dndSetStatus(SDnode *pDnode, EDndStatus stat);
const char *dndStatStr(EDndStatus stat);
......
......@@ -138,22 +138,7 @@ typedef struct {
DndMsgFp msgFp[TDMT_MAX];
} STransMgmt;
typedef struct SDnode {
EDndStatus status;
SDnodeObjCfg cfg;
SDnodeDir dir;
TdFilePtr pLockFile;
SDnodeMgmt dmgmt;
SMndMgmt mmgmt;
SQnodeMgmt qmgmt;
SSnodeMgmt smgmt;
SBnodeMgmt bmgmt;
SVnodesMgmt vmgmt;
STransMgmt tmgmt;
STfs *pTfs;
SStartupReq startup;
EDndEvent event;
} SDnode;
#ifdef __cplusplus
}
......
......@@ -28,7 +28,7 @@
static int8_t once = DND_ENV_INIT;
static int32_t dndInitDir(SDnode *pDnode, SDnodeObjCfg *pCfg) {
static int32_t dndInitDir(SDnode *pDnode, SDndCfg *pCfg) {
pDnode->pLockFile = dndCheckRunning(pCfg->dataDir);
if (pDnode->pLockFile == NULL) {
return -1;
......@@ -83,7 +83,7 @@ static int32_t dndInitDir(SDnode *pDnode, SDnodeObjCfg *pCfg) {
return -1;
}
memcpy(&pDnode->cfg, pCfg, sizeof(SDnodeObjCfg));
memcpy(&pDnode->cfg, pCfg, sizeof(SDndCfg));
return 0;
}
......@@ -101,7 +101,7 @@ static void dndCloseDir(SDnode *pDnode) {
}
}
SDnode *dndCreate(SDnodeObjCfg *pCfg) {
SDnode *dndCreate(SDndCfg *pCfg) {
dInfo("start to create dnode object");
SDnode *pDnode = calloc(1, sizeof(SDnode));
......
......@@ -36,11 +36,10 @@ extern "C" {
#define dDebug(...) { if (dDebugFlag & DEBUG_DEBUG) { taosPrintLog("DND ", DEBUG_DEBUG, dDebugFlag, __VA_ARGS__); }}
#define dTrace(...) { if (dDebugFlag & DEBUG_TRACE) { taosPrintLog("DND ", DEBUG_TRACE, dDebugFlag, __VA_ARGS__); }}
void dndDumpCfg();
void dndPrintVersion();
void dndGenerateGrant();
SDnodeObjCfg dndGetObjCfg();
void dndDumpCfg();
void dndPrintVersion();
void dndGenerateGrant();
SDndCfg dndGetCfg();
#ifdef __cplusplus
}
......
......@@ -71,8 +71,8 @@ static int32_t dndRunDnode() {
return -1;
}
SDnodeObjCfg objCfg = dndGetObjCfg();
SDnode *pDnode = dndCreate(&objCfg);
SDndCfg objCfg = dndGetCfg();
SDnode *pDnode = dndCreate(&objCfg);
if (pDnode == NULL) {
dError("failed to to create dnode object since %s", terrstr());
return -1;
......
......@@ -32,3 +32,24 @@ void dndPrintVersion() {
printf("gitinfo: %s\n", gitinfo);
printf("builuInfo: %s\n", buildinfo);
}
void dndDumpCfg() {
SConfig *pCfg = taosGetCfg();
cfgDumpCfg(pCfg, 0, 1);
}
SDndCfg dndGetCfg() {
SConfig *pCfg = taosGetCfg();
SDndCfg objCfg = {0};
objCfg.numOfSupportVnodes = cfgGetItem(pCfg, "supportVnodes")->i32;
tstrncpy(objCfg.dataDir, tsDataDir, sizeof(objCfg.dataDir));
tstrncpy(objCfg.firstEp, tsFirst, sizeof(objCfg.firstEp));
tstrncpy(objCfg.secondEp, tsSecond, sizeof(objCfg.firstEp));
objCfg.serverPort = tsServerPort;
tstrncpy(objCfg.localFqdn, tsLocalFqdn, sizeof(objCfg.localFqdn));
snprintf(objCfg.localEp, sizeof(objCfg.localEp), "%s:%u", objCfg.localFqdn, objCfg.serverPort);
objCfg.pDisks = tsDiskCfg;
objCfg.numOfDisks = tsDiskCfgNum;
return objCfg;
}
......@@ -24,7 +24,7 @@ class TestServer {
bool DoStart();
private:
SDnodeObjCfg BuildOption(const char* path, const char* fqdn, uint16_t port, const char* firstEp);
SDndCfg BuildOption(const char* path, const char* fqdn, uint16_t port, const char* firstEp);
private:
SDnode* pDnode;
......
......@@ -22,8 +22,8 @@ void* serverLoop(void* param) {
}
}
SDnodeObjCfg TestServer::BuildOption(const char* path, const char* fqdn, uint16_t port, const char* firstEp) {
SDnodeObjCfg cfg = {0};
SDndCfg TestServer::BuildOption(const char* path, const char* fqdn, uint16_t port, const char* firstEp) {
SDndCfg cfg = {0};
cfg.numOfSupportVnodes = 16;
cfg.serverPort = port;
strcpy(cfg.dataDir, path);
......@@ -34,7 +34,7 @@ SDnodeObjCfg TestServer::BuildOption(const char* path, const char* fqdn, uint16_
}
bool TestServer::DoStart() {
SDnodeObjCfg cfg = BuildOption(path, fqdn, port, firstEp);
SDndCfg cfg = BuildOption(path, fqdn, port, firstEp);
taosMkDir(path);
pDnode = dndCreate(&cfg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册