fix stream transfer err
This commit is contained in:
parent
51f1798474
commit
2e7d041e0a
|
@ -19,7 +19,6 @@
|
||||||
#include "streamBackendRocksdb.h"
|
#include "streamBackendRocksdb.h"
|
||||||
#include "streamInt.h"
|
#include "streamInt.h"
|
||||||
#include "tcommon.h"
|
#include "tcommon.h"
|
||||||
#include "streamInt.h"
|
|
||||||
|
|
||||||
enum SBackendFileType {
|
enum SBackendFileType {
|
||||||
ROCKSDB_OPTIONS_TYPE = 1,
|
ROCKSDB_OPTIONS_TYPE = 1,
|
||||||
|
@ -52,6 +51,7 @@ struct SStreamSnapHandle {
|
||||||
int8_t filetype;
|
int8_t filetype;
|
||||||
SArray* pFileList;
|
SArray* pFileList;
|
||||||
int32_t currFileIdx;
|
int32_t currFileIdx;
|
||||||
|
int8_t delFlag; // 0 : not del, 1: del
|
||||||
};
|
};
|
||||||
struct SStreamSnapBlockHdr {
|
struct SStreamSnapBlockHdr {
|
||||||
int8_t type;
|
int8_t type;
|
||||||
|
@ -274,7 +274,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);
|
||||||
|
@ -308,6 +308,7 @@ int32_t streamSnapReaderOpen(void* pMeta, int64_t sver, int64_t chkpId, char* pa
|
||||||
taosMemoryFree(pReader);
|
taosMemoryFree(pReader);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
pReader->handle.delFlag = 1;
|
||||||
|
|
||||||
*ppReader = pReader;
|
*ppReader = pReader;
|
||||||
|
|
||||||
|
@ -344,7 +345,7 @@ 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);
|
||||||
|
@ -423,6 +424,7 @@ int32_t streamSnapWriterOpen(void* pMeta, int64_t sver, int64_t ever, char* path
|
||||||
pHandle->pFileList = list;
|
pHandle->pFileList = list;
|
||||||
pHandle->currFileIdx = 0;
|
pHandle->currFileIdx = 0;
|
||||||
pHandle->offset = 0;
|
pHandle->offset = 0;
|
||||||
|
pHandle->delFlag = 0;
|
||||||
|
|
||||||
*ppWriter = pWriter;
|
*ppWriter = pWriter;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue