fix: rsma qtaskfile restore
This commit is contained in:
parent
e7532dcfb5
commit
a929f837d4
|
@ -1342,29 +1342,31 @@ 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;
|
||||||
}
|
}
|
||||||
pIter->nAlloc = infoLen;
|
if (pIter->nAlloc < infoLen) {
|
||||||
void *pBuf = taosMemoryRealloc(pIter->pBuf, infoLen);
|
pIter->nAlloc = infoLen;
|
||||||
if (!pBuf) {
|
void *pBuf = taosMemoryRealloc(pIter->pBuf, infoLen);
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
if (!pBuf) {
|
||||||
return TSDB_CODE_FAILED;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pIter->qBuf = pIter->pBuf;
|
||||||
pIter->offset += nBytes;
|
pIter->offset += nBytes;
|
||||||
pIter->nBytes = nBytes;
|
pIter->nBytes = nBytes;
|
||||||
pIter->nBufPos = 0;
|
pIter->nBufPos = 0;
|
||||||
|
|
Loading…
Reference in New Issue