diff --git a/source/dnode/vnode/src/tsdb/dev/dev.h b/source/dnode/vnode/src/tsdb/dev/dev.h index dec43b2a9a..401618f980 100644 --- a/source/dnode/vnode/src/tsdb/dev/dev.h +++ b/source/dnode/vnode/src/tsdb/dev/dev.h @@ -26,6 +26,8 @@ extern "C" { #include "tsdbFile.h" +#include "tsdbFileOp.h" + #include "tsdbFS.h" #include "tsdbSttFWriter.h" diff --git a/source/dnode/vnode/src/tsdb/dev/tsdbCommit.c b/source/dnode/vnode/src/tsdb/dev/tsdbCommit.c index d73174eba8..28b7a6276a 100644 --- a/source/dnode/vnode/src/tsdb/dev/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/dev/tsdbCommit.c @@ -33,6 +33,7 @@ typedef struct { TSKEY minKey; TSKEY maxKey; // writer + SArray *aFileOp; struct SSttFWriter *pWriter; } SCommitter; @@ -358,7 +359,7 @@ _exit: return code; } -int32_t tsdbCommitRollback(STsdb *pTsdb) { +int32_t tsdbCommitAbort(STsdb *pTsdb) { int32_t code = 0; int32_t lino = 0; diff --git a/source/dnode/vnode/src/tsdb/dev/tsdbFile.c b/source/dnode/vnode/src/tsdb/dev/tsdbFile.c index d95c61a3cc..5306d2bcd6 100644 --- a/source/dnode/vnode/src/tsdb/dev/tsdbFile.c +++ b/source/dnode/vnode/src/tsdb/dev/tsdbFile.c @@ -15,15 +15,6 @@ #include "dev.h" -typedef enum { - TSDB_FOP_CREATE = -2, // create a file - TSDB_FOP_EXTEND, // extend a file - TSDB_FOP_NONE, // no operation - TSDB_FOP_TRUNCATE, // truncate a file - TSDB_FOP_DELETE, // delete a file - TSDB_FOP_MAX, -} tsdb_fop_t; - const char *tsdb_ftype_suffix[] = { ".head", // TSDB_FTYPE_HEAD ".data", // TSDB_FTYPE_DATA @@ -33,14 +24,6 @@ const char *tsdb_ftype_suffix[] = { ".stt", }; -struct SFileOp { - tsdb_fop_t op; - union { - struct { - } create; - }; -}; - int32_t tsdbTFileInit(STsdb *pTsdb, struct STFile *pFile) { SVnode *pVnode = pTsdb->pVnode; STfs *pTfs = pVnode->pTfs; diff --git a/source/dnode/vnode/src/tsdb/dev/tsdbFileOp.h b/source/dnode/vnode/src/tsdb/dev/tsdbFileOp.h new file mode 100644 index 0000000000..30ea8b6aca --- /dev/null +++ b/source/dnode/vnode/src/tsdb/dev/tsdbFileOp.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _TSDB_FILE_OP_H +#define _TSDB_FILE_OP_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exposed Handle */ +typedef enum { + TSDB_FOP_EXTEND = -2, + TSDB_FOP_CREATE, + TSDB_FOP_NONE, + TSDB_FOP_DELETE, + TSDB_FOP_TRUNCATE, +} EFileOpType; + +struct SFileOp { + EFileOpType op; + // TODO +}; + +/* Exposed APIs */ + +/* Exposed Structs */ + +#ifdef __cplusplus +} +#endif + +#endif /*_TSDB_FILE_OP_H*/ \ No newline at end of file diff --git a/source/dnode/vnode/src/tsdb/dev/tsdbMerge.c b/source/dnode/vnode/src/tsdb/dev/tsdbMerge.c new file mode 100644 index 0000000000..2c548fe8b8 --- /dev/null +++ b/source/dnode/vnode/src/tsdb/dev/tsdbMerge.c @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "dev.h" + +typedef struct { + STsdb *pTsdb; +} SMerger; + +int32_t tsdbMergeBegin(STsdb *pTsdb) { + int32_t code = 0; + // TODO + return code; +} + +int32_t tsdbMergeCommit(STsdb *pTsdb) { + int32_t code = 0; + // TODO + return code; +} + +int32_t tsdbMergeAbort(STsdb *pTsdb) { + int32_t code = 0; + // TODO + return code; +} \ No newline at end of file