shm
This commit is contained in:
parent
20b69c5e61
commit
41c902804f
|
@ -21,6 +21,8 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
#include "dndInt.h"
|
#include "dndInt.h"
|
||||||
|
|
||||||
|
SMgmtFp bmGetMgmtFp();
|
||||||
|
|
||||||
int32_t dndInitBnode(SDnode *pDnode);
|
int32_t dndInitBnode(SDnode *pDnode);
|
||||||
void dndCleanupBnode(SDnode *pDnode);
|
void dndCleanupBnode(SDnode *pDnode);
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "dndBnode.h"
|
// #include "dndBnode.h"
|
||||||
#include "dndMgmt.h"
|
// #include "dndMgmt.h"
|
||||||
#include "dndTransport.h"
|
// #include "dndTransport.h"
|
||||||
#include "dndWorker.h"
|
// #include "dndWorker.h"
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static void dndProcessBnodeQueue(SDnode *pDnode, STaosQall *qall, int32_t numOfMsgs);
|
static void dndProcessBnodeQueue(SDnode *pDnode, STaosQall *qall, int32_t numOfMsgs);
|
||||||
|
|
|
@ -15,45 +15,17 @@
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "dndMain.h"
|
#include "dndMain.h"
|
||||||
// #include "dndBnode.h"
|
|
||||||
#include "dndMgmt.h"
|
#include "dndMgmt.h"
|
||||||
// #include "mm.h"
|
|
||||||
// #include "dndQnode.h"
|
|
||||||
// #include "dndSnode.h"
|
|
||||||
#include "dndTransport.h"
|
#include "dndTransport.h"
|
||||||
// #include "dndVnodes.h"
|
|
||||||
// #include "monitor.h"
|
#include "bmInt.h"
|
||||||
// #include "sync.h"
|
#include "mmInt.h"
|
||||||
// #include "tfs.h"
|
#include "qmInt.h"
|
||||||
// #include "wal.h"
|
#include "smInt.h"
|
||||||
|
#include "vmInt.h"
|
||||||
|
|
||||||
static int8_t once = DND_ENV_INIT;
|
static int8_t once = DND_ENV_INIT;
|
||||||
|
|
||||||
SMgmtFp mmGetNodeFp() {
|
|
||||||
SMgmtFp nullFp = {0};
|
|
||||||
return nullFp;
|
|
||||||
}
|
|
||||||
|
|
||||||
SMgmtFp vndGetNodeFp() {
|
|
||||||
SMgmtFp nullFp = {0};
|
|
||||||
return nullFp;
|
|
||||||
}
|
|
||||||
|
|
||||||
SMgmtFp qndGetNodeFp() {
|
|
||||||
SMgmtFp nullFp = {0};
|
|
||||||
return nullFp;
|
|
||||||
}
|
|
||||||
|
|
||||||
SMgmtFp sndGetNodeFp() {
|
|
||||||
SMgmtFp nullFp = {0};
|
|
||||||
return nullFp;
|
|
||||||
}
|
|
||||||
|
|
||||||
SMgmtFp bndGetNodeFp() {
|
|
||||||
SMgmtFp nullFp = {0};
|
|
||||||
return nullFp;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dndResetLog(SMgmtWrapper *pMgmt) {
|
static void dndResetLog(SMgmtWrapper *pMgmt) {
|
||||||
char logname[24] = {0};
|
char logname[24] = {0};
|
||||||
snprintf(logname, sizeof(logname), "%slog", pMgmt->name);
|
snprintf(logname, sizeof(logname), "%slog", pMgmt->name);
|
||||||
|
@ -63,7 +35,7 @@ static void dndResetLog(SMgmtWrapper *pMgmt) {
|
||||||
taosInitLog(logname, 1);
|
taosInitLog(logname, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool dndRequireOpenNode(SMgmtWrapper *pMgmt) {
|
static bool dndRequireNode(SMgmtWrapper *pMgmt) {
|
||||||
bool required = (*pMgmt->fp.requiredFp)(pMgmt);
|
bool required = (*pMgmt->fp.requiredFp)(pMgmt);
|
||||||
if (!required) {
|
if (!required) {
|
||||||
dDebug("node:%s, no need to start on this dnode", pMgmt->name);
|
dDebug("node:%s, no need to start on this dnode", pMgmt->name);
|
||||||
|
@ -73,7 +45,7 @@ static bool dndRequireOpenNode(SMgmtWrapper *pMgmt) {
|
||||||
return required;
|
return required;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dndClearDnodeMem(SDnode *pDnode) {
|
static void dndClearMemory(SDnode *pDnode) {
|
||||||
for (ENodeType n = 0; n < NODE_MAX; ++n) {
|
for (ENodeType n = 0; n < NODE_MAX; ++n) {
|
||||||
SMgmtWrapper *pMgmt = &pDnode->mgmts[n];
|
SMgmtWrapper *pMgmt = &pDnode->mgmts[n];
|
||||||
tfree(pMgmt->path);
|
tfree(pMgmt->path);
|
||||||
|
@ -86,7 +58,7 @@ static void dndClearDnodeMem(SDnode *pDnode) {
|
||||||
dDebug("dnode object memory is cleared, data:%p", pDnode);
|
dDebug("dnode object memory is cleared, data:%p", pDnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t dndInitDnodeResource(SDnode *pDnode) {
|
static int32_t dndInitResource(SDnode *pDnode) {
|
||||||
SDiskCfg dCfg = {0};
|
SDiskCfg dCfg = {0};
|
||||||
tstrncpy(dCfg.dir, pDnode->cfg.dataDir, TSDB_FILENAME_LEN);
|
tstrncpy(dCfg.dir, pDnode->cfg.dataDir, TSDB_FILENAME_LEN);
|
||||||
dCfg.level = 0;
|
dCfg.level = 0;
|
||||||
|
@ -120,7 +92,7 @@ static int32_t dndInitDnodeResource(SDnode *pDnode) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dndClearDnodeResource(SDnode *pDnode) {
|
static void dndClearResource(SDnode *pDnode) {
|
||||||
dndCleanupTrans(pDnode);
|
dndCleanupTrans(pDnode);
|
||||||
dndStopMgmt(pDnode);
|
dndStopMgmt(pDnode);
|
||||||
dndCleanupMgmt(pDnode);
|
dndCleanupMgmt(pDnode);
|
||||||
|
@ -150,11 +122,11 @@ SDnode *dndCreate(SDndCfg *pCfg) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
pDnode->mgmts[MNODE].fp = mmGetNodeFp();
|
pDnode->mgmts[MNODE].fp = mmGetMgmtFp();
|
||||||
pDnode->mgmts[VNODES].fp = vndGetNodeFp();
|
pDnode->mgmts[VNODES].fp = vmGetMgmtFp();
|
||||||
pDnode->mgmts[QNODE].fp = qndGetNodeFp();
|
pDnode->mgmts[QNODE].fp = qmGetMgmtFp();
|
||||||
pDnode->mgmts[SNODE].fp = sndGetNodeFp();
|
pDnode->mgmts[SNODE].fp = smGetMgmtFp();
|
||||||
pDnode->mgmts[BNODE].fp = bndGetNodeFp();
|
pDnode->mgmts[BNODE].fp = bmGetMgmtFp();
|
||||||
pDnode->mgmts[MNODE].name = "mnode";
|
pDnode->mgmts[MNODE].name = "mnode";
|
||||||
pDnode->mgmts[VNODES].name = "vnodes";
|
pDnode->mgmts[VNODES].name = "vnodes";
|
||||||
pDnode->mgmts[QNODE].name = "qnode";
|
pDnode->mgmts[QNODE].name = "qnode";
|
||||||
|
@ -172,7 +144,7 @@ SDnode *dndCreate(SDndCfg *pCfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pMgmt->procType = PROC_SINGLE;
|
pMgmt->procType = PROC_SINGLE;
|
||||||
pMgmt->required = dndRequireOpenNode(pMgmt);
|
pMgmt->required = dndRequireNode(pMgmt);
|
||||||
if (pMgmt->required) {
|
if (pMgmt->required) {
|
||||||
if (taosMkDir(pMgmt->path) != 0) {
|
if (taosMkDir(pMgmt->path) != 0) {
|
||||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
|
@ -189,7 +161,7 @@ SDnode *dndCreate(SDndCfg *pCfg) {
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
if (code != 0 && pDnode) {
|
if (code != 0 && pDnode) {
|
||||||
dndClearDnodeMem(pDnode);
|
dndClearMemory(pDnode);
|
||||||
tfree(pDnode);
|
tfree(pDnode);
|
||||||
dError("failed to create dnode object since %s", terrstr());
|
dError("failed to create dnode object since %s", terrstr());
|
||||||
} else {
|
} else {
|
||||||
|
@ -259,8 +231,8 @@ void dndClose(SDnode *pDnode) {
|
||||||
dInfo("start to close dnode, data:%p", pDnode);
|
dInfo("start to close dnode, data:%p", pDnode);
|
||||||
dndSetStatus(pDnode, DND_STAT_STOPPED);
|
dndSetStatus(pDnode, DND_STAT_STOPPED);
|
||||||
|
|
||||||
dndClearDnodeResource(pDnode);
|
dndClearResource(pDnode);
|
||||||
dndClearDnodeMem(pDnode);
|
dndClearMemory(pDnode);
|
||||||
tfree(pDnode);
|
tfree(pDnode);
|
||||||
dInfo("dnode object is closed, data:%p", pDnode);
|
dInfo("dnode object is closed, data:%p", pDnode);
|
||||||
}
|
}
|
||||||
|
@ -288,9 +260,9 @@ int32_t dndInit() {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// SVnodeOpt vnodeOpt = {
|
// SVnodeOpt vnodeOpt = {
|
||||||
// .nthreads = tsNumOfCommitThreads, .putReqToVQueryQFp = dndPutReqToVQueryQ, .sendReqToDnodeFp = dndSendReqToDnode};
|
// .nthreads = tsNumOfCommitThreads, .putReqToVQueryQFp = dndPutReqToVQueryQ, .sendReqToDnodeFp =
|
||||||
|
// dndSendReqToDnode};
|
||||||
|
|
||||||
// if (vnodeInit(&vnodeOpt) != 0) {
|
// if (vnodeInit(&vnodeOpt) != 0) {
|
||||||
// dError("failed to init vnode since %s", terrstr());
|
// dError("failed to init vnode since %s", terrstr());
|
||||||
|
|
|
@ -21,6 +21,8 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
#include "dndInt.h"
|
#include "dndInt.h"
|
||||||
|
|
||||||
|
SMgmtFp mmGetMgmtFp();
|
||||||
|
|
||||||
// interface
|
// interface
|
||||||
int32_t mmInit(SDnode *pDnode);
|
int32_t mmInit(SDnode *pDnode);
|
||||||
void mmCleanup(SDnode *pDnode);
|
void mmCleanup(SDnode *pDnode);
|
|
@ -14,7 +14,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "mm.h"
|
#include "mmInt.h"
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
int32_t mmReadFile(SDnode *pDnode) {
|
int32_t mmReadFile(SDnode *pDnode) {
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "mm.h"
|
#include "mmInt.h"
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#include "dndMgmt.h"
|
#include "dndMgmt.h"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "mm.h"
|
#include "mmInt.h"
|
||||||
|
|
||||||
#include "dndMgmt.h"
|
#include "dndMgmt.h"
|
||||||
#include "dndTransport.h"
|
#include "dndTransport.h"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "mm.h"
|
#include "mmInt.h"
|
||||||
|
|
||||||
#include "dndMgmt.h"
|
#include "dndMgmt.h"
|
||||||
#include "dndTransport.h"
|
#include "dndTransport.h"
|
||||||
|
|
|
@ -21,6 +21,8 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
#include "dndInt.h"
|
#include "dndInt.h"
|
||||||
|
|
||||||
|
SMgmtFp qmGetMgmtFp();
|
||||||
|
|
||||||
int32_t dndInitQnode(SDnode *pDnode);
|
int32_t dndInitQnode(SDnode *pDnode);
|
||||||
void dndCleanupQnode(SDnode *pDnode);
|
void dndCleanupQnode(SDnode *pDnode);
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "dndQnode.h"
|
// #include "dndQnode.h"
|
||||||
#include "dndMgmt.h"
|
// #include "dndMgmt.h"
|
||||||
#include "dndTransport.h"
|
// #include "dndTransport.h"
|
||||||
#include "dndWorker.h"
|
// #include "dndWorker.h"
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static void dndProcessQnodeQueue(SDnode *pDnode, SRpcMsg *pMsg);
|
static void dndProcessQnodeQueue(SDnode *pDnode, SRpcMsg *pMsg);
|
||||||
|
|
|
@ -21,6 +21,8 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
#include "dndInt.h"
|
#include "dndInt.h"
|
||||||
|
|
||||||
|
SMgmtFp smGetMgmtFp();
|
||||||
|
|
||||||
int32_t dndInitSnode(SDnode *pDnode);
|
int32_t dndInitSnode(SDnode *pDnode);
|
||||||
void dndCleanupSnode(SDnode *pDnode);
|
void dndCleanupSnode(SDnode *pDnode);
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "dndSnode.h"
|
// #include "dndSnode.h"
|
||||||
#include "dndMgmt.h"
|
// #include "dndMgmt.h"
|
||||||
#include "dndTransport.h"
|
// #include "dndTransport.h"
|
||||||
#include "dndWorker.h"
|
// #include "dndWorker.h"
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static void dndProcessSnodeQueue(SDnode *pDnode, SRpcMsg *pMsg);
|
static void dndProcessSnodeQueue(SDnode *pDnode, SRpcMsg *pMsg);
|
||||||
|
|
|
@ -21,6 +21,9 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
#include "dndInt.h"
|
#include "dndInt.h"
|
||||||
|
|
||||||
|
SMgmtFp vmGetMgmtFp() ;
|
||||||
|
|
||||||
|
|
||||||
int32_t dndInitVnodes(SDnode *pDnode);
|
int32_t dndInitVnodes(SDnode *pDnode);
|
||||||
void dndCleanupVnodes(SDnode *pDnode);
|
void dndCleanupVnodes(SDnode *pDnode);
|
||||||
void dndGetVnodeLoads(SDnode *pDnode, SArray *pLoads);
|
void dndGetVnodeLoads(SDnode *pDnode, SArray *pLoads);
|
|
@ -14,10 +14,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "dndVnodes.h"
|
// #include "dndVnodes.h"
|
||||||
#include "dndMgmt.h"
|
// #include "dndMgmt.h"
|
||||||
#include "dndTransport.h"
|
// #include "dndTransport.h"
|
||||||
#include "sync.h"
|
// #include "sync.h"
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
Loading…
Reference in New Issue