提交 56913abd 编写于 作者: H Hongze Cheng

more work

上级 e34ad23c
...@@ -109,7 +109,7 @@ STSma* metaGetSmaInfoByIndex(SMeta* pMeta, int64_t indexUid); ...@@ -109,7 +109,7 @@ STSma* metaGetSmaInfoByIndex(SMeta* pMeta, int64_t indexUid);
STSmaWrapper* metaGetSmaInfoByTable(SMeta* pMeta, tb_uid_t uid, bool deepCopy); STSmaWrapper* metaGetSmaInfoByTable(SMeta* pMeta, tb_uid_t uid, bool deepCopy);
SArray* metaGetSmaIdsByTable(SMeta* pMeta, tb_uid_t uid); SArray* metaGetSmaIdsByTable(SMeta* pMeta, tb_uid_t uid);
SArray* metaGetSmaTbUids(SMeta* pMeta); SArray* metaGetSmaTbUids(SMeta* pMeta);
int32_t metaSnapReaderOpen(SMeta* pMeta, SMetaSnapReader** ppReader, int64_t sver, int64_t ever); int32_t metaSnapReaderOpen(SMeta* pMeta, int64_t sver, int64_t ever, SMetaSnapReader** ppReader);
int32_t metaSnapReaderClose(SMetaSnapReader* pReader); int32_t metaSnapReaderClose(SMetaSnapReader* pReader);
int32_t metaSnapRead(SMetaSnapReader* pReader, void** ppData, uint32_t* nData); int32_t metaSnapRead(SMetaSnapReader* pReader, void** ppData, uint32_t* nData);
void* metaGetIdx(SMeta* pMeta); void* metaGetIdx(SMeta* pMeta);
...@@ -131,7 +131,7 @@ int32_t tsdbInsertTableData(STsdb* pTsdb, int64_t version, SSubmitMsgIter* p ...@@ -131,7 +131,7 @@ int32_t tsdbInsertTableData(STsdb* pTsdb, int64_t version, SSubmitMsgIter* p
int32_t tsdbDeleteTableData(STsdb* pTsdb, int64_t version, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKEY eKey); int32_t tsdbDeleteTableData(STsdb* pTsdb, int64_t version, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKEY eKey);
STsdbReader tsdbQueryCacheLastT(STsdb* tsdb, SQueryTableDataCond* pCond, STableListInfo* tableList, uint64_t qId, STsdbReader tsdbQueryCacheLastT(STsdb* tsdb, SQueryTableDataCond* pCond, STableListInfo* tableList, uint64_t qId,
void* pMemRef); void* pMemRef);
int32_t tsdbSnapReaderOpen(STsdb* pTsdb, STsdbSnapReader** ppReader, int64_t sver, int64_t ever); int32_t tsdbSnapReaderOpen(STsdb* pTsdb, int64_t sver, int64_t ever, STsdbSnapReader** ppReader);
int32_t tsdbSnapReaderClose(STsdbSnapReader* pReader); int32_t tsdbSnapReaderClose(STsdbSnapReader* pReader);
int32_t tsdbSnapRead(STsdbSnapReader* pReader, void** ppData, uint32_t* nData); int32_t tsdbSnapRead(STsdbSnapReader* pReader, void** ppData, uint32_t* nData);
......
...@@ -22,7 +22,7 @@ struct SMetaSnapReader { ...@@ -22,7 +22,7 @@ struct SMetaSnapReader {
int64_t ever; int64_t ever;
}; };
int32_t metaSnapReaderOpen(SMeta* pMeta, SMetaSnapReader** ppReader, int64_t sver, int64_t ever) { int32_t metaSnapReaderOpen(SMeta* pMeta, int64_t sver, int64_t ever, SMetaSnapReader** ppReader) {
int32_t code = 0; int32_t code = 0;
int32_t c = 0; int32_t c = 0;
SMetaSnapReader* pMetaReader = NULL; SMetaSnapReader* pMetaReader = NULL;
......
...@@ -36,7 +36,7 @@ typedef struct STsdbSnapWriter { ...@@ -36,7 +36,7 @@ typedef struct STsdbSnapWriter {
SDelFWriter* pDelFWriter; SDelFWriter* pDelFWriter;
} STsdbSnapWriter; } STsdbSnapWriter;
int32_t tsdbSnapReaderOpen(STsdb* pTsdb, STsdbSnapReader** ppReader, int64_t sver, int64_t ever) { int32_t tsdbSnapReaderOpen(STsdb* pTsdb, int64_t sver, int64_t ever, STsdbSnapReader** ppReader) {
int32_t code = 0; int32_t code = 0;
STsdbSnapReader* pReader = NULL; STsdbSnapReader* pReader = NULL;
......
...@@ -13,8 +13,9 @@ ...@@ -13,8 +13,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "vnodeInt.h" #include "vnd.h"
// SVSnapReader ========================================================
struct SVSnapReader { struct SVSnapReader {
SVnode *pVnode; SVnode *pVnode;
int64_t sver; int64_t sver;
...@@ -29,13 +30,6 @@ struct SVSnapReader { ...@@ -29,13 +30,6 @@ struct SVSnapReader {
int32_t nData; int32_t nData;
}; };
struct SVSnapWriter {
SVnode *pVnode;
int64_t sver;
int64_t ever;
};
// SVSnapReader ========================================================
int32_t vnodeSnapReaderOpen(SVnode *pVnode, int64_t sver, int64_t ever, SVSnapReader **ppReader) { int32_t vnodeSnapReaderOpen(SVnode *pVnode, int64_t sver, int64_t ever, SVSnapReader **ppReader) {
int32_t code = 0; int32_t code = 0;
SVSnapReader *pReader = NULL; SVSnapReader *pReader = NULL;
...@@ -49,21 +43,17 @@ int32_t vnodeSnapReaderOpen(SVnode *pVnode, int64_t sver, int64_t ever, SVSnapRe ...@@ -49,21 +43,17 @@ int32_t vnodeSnapReaderOpen(SVnode *pVnode, int64_t sver, int64_t ever, SVSnapRe
pReader->sver = sver; pReader->sver = sver;
pReader->ever = ever; pReader->ever = ever;
if (metaSnapReaderOpen(pVnode->pMeta, &pReader->pMetaReader, sver, ever) < 0) { code = metaSnapReaderOpen(pVnode->pMeta, sver, ever, &pReader->pMetaReader);
taosMemoryFree(pReader); if (code) goto _err;
goto _err;
}
if (tsdbSnapReaderOpen(pVnode->pTsdb, &pReader->pTsdbReader, sver, ever) < 0) { code = tsdbSnapReaderOpen(pVnode->pTsdb, sver, ever, &pReader->pTsdbReader);
metaSnapReaderClose(pReader->pMetaReader); if (code) goto _err;
taosMemoryFree(pReader);
goto _err;
}
*ppReader = pReader; *ppReader = pReader;
return code; return code;
_err: _err:
vError("vgId:%d vnode snapshot reader open failed since %s", TD_VID(pVnode), tstrerror(code));
*ppReader = NULL; *ppReader = NULL;
return code; return code;
} }
...@@ -72,8 +62,8 @@ int32_t vnodeSnapReaderClose(SVSnapReader *pReader) { ...@@ -72,8 +62,8 @@ int32_t vnodeSnapReaderClose(SVSnapReader *pReader) {
int32_t code = 0; int32_t code = 0;
vnodeFree(pReader->pData); vnodeFree(pReader->pData);
tsdbSnapReaderClose(pReader->pTsdbReader); if (pReader->pTsdbReader) tsdbSnapReaderClose(pReader->pTsdbReader);
metaSnapReaderClose(pReader->pMetaReader); if (pReader->pMetaReader) metaSnapReaderClose(pReader->pMetaReader);
taosMemoryFree(pReader); taosMemoryFree(pReader);
return code; return code;
...@@ -93,7 +83,7 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, const void **ppData, uint32_t *nDat ...@@ -93,7 +83,7 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, const void **ppData, uint32_t *nDat
} else { } else {
*ppData = pReader->pData; *ppData = pReader->pData;
*nData = pReader->nData; *nData = pReader->nData;
return code; goto _exit;
} }
} }
...@@ -108,15 +98,27 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, const void **ppData, uint32_t *nDat ...@@ -108,15 +98,27 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, const void **ppData, uint32_t *nDat
} else { } else {
*ppData = pReader->pData; *ppData = pReader->pData;
*nData = pReader->nData; *nData = pReader->nData;
return code; goto _exit;
} }
} }
code = TSDB_CODE_VND_READ_END; code = TSDB_CODE_VND_READ_END;
_exit:
return code;
_err:
vError("vgId:% snapshot read failed since %s", TD_VID(pReader->pVnode), tstrerror(code));
return code; return code;
} }
// SVSnapWriter ======================================================== // SVSnapWriter ========================================================
struct SVSnapWriter {
SVnode *pVnode;
int64_t sver;
int64_t ever;
};
int32_t vnodeSnapshotWriterOpen(SVnode *pVnode, int64_t sver, int64_t ever, SVSnapWriter **ppWriter) { int32_t vnodeSnapshotWriterOpen(SVnode *pVnode, int64_t sver, int64_t ever, SVSnapWriter **ppWriter) {
int32_t code = 0; int32_t code = 0;
SVSnapWriter *pWriter = NULL; SVSnapWriter *pWriter = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册