From d65956d1a33cac4ed52236fa77f09cbeb8f8fbe6 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Tue, 23 Aug 2022 10:59:30 +0800 Subject: [PATCH] more code --- source/dnode/vnode/CMakeLists.txt | 2 ++ source/dnode/vnode/src/tsdb/tsdbCommit.c | 5 ++--- source/dnode/vnode/src/tsdb/tsdbCompact.c | 27 +++++++++++++++++++++++ source/dnode/vnode/src/tsdb/tsdbMerge.c | 27 +++++++++++++++++++++++ 4 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 source/dnode/vnode/src/tsdb/tsdbCompact.c create mode 100644 source/dnode/vnode/src/tsdb/tsdbMerge.c diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index 0944a6efbc..a3ddad72fc 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -51,6 +51,8 @@ target_sources( "src/tsdb/tsdbRetention.c" "src/tsdb/tsdbDiskData.c" "src/tsdb/tsdbCompress.c" + "src/tsdb/tsdbMerge.c" + "src/tsdb/tsdbCompact.c" # tq "src/tq/tq.c" diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index 59afec00ba..bd0a87803c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -35,8 +35,8 @@ typedef struct { int32_t minRow; int32_t maxRow; int8_t cmprAlg; - SArray *aTbDataP; - STsdbFS fs; + SArray *aTbDataP; // memory + STsdbFS fs; // disk // -------------- TSKEY nextKey; // reset by each table commit int32_t commitFid; @@ -1278,7 +1278,6 @@ static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter) { code = TSDB_CODE_OUT_OF_MEMORY; goto _err; } - code = tsdbFSCopy(pTsdb, &pCommitter->fs); if (code) goto _err; diff --git a/source/dnode/vnode/src/tsdb/tsdbCompact.c b/source/dnode/vnode/src/tsdb/tsdbCompact.c new file mode 100644 index 0000000000..fb3917be64 --- /dev/null +++ b/source/dnode/vnode/src/tsdb/tsdbCompact.c @@ -0,0 +1,27 @@ +/* + * 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 "tsdb.h" + +typedef struct { + STsdb *pTsdb; + STsdbFS fs; +} STsdbCompactor; + +int32_t tsdbCompact(STsdb *pTsdb) { + int32_t code = 0; + // TODO + return code; +} diff --git a/source/dnode/vnode/src/tsdb/tsdbMerge.c b/source/dnode/vnode/src/tsdb/tsdbMerge.c new file mode 100644 index 0000000000..8b2685e97b --- /dev/null +++ b/source/dnode/vnode/src/tsdb/tsdbMerge.c @@ -0,0 +1,27 @@ +/* + * 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 "tsdb.h" + +typedef struct { + STsdb *pTsdb; + STsdbFS fs; +} STsdbMerger; + +int32_t tsdbMerge(STsdb *pTsdb) { + int32_t code = 0; + // TODO + return code; +} \ No newline at end of file