Merge pull request #23598 from taosdata/fix/fixStreamTransferErrMain
Fix/fix stream transfer err main
This commit is contained in:
commit
056a225604
|
@ -51,6 +51,7 @@ struct SStreamSnapHandle {
|
||||||
int8_t filetype;
|
int8_t filetype;
|
||||||
SArray* pFileList;
|
SArray* pFileList;
|
||||||
int32_t currFileIdx;
|
int32_t currFileIdx;
|
||||||
|
int8_t delFlag;
|
||||||
};
|
};
|
||||||
struct SStreamSnapBlockHdr {
|
struct SStreamSnapBlockHdr {
|
||||||
int8_t type;
|
int8_t type;
|
||||||
|
@ -147,6 +148,7 @@ int32_t streamSnapHandleInit(SStreamSnapHandle* pHandle, char* path, int64_t chk
|
||||||
taosMemoryFree(tdir);
|
taosMemoryFree(tdir);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
pHandle->delFlag = 1;
|
||||||
chkpId = 0;
|
chkpId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +275,7 @@ void streamSnapHandleDestroy(SStreamSnapHandle* handle) {
|
||||||
if (handle->checkpointId == 0) {
|
if (handle->checkpointId == 0) {
|
||||||
// del tmp dir
|
// del tmp dir
|
||||||
if (pFile && taosIsDir(pFile->path)) {
|
if (pFile && taosIsDir(pFile->path)) {
|
||||||
taosRemoveDir(pFile->path);
|
if (handle->delFlag) taosRemoveDir(pFile->path);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
streamBackendDelInUseChkp(handle->handle, handle->checkpointId);
|
streamBackendDelInUseChkp(handle->handle, handle->checkpointId);
|
||||||
|
@ -343,10 +345,10 @@ int32_t streamSnapRead(SStreamSnapReader* pReader, uint8_t** ppData, int64_t* si
|
||||||
stDebug("%s start to read file %s, current offset:%" PRId64 ", size:%" PRId64 ", file no.%d", STREAM_STATE_TRANSFER,
|
stDebug("%s start to read file %s, current offset:%" PRId64 ", size:%" PRId64 ", file no.%d", STREAM_STATE_TRANSFER,
|
||||||
item->name, (int64_t)pHandle->offset, item->size, pHandle->currFileIdx);
|
item->name, (int64_t)pHandle->offset, item->size, pHandle->currFileIdx);
|
||||||
uint8_t* buf = taosMemoryCalloc(1, sizeof(SStreamSnapBlockHdr) + kBlockSize);
|
uint8_t* buf = taosMemoryCalloc(1, sizeof(SStreamSnapBlockHdr) + kBlockSize);
|
||||||
if(buf == NULL){
|
if (buf == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
int64_t nread = taosPReadFile(pHandle->fd, buf + sizeof(SStreamSnapBlockHdr), kBlockSize, pHandle->offset);
|
int64_t nread = taosPReadFile(pHandle->fd, buf + sizeof(SStreamSnapBlockHdr), kBlockSize, pHandle->offset);
|
||||||
if (nread == -1) {
|
if (nread == -1) {
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
code = TAOS_SYSTEM_ERROR(terrno);
|
code = TAOS_SYSTEM_ERROR(terrno);
|
||||||
|
|
Loading…
Reference in New Issue