From d9cbbddc017ec720b637faa129c52ccc487fd6a1 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 21 Oct 2020 11:35:16 +0000 Subject: [PATCH] TD-1589 --- src/inc/tsdb.h | 10 ++++++++++ src/tsdb/src/tsdbMain.c | 4 ++++ src/vnode/src/vnodeWrite.c | 11 +++++++++++ 3 files changed, 25 insertions(+) diff --git a/src/inc/tsdb.h b/src/inc/tsdb.h index 85f9b3bdc7..c6e57ce016 100644 --- a/src/inc/tsdb.h +++ b/src/inc/tsdb.h @@ -151,6 +151,16 @@ STableInfo *tsdbGetTableInfo(TSDB_REPO_T *pRepo, STableId tid); */ int32_t tsdbInsertData(TSDB_REPO_T *repo, SSubmitMsg *pMsg, SShellSubmitRspMsg *pRsp); +// -- FOR DELETE DATA +/** + * Delete data from a table in a repository + * @param pRepo the TSDB repository handle + * @param pData the rows to delete (will give a more specific description) + * + * @return the number of row deleted, -1 for failure and the error number is set + */ +int32_t tsdbDeleteData(TSDB_REPO_T *repo, SDeleteMsg *pMsg, SShellSubmitRspMsg *pRsp); + // -- FOR QUERY TIME SERIES DATA typedef void *TsdbQueryHandleT; // Use void to hide implementation details diff --git a/src/tsdb/src/tsdbMain.c b/src/tsdb/src/tsdbMain.c index a1e6376304..f05772ac9b 100644 --- a/src/tsdb/src/tsdbMain.c +++ b/src/tsdb/src/tsdbMain.c @@ -211,6 +211,10 @@ int32_t tsdbInsertData(TSDB_REPO_T *repo, SSubmitMsg *pMsg, SShellSubmitRspMsg * return 0; } +int32_t tsdbDeleteData(TSDB_REPO_T *repo, SDeleteMsg *pMsg, SShellSubmitRspMsg *pRsp) { + //STsdbRepo * pRepo = (STsdbRepo *)repo; + return -1; +} uint32_t tsdbGetFileInfo(TSDB_REPO_T *repo, char *name, uint32_t *index, uint32_t eindex, int64_t *size) { STsdbRepo *pRepo = (STsdbRepo *)repo; // STsdbMeta *pMeta = pRepo->tsdbMeta; diff --git a/src/vnode/src/vnodeWrite.c b/src/vnode/src/vnodeWrite.c index 27a512a4fd..0867c5c437 100644 --- a/src/vnode/src/vnodeWrite.c +++ b/src/vnode/src/vnodeWrite.c @@ -131,6 +131,17 @@ static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pR } static int32_t vnodeProcessDeleteMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pRet) { int32_t code = TSDB_CODE_SUCCESS; + + vTrace("vgId:%d, delete msg is processed", pVnode->vgId); + + // save insert result into item + SShellSubmitRspMsg *pRsp = NULL; + if (pRet) { + pRet->len = sizeof(SShellSubmitRspMsg); + pRet->rsp = rpcMallocCont(pRet->len); + pRsp = pRet->rsp; + } + if (tsdbDeleteData(pVnode->tsdb, pCont, pRsp) < 0) code = terrno; return code; } -- GitLab