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

shm

上级 db970c79
...@@ -60,6 +60,7 @@ void dndCleanup() { ...@@ -60,6 +60,7 @@ void dndCleanup() {
monCleanup(); monCleanup();
rpcCleanup(); rpcCleanup();
walCleanUp();
taosStopCacheRefreshWorker(); taosStopCacheRefreshWorker();
dInfo("dnode env is cleaned up"); dInfo("dnode env is cleaned up");
} }
......
...@@ -49,6 +49,12 @@ void mmRelease(SMnodeMgmt *pMgmt, SMnode *pMnode) { ...@@ -49,6 +49,12 @@ void mmRelease(SMnodeMgmt *pMgmt, SMnode *pMnode) {
} }
int32_t mmOpen(SMnodeMgmt *pMgmt, SMnodeOpt *pOption) { int32_t mmOpen(SMnodeMgmt *pMgmt, SMnodeOpt *pOption) {
if (walInit() != 0) {
dError("failed to init wal since %s", terrstr());
dndCleanup();
return -1;
}
SMnode *pMnode = mndOpen(pMgmt->path, pOption); SMnode *pMnode = mndOpen(pMgmt->path, pOption);
if (pMnode == NULL) { if (pMnode == NULL) {
dError("failed to open mnode since %s", terrstr()); dError("failed to open mnode since %s", terrstr());
...@@ -240,6 +246,7 @@ static int32_t mmInit(SMgmtWrapper *pWrapper) { ...@@ -240,6 +246,7 @@ static int32_t mmInit(SMgmtWrapper *pWrapper) {
_OVER: _OVER:
if (code == 0) { if (code == 0) {
pWrapper->pMgmt = pMgmt;
dInfo("mnode-mgmt is initialized"); dInfo("mnode-mgmt is initialized");
} else { } else {
dError("failed to init mnode-mgmtsince %s", terrstr()); dError("failed to init mnode-mgmtsince %s", terrstr());
......
...@@ -94,15 +94,18 @@ static int32_t mmPutMsgToWorker(SMnodeMgmt *pMgmt, SDnodeWorker *pWorker, SNodeM ...@@ -94,15 +94,18 @@ static int32_t mmPutMsgToWorker(SMnodeMgmt *pMgmt, SDnodeWorker *pWorker, SNodeM
return code; return code;
} }
int32_t mmProcessWriteMsg(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) { int32_t mmProcessWriteMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SMnodeMgmt *pMgmt = pWrapper->pMgmt;
return mmPutMsgToWorker(pMgmt, &pMgmt->writeWorker, pMsg); return mmPutMsgToWorker(pMgmt, &pMgmt->writeWorker, pMsg);
} }
int32_t mmProcessSyncMsg(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) { int32_t mmProcessSyncMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SMnodeMgmt *pMgmt = pWrapper->pMgmt;
return mmPutMsgToWorker(pMgmt, &pMgmt->syncWorker, pMsg); return mmPutMsgToWorker(pMgmt, &pMgmt->syncWorker, pMsg);
} }
int32_t mmProcessReadMsg(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) { int32_t mmProcessReadMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SMnodeMgmt *pMgmt = pWrapper->pMgmt;
return mmPutMsgToWorker(pMgmt, &pMgmt->readWorker, pMsg); return mmPutMsgToWorker(pMgmt, &pMgmt->readWorker, pMsg);
} }
......
...@@ -35,6 +35,11 @@ static int32_t vmInit(SMgmtWrapper *pWrapper) { ...@@ -35,6 +35,11 @@ static int32_t vmInit(SMgmtWrapper *pWrapper) {
// dError("failed to init tfs since %s", terrstr()); // dError("failed to init tfs since %s", terrstr());
// return -1; // return -1;
// } // }
if (walInit() != 0) {
dError("failed to init wal since %s", terrstr());
dndCleanup();
return -1;
}
SVnodeOpt vnodeOpt = {0}; SVnodeOpt vnodeOpt = {0};
vnodeOpt.nthreads = tsNumOfCommitThreads; vnodeOpt.nthreads = tsNumOfCommitThreads;
...@@ -46,17 +51,10 @@ static int32_t vmInit(SMgmtWrapper *pWrapper) { ...@@ -46,17 +51,10 @@ static int32_t vmInit(SMgmtWrapper *pWrapper) {
return -1; return -1;
} }
if (walInit() != 0) {
dError("failed to init wal since %s", terrstr());
dndCleanup();
return -1;
}
return 0; return 0;
} }
static void vmCleanup(SMgmtWrapper *pWrapper) { static void vmCleanup(SMgmtWrapper *pWrapper) {
walCleanUp();
vnodeCleanup(); vnodeCleanup();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册