提交 f977a50e 编写于 作者: H Hongze Cheng

more vnode snapshot

上级 e2738567
...@@ -232,11 +232,12 @@ int32_t tsdbSnapReaderOpen(STsdb* pTsdb, int64_t sver, int64_t ever, STsdbSnapRe ...@@ -232,11 +232,12 @@ int32_t tsdbSnapReaderOpen(STsdb* pTsdb, int64_t sver, int64_t ever, STsdbSnapRe
goto _err; goto _err;
} }
tsdbInfo("vgId:%d vnode snapshot tsdb reader opened", TD_VID(pTsdb->pVnode));
*ppReader = pReader; *ppReader = pReader;
return code; return code;
_err: _err:
tsdbError("vgId:%d snapshot reader open failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code)); tsdbError("vgId:%d vnode snapshot tsdb reader open failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code));
*ppReader = NULL; *ppReader = NULL;
return code; return code;
} }
......
...@@ -55,9 +55,13 @@ _err: ...@@ -55,9 +55,13 @@ _err:
int32_t vnodeSnapReaderClose(SVSnapReader *pReader) { int32_t vnodeSnapReaderClose(SVSnapReader *pReader) {
int32_t code = 0; int32_t code = 0;
// tFree(pReader->pData); if (pReader->pTsdbReader) {
// if (pReader->pTsdbReader) tsdbSnapReaderClose(&pReader->pTsdbReader); tsdbSnapReaderClose(&pReader->pTsdbReader);
// if (pReader->pMetaReader) metaSnapReaderClose(&pReader->pMetaReader); }
if (pReader->pMetaReader) {
metaSnapReaderClose(&pReader->pMetaReader);
}
vInfo("vgId:%d vnode snapshot reader closed", TD_VID(pReader->pVnode)); vInfo("vgId:%d vnode snapshot reader closed", TD_VID(pReader->pVnode));
taosMemoryFree(pReader); taosMemoryFree(pReader);
...@@ -85,8 +89,6 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData) ...@@ -85,8 +89,6 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData)
pReader->metaDone = 1; pReader->metaDone = 1;
code = metaSnapReaderClose(&pReader->pMetaReader); code = metaSnapReaderClose(&pReader->pMetaReader);
if (code) goto _err; if (code) goto _err;
vInfo("vgId:%d vnode snapshot meta data read end, index:%" PRId64, TD_VID(pReader->pVnode), pReader->index);
} }
} }
} }
...@@ -94,23 +96,23 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData) ...@@ -94,23 +96,23 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData)
// TSDB ============== // TSDB ==============
if (!pReader->tsdbDone) { if (!pReader->tsdbDone) {
// open if not // open if not
// if (pReader->pTsdbReader == NULL) { if (pReader->pTsdbReader == NULL) {
// code = tsdbSnapReaderOpen(pReader->pVnode->pTsdb, pReader->sver, pReader->ever, &pReader->pTsdbReader); code = tsdbSnapReaderOpen(pReader->pVnode->pTsdb, pReader->sver, pReader->ever, &pReader->pTsdbReader);
// if (code) goto _err; if (code) goto _err;
// } }
// code = tsdbSnapRead(pReader->pTsdbReader, &pReader->pData); code = tsdbSnapRead(pReader->pTsdbReader, ppData);
// if (code) { if (code) {
// if (code == TSDB_CODE_VND_READ_END) { goto _err;
// pReader->tsdbDone = 1; } else {
// } else { if (*ppData) {
// goto _err; goto _exit;
// } } else {
// } else { pReader->tsdbDone = 1;
// *ppData = pReader->pData; code = tsdbSnapReaderClose(&pReader->pTsdbReader);
// *nData = sizeof(SSnapDataHdr) + ((SSnapDataHdr *)pReader->pData)->size; if (code) goto _err;
// goto _exit; }
// } }
} }
*ppData = NULL; *ppData = NULL;
...@@ -130,7 +132,7 @@ _exit: ...@@ -130,7 +132,7 @@ _exit:
return code; return code;
_err: _err:
vError("vgId:% snapshot read failed since %s", TD_VID(pReader->pVnode), tstrerror(code)); vError("vgId:% vnode snapshot read failed since %s", TD_VID(pReader->pVnode), tstrerror(code));
return code; return code;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册