more code

This commit is contained in:
Hongze Cheng 2023-04-11 15:34:40 +08:00
parent 2f51c609f4
commit 1df5680e9e
3 changed files with 49 additions and 9 deletions

View File

@ -356,12 +356,32 @@ static int32_t close_committer(SCommitter *pCommiter, int32_t eno) {
int32_t code = 0; int32_t code = 0;
int32_t lino; int32_t lino;
code = tsdbFileSystemEditBegin(pCommiter->pTsdb->pFS, // if (eno == 0) {
TSDB_CHECK_CODE( //
code = tsdbFileSystemEditBegin( //
pCommiter->pTsdb->pFS, //
pCommiter->aFileOp, // pCommiter->aFileOp, //
TSDB_FS_EDIT_COMMIT); TSDB_FS_EDIT_COMMIT),
TSDB_CHECK_CODE(code, lino, _exit); lino, //
_exit);
} else {
ASSERTS(0, "TODO: Not implemented yet");
}
_exit: _exit:
if (code) {
tsdbError( //
"vgId:%d %s failed at line %d since %s", //
TD_VID(pCommiter->pTsdb->pVnode), //
__func__, //
lino, //
tstrerror(code));
} else {
tsdbDebug( //
"vgId:%d %s done", //
TD_VID(pCommiter->pTsdb->pVnode), //
__func__);
}
return code; return code;
} }

View File

@ -345,13 +345,25 @@ static int32_t close_file_system(struct STFileSystem *pFS) {
return 0; return 0;
} }
static int32_t write_fs_to_file(struct STFileSystem *pFS, const char *fname) { static int32_t read_fs_from_file(struct STFileSystem *pFS, const char *fname) {
ASSERTS(0, "TODO: Not implemented yet"); ASSERTS(0, "TODO: Not implemented yet");
return 0; return 0;
} }
static int32_t read_fs_from_file(struct STFileSystem *pFS, const char *fname) { static int32_t edit_fs(struct STFileSystem *pFS, const SArray *aFileOp) {
ASSERTS(0, "TODO: Not implemented yet"); ASSERTS(0, "TODO: Not implemented yet");
for (int32_t iop = 0; iop < taosArrayGetSize(aFileOp); iop++) {
struct SFileOp *pOp = taosArrayGet(aFileOp, iop);
// if (pOp->op == TSDB_FS_OP_ADD) {
// ASSERTS(0, "TODO: Not implemented yet");
// } else if (pOp->op == TSDB_FS_OP_DEL) {
// ASSERTS(0, "TODO: Not implemented yet");
// } else {
// ASSERTS(0, "TODO: Not implemented yet");
// }
}
return 0; return 0;
} }
@ -392,15 +404,22 @@ int32_t tsdbCloseFileSystem(struct STFileSystem **ppFS) {
int32_t tsdbFileSystemEditBegin(struct STFileSystem *pFS, const SArray *aFileOp, tsdb_fs_edit_t etype) { int32_t tsdbFileSystemEditBegin(struct STFileSystem *pFS, const SArray *aFileOp, tsdb_fs_edit_t etype) {
int32_t code = 0; int32_t code = 0;
int32_t lino = 0; int32_t lino;
char fname[TSDB_FILENAME_LEN]; char fname[TSDB_FILENAME_LEN];
get_current_temp(pFS->pTsdb, fname, etype); get_current_temp(pFS->pTsdb, fname, etype);
tsem_wait(&pFS->canEdit); tsem_wait(&pFS->canEdit);
code = write_fs_to_file(pFS, fname); TSDB_CHECK_CODE( //
TSDB_CHECK_CODE(code, lino, _exit); code = edit_fs(pFS, aFileOp), //
lino, //
_exit);
TSDB_CHECK_CODE( //
code = save_fs_to_file(pFS, fname), //
lino, //
_exit);
_exit: _exit:
if (code) { if (code) {

View File

@ -28,6 +28,7 @@ struct STFileSystem {
tsem_t canEdit; tsem_t canEdit;
int64_t nextEditId; int64_t nextEditId;
SArray *aFileSet; // SArray<struct SFileSet> SArray *aFileSet; // SArray<struct SFileSet>
SArray *nState; // SArray<struct SFileSet>
}; };
typedef enum { typedef enum {