未验证 提交 66a3a4b5 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #16693 from taosdata/feature/3.0_interval_hash_optimize

fix: rsma qtaskfile restore
...@@ -1342,18 +1342,19 @@ static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskInfoIter *pIter, bool *isF ...@@ -1342,18 +1342,19 @@ static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskInfoIter *pIter, bool *isF
return TSDB_CODE_FAILED; return TSDB_CODE_FAILED;
} }
if (tdReadTFile(pTFile, pIter->qBuf, nBytes) != nBytes) { if (tdReadTFile(pTFile, pIter->pBuf, nBytes) != nBytes) {
return TSDB_CODE_FAILED; return TSDB_CODE_FAILED;
} }
int32_t infoLen = 0; int32_t infoLen = 0;
taosDecodeFixedI32(pIter->qBuf, &infoLen); taosDecodeFixedI32(pIter->pBuf, &infoLen);
if (infoLen > nBytes) { if (infoLen > nBytes) {
if (infoLen <= RSMA_QTASKINFO_BUFSIZE) { if (infoLen <= RSMA_QTASKINFO_BUFSIZE) {
terrno = TSDB_CODE_RSMA_FILE_CORRUPTED; terrno = TSDB_CODE_RSMA_FILE_CORRUPTED;
smaError("iterate rsma qtaskinfo file %s failed since %s", TD_TFILE_FULL_NAME(pIter->pTFile), terrstr()); smaError("iterate rsma qtaskinfo file %s failed since %s", TD_TFILE_FULL_NAME(pIter->pTFile), terrstr());
return TSDB_CODE_FAILED; return TSDB_CODE_FAILED;
} }
if (pIter->nAlloc < infoLen) {
pIter->nAlloc = infoLen; pIter->nAlloc = infoLen;
void *pBuf = taosMemoryRealloc(pIter->pBuf, infoLen); void *pBuf = taosMemoryRealloc(pIter->pBuf, infoLen);
if (!pBuf) { if (!pBuf) {
...@@ -1361,10 +1362,11 @@ static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskInfoIter *pIter, bool *isF ...@@ -1361,10 +1362,11 @@ static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskInfoIter *pIter, bool *isF
return TSDB_CODE_FAILED; return TSDB_CODE_FAILED;
} }
pIter->pBuf = pBuf; pIter->pBuf = pBuf;
pIter->qBuf = pIter->pBuf; }
nBytes = infoLen; nBytes = infoLen;
if (tdSeekTFile(pTFile, pIter->offset, SEEK_SET)) { if (tdSeekTFile(pTFile, pIter->offset, SEEK_SET) < 0) {
return TSDB_CODE_FAILED; return TSDB_CODE_FAILED;
} }
...@@ -1373,6 +1375,7 @@ static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskInfoIter *pIter, bool *isF ...@@ -1373,6 +1375,7 @@ static int32_t tdRSmaQTaskInfoIterNextBlock(SRSmaQTaskInfoIter *pIter, bool *isF
} }
} }
pIter->qBuf = pIter->pBuf;
pIter->offset += nBytes; pIter->offset += nBytes;
pIter->nBytes = nBytes; pIter->nBytes = nBytes;
pIter->nBufPos = 0; pIter->nBufPos = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册