more code
This commit is contained in:
parent
cfb8cdb991
commit
708fa269b5
|
@ -1083,6 +1083,9 @@ void tsdbRemoveFile(const char *path);
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
int32_t tsdbAllocateDisk(STsdb *tsdb, int32_t fid, const char *label, SDiskID *diskId);
|
||||
int32_t tsdbAllocateDiskAtLevel(STsdb *tsdb, int32_t fid, int32_t level, const char *label, SDiskID *diskId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -79,7 +79,6 @@ typedef struct SDataFileRAWWriterConfig {
|
|||
STsdb *tsdb;
|
||||
int32_t szPage;
|
||||
|
||||
SDiskID did;
|
||||
int64_t fid;
|
||||
int64_t cid;
|
||||
int32_t level;
|
||||
|
@ -105,8 +104,8 @@ int32_t tsdbDataFileRAWWriterOpen(const SDataFileRAWWriterConfig *config, SDataF
|
|||
int32_t tsdbDataFileRAWWriterClose(SDataFileRAWWriter **writer, bool abort, TFileOpArray *opArr);
|
||||
|
||||
int32_t tsdbDataFileRAWWriterDoOpen(SDataFileRAWWriter *writer);
|
||||
int32_t tsdbDataFileRAWWriteBlockData(SDataFileRAWWriter *writer, const STsdbDataRAWBlockHeader *bHdr,
|
||||
int32_t encryptAlgorithm, char* encryptKey);
|
||||
int32_t tsdbDataFileRAWWriteBlockData(SDataFileRAWWriter *writer, const STsdbDataRAWBlockHeader *bHdr,
|
||||
int32_t encryptAlgorithm, char *encryptKey);
|
||||
int32_t tsdbDataFileRAWFlush(SDataFileRAWWriter *writer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -733,8 +733,6 @@ _exit:
|
|||
return code;
|
||||
}
|
||||
|
||||
extern int32_t tsdbAllocateDisk(STsdb *tsdb, int32_t fid, const char *label, SDiskID *diskId);
|
||||
|
||||
static int32_t tsdbDataFileWriterDoOpen(SDataFileWriter *writer) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
|
|
@ -74,11 +74,14 @@ static int32_t tsdbFSetRAWWriteFileDataBegin(SFSetRAWWriter *writer, STsdbDataRA
|
|||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
||||
SDiskID diskID = {0};
|
||||
code = tsdbAllocateDisk(writer->config->tsdb, bHdr->file.fid, tsdbFTypeLabel(bHdr->file.type), &diskID);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
SDataFileRAWWriterConfig config = {
|
||||
.tsdb = writer->config->tsdb,
|
||||
.szPage = writer->config->szPage,
|
||||
.fid = bHdr->file.fid,
|
||||
.did = writer->config->did,
|
||||
.cid = bHdr->file.cid,
|
||||
.level = writer->config->level,
|
||||
|
||||
|
@ -86,7 +89,7 @@ static int32_t tsdbFSetRAWWriteFileDataBegin(SFSetRAWWriter *writer, STsdbDataRA
|
|||
{
|
||||
.type = bHdr->file.type,
|
||||
.fid = bHdr->file.fid,
|
||||
.did = writer->config->did,
|
||||
.did = diskID,
|
||||
.cid = bHdr->file.cid,
|
||||
.size = bHdr->file.size,
|
||||
.minVer = bHdr->file.minVer,
|
||||
|
|
|
@ -26,7 +26,6 @@ typedef struct SFSetRAWWriterConfig {
|
|||
STsdb *tsdb;
|
||||
int32_t szPage;
|
||||
|
||||
SDiskID did;
|
||||
int64_t fid;
|
||||
int64_t cid;
|
||||
int32_t level;
|
||||
|
@ -36,8 +35,8 @@ typedef struct SFSetRAWWriter SFSetRAWWriter;
|
|||
|
||||
int32_t tsdbFSetRAWWriterOpen(SFSetRAWWriterConfig *config, SFSetRAWWriter **writer);
|
||||
int32_t tsdbFSetRAWWriterClose(SFSetRAWWriter **writer, bool abort, TFileOpArray *fopArr);
|
||||
int32_t tsdbFSetRAWWriteBlockData(SFSetRAWWriter *writer, STsdbDataRAWBlockHeader *bHdr, int32_t encryptAlgorithm,
|
||||
char* encryptKey);
|
||||
int32_t tsdbFSetRAWWriteBlockData(SFSetRAWWriter *writer, STsdbDataRAWBlockHeader *bHdr, int32_t encryptAlgorithm,
|
||||
char *encryptKey);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -240,8 +240,6 @@ _exit:
|
|||
return code;
|
||||
}
|
||||
|
||||
extern int32_t tsdbAllocateDiskAtLevel(STsdb *tsdb, int32_t fid, int32_t level, const char *label, SDiskID *diskId);
|
||||
|
||||
static int32_t tsdbRemoveOrMoveFileObject(SRTNer *rtner, STFileObj *fobj) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
|
|
@ -544,7 +544,6 @@ struct STsdbSnapWriter {
|
|||
bool fsetWriteBegin;
|
||||
int32_t fid;
|
||||
STFileSet* fset;
|
||||
SDiskID did;
|
||||
bool hasData; // if have time series data
|
||||
bool hasTomb; // if have tomb data
|
||||
|
||||
|
@ -826,15 +825,6 @@ static int32_t tsdbSnapWriteFileSetBegin(STsdbSnapWriter* writer, int32_t fid) {
|
|||
STFileSet** fsetPtr = TARRAY2_SEARCH(writer->fsetArr, &fset, tsdbTFileSetCmprFn, TD_EQ);
|
||||
writer->ctx->fset = (fsetPtr == NULL) ? NULL : *fsetPtr;
|
||||
|
||||
int32_t level = tsdbFidLevel(fid, &writer->tsdb->keepCfg, taosGetTimestampSec());
|
||||
if (tfsAllocDisk(writer->tsdb->pVnode->pTfs, level, &writer->ctx->did)) {
|
||||
code = TSDB_CODE_NO_AVAIL_DISK;
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
}
|
||||
if (tfsMkdirRecurAt(writer->tsdb->pVnode->pTfs, writer->tsdb->path, writer->ctx->did) != 0) {
|
||||
tsdbError("vgId:%d failed to create directory %s", TD_VID(writer->tsdb->pVnode), writer->tsdb->path);
|
||||
}
|
||||
|
||||
writer->ctx->hasData = true;
|
||||
writer->ctx->hasTomb = true;
|
||||
|
||||
|
|
|
@ -319,7 +319,6 @@ struct STsdbSnapRAWWriter {
|
|||
bool fsetWriteBegin;
|
||||
int32_t fid;
|
||||
STFileSet* fset;
|
||||
SDiskID did;
|
||||
int64_t cid;
|
||||
int64_t level;
|
||||
|
||||
|
@ -371,7 +370,6 @@ static int32_t tsdbSnapRAWWriteFileSetOpenWriter(STsdbSnapRAWWriter* writer) {
|
|||
.szPage = writer->szPage,
|
||||
.fid = writer->ctx->fid,
|
||||
.cid = writer->commitID,
|
||||
.did = writer->ctx->did,
|
||||
.level = writer->ctx->level,
|
||||
};
|
||||
|
||||
|
@ -399,17 +397,9 @@ static int32_t tsdbSnapRAWWriteFileSetBegin(STsdbSnapRAWWriter* writer, int32_t
|
|||
STFileSet** fsetPtr = TARRAY2_SEARCH(writer->fsetArr, &fset, tsdbTFileSetCmprFn, TD_EQ);
|
||||
writer->ctx->fset = (fsetPtr == NULL) ? NULL : *fsetPtr;
|
||||
|
||||
int32_t level = tsdbFidLevel(fid, &writer->tsdb->keepCfg, taosGetTimestampSec());
|
||||
code = tfsAllocDisk(writer->tsdb->pVnode->pTfs, level, &writer->ctx->did);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
code = tfsMkdirRecurAt(writer->tsdb->pVnode->pTfs, writer->tsdb->path, writer->ctx->did);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
code = tsdbSnapRAWWriteFileSetOpenWriter(writer);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
writer->ctx->level = level;
|
||||
writer->ctx->fsetWriteBegin = true;
|
||||
|
||||
_exit:
|
||||
|
|
|
@ -778,8 +778,6 @@ static int32_t tsdbSttFileDoWriteFooter(SSttFileWriter *writer) {
|
|||
return tsdbFileWriteSttFooter(writer->fd, writer->footer, &writer->file->size, encryptAlgorithm, encryptKey);
|
||||
}
|
||||
|
||||
extern int32_t tsdbAllocateDisk(STsdb *tsdb, int32_t fid, const char *label, SDiskID *diskId);
|
||||
|
||||
static int32_t tsdbSttFWriterDoOpen(SSttFileWriter *writer) {
|
||||
int32_t code = 0;
|
||||
int32_t lino = 0;
|
||||
|
|
Loading…
Reference in New Issue