提交 8eae8112 编写于 作者: H Hongze Cheng

more

上级 e3478a52
...@@ -75,7 +75,7 @@ SMeta *metaOpen(const char *path, const SMetaCfg *pOptions); ...@@ -75,7 +75,7 @@ SMeta *metaOpen(const char *path, const SMetaCfg *pOptions);
void metaClose(SMeta *pMeta); void metaClose(SMeta *pMeta);
void metaRemove(const char *path); void metaRemove(const char *path);
int metaCreateTable(SMeta *pMeta, STbCfg *pTbCfg); int metaCreateTable(SMeta *pMeta, STbCfg *pTbCfg);
int metaDropTable(SMeta *pMeta, const void *pReq, const int len); int metaDropTable(SMeta *pMeta, tb_uid_t uid);
int metaCommit(SMeta *pMeta); int metaCommit(SMeta *pMeta);
// Options // Options
......
...@@ -23,9 +23,10 @@ ...@@ -23,9 +23,10 @@
#include "vnode.h" #include "vnode.h"
#include "vnodeBufferPool.h" #include "vnodeBufferPool.h"
#include "vnodeCfg.h"
#include "vnodeCommit.h" #include "vnodeCommit.h"
#include "vnodeFS.h" #include "vnodeFS.h"
#include "vnodeCfg.h" #include "vnodeRequest.h"
#include "vnodeStateMgr.h" #include "vnodeStateMgr.h"
#include "vnodeSync.h" #include "vnodeSync.h"
......
...@@ -22,8 +22,12 @@ ...@@ -22,8 +22,12 @@
extern "C" { extern "C" {
#endif #endif
// SVCreateTableReq
int vnodeBuildCreateTableReq(const SVCreateTableReq *pReq, char *msg, int len); int vnodeBuildCreateTableReq(const SVCreateTableReq *pReq, char *msg, int len);
int vnodeParseCreateTableReq(const char *msg, int len, SVCreateTableReq *pReq); int vnodeParseCreateTableReq(const char *msg, int len, SVCreateTableReq *pReq);
// SVDropTableReq
int vnodeBuildDropTableReq(const SVDropTableReq *pReq, char *msg, int len);
int vnodeParseDropTableReq(const char *msg, int len, SVDropTableReq *pReq);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -38,6 +38,7 @@ int vnodeProcessWMsgs(SVnode *pVnode, SArray *pMsgs) { ...@@ -38,6 +38,7 @@ int vnodeProcessWMsgs(SVnode *pVnode, SArray *pMsgs) {
pMsg = *(SRpcMsg **)taosArrayGet(pMsgs, i); pMsg = *(SRpcMsg **)taosArrayGet(pMsgs, i);
pVnodeReq = (SVnodeReq *)(pMsg->pCont); pVnodeReq = (SVnodeReq *)(pMsg->pCont);
SVCreateTableReq ctReq; SVCreateTableReq ctReq;
SVDropTableReq dtReq;
// Apply the request // Apply the request
{ {
...@@ -49,7 +50,7 @@ int vnodeProcessWMsgs(SVnode *pVnode, SArray *pMsgs) { ...@@ -49,7 +50,7 @@ int vnodeProcessWMsgs(SVnode *pVnode, SArray *pMsgs) {
memcpy(ptr, pVnodeReq, pMsg->contLen); memcpy(ptr, pVnodeReq, pMsg->contLen);
// todo: change the interface here // todo: change the interface here
if (tqPushMsg(pVnode->pTq, pVnodeReq->req, pVnodeReq->ver) < 0) { if (tqPushMsg(pVnode->pTq, ptr, pVnodeReq->ver) < 0) {
// TODO: handle error // TODO: handle error
} }
...@@ -66,7 +67,13 @@ int vnodeProcessWMsgs(SVnode *pVnode, SArray *pMsgs) { ...@@ -66,7 +67,13 @@ int vnodeProcessWMsgs(SVnode *pVnode, SArray *pMsgs) {
// TODO: maybe need to clear the requst struct // TODO: maybe need to clear the requst struct
break; break;
case TSDB_MSG_TYPE_DROP_TABLE: case TSDB_MSG_TYPE_DROP_TABLE:
/* code */ if (vnodeParseDropTableReq(pVnodeReq->req, pMsg->contLen - sizeof(pVnodeReq->ver), &(dtReq)) < 0) {
// TODO: handle error
}
if (metaDropTable(pVnode->pMeta, dtReq.uid) < 0) {
// TODO: handle error
}
break; break;
case TSDB_MSG_TYPE_SUBMIT: case TSDB_MSG_TYPE_SUBMIT:
/* code */ /* code */
......
...@@ -37,8 +37,7 @@ int metaCreateTable(SMeta *pMeta, STbCfg *pTbCfg) { ...@@ -37,8 +37,7 @@ int metaCreateTable(SMeta *pMeta, STbCfg *pTbCfg) {
return 0; return 0;
} }
int metaDropTable(SMeta *pMeta, const void *pCont, const int len) { int metaDropTable(SMeta *pMeta, tb_uid_t uid) {
tb_uid_t uid;
if (metaRemoveTableFromIdx(pMeta, uid) < 0) { if (metaRemoveTableFromIdx(pMeta, uid) < 0) {
// TODO: handle error // TODO: handle error
return -1; return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册