提交 e8b0b58c 编写于 作者: S Shengliang Guan

tfs cfg

上级 e07985bb
......@@ -17,6 +17,7 @@
#define _TD_DNODE_H_
#include "tdef.h"
#include "tcfg.h"
#ifdef __cplusplus
extern "C" {
......@@ -40,13 +41,15 @@ void dndCleanup();
/* ------------------------ SDnode ----------------------- */
typedef struct {
int32_t numOfSupportVnodes;
uint16_t serverPort;
char dataDir[TSDB_FILENAME_LEN];
char localEp[TSDB_EP_LEN];
char localFqdn[TSDB_FQDN_LEN];
char firstEp[TSDB_EP_LEN];
char secondEp[TSDB_EP_LEN];
int32_t numOfSupportVnodes;
uint16_t serverPort;
char dataDir[TSDB_FILENAME_LEN];
char localEp[TSDB_EP_LEN];
char localFqdn[TSDB_FQDN_LEN];
char firstEp[TSDB_EP_LEN];
char secondEp[TSDB_EP_LEN];
SDiskCfg *pDisks;
int32_t numOfDisks;
} SDnodeObjCfg;
/**
......
......@@ -28,6 +28,8 @@ SDnodeObjCfg dmnGetObjCfg() {
objCfg.serverPort = (uint16_t)cfgGetItem(pCfg, "serverPort")->i32;
tstrncpy(objCfg.localFqdn, cfgGetItem(pCfg, "fqdn")->str, sizeof(objCfg.localFqdn));
snprintf(objCfg.localEp, sizeof(objCfg.localEp), "%s:%u", objCfg.localFqdn, objCfg.serverPort);
objCfg.pDisks = tsDiskCfg;
objCfg.numOfDisks = tsDiskCfgNum;
return objCfg;
}
......
......@@ -81,7 +81,7 @@ static TdFilePtr dndCheckRunning(char *dataDir) {
return pFile;
}
static int32_t dndCreateImp(SDnode *pDnode, SDnodeObjCfg *pCfg) {
static int32_t dndInitDir(SDnode *pDnode, SDnodeObjCfg *pCfg) {
pDnode->pLockFile = dndCheckRunning(pCfg->dataDir);
if (pDnode->pLockFile == NULL) {
return -1;
......@@ -166,7 +166,7 @@ SDnode *dndCreate(SDnodeObjCfg *pCfg) {
dndSetStat(pDnode, DND_STAT_INIT);
if (dndCreateImp(pDnode, pCfg) != 0) {
if (dndInitDir(pDnode, pCfg) != 0) {
dError("failed to init dnode dir since %s", terrstr());
dndClose(pDnode);
return NULL;
......@@ -176,7 +176,14 @@ SDnode *dndCreate(SDnodeObjCfg *pCfg) {
tstrncpy(dCfg.dir, pDnode->cfg.dataDir, TSDB_FILENAME_LEN);
dCfg.level = 0;
dCfg.primary = 1;
pDnode->pTfs = tfsOpen(&dCfg, 1);
SDiskCfg *pDisks = pDnode->cfg.pDisks;
int32_t numOfDisks = pDnode->cfg.numOfDisks;
if (numOfDisks <= 0 || pDisks == NULL) {
pDisks = &dCfg;
numOfDisks = 1;
}
pDnode->pTfs = tfsOpen(pDisks, numOfDisks);
if (pDnode->pTfs == NULL) {
dError("failed to init tfs since %s", terrstr());
dndClose(pDnode);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册