diff --git a/CMakeLists.txt b/CMakeLists.txt
index 65d1e133d7..f27f5f1672 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,7 +42,7 @@ if(${BUILD_WITH_LEVELDB})
endif(${BUILD_WITH_LEVELDB})
## rocksdb
-option(BUILD_WITH_ROCKSDB "If build with rocksdb" OFF)
+option(BUILD_WITH_ROCKSDB "If build with rocksdb" ON)
if(${BUILD_WITH_ROCKSDB})
cat("${CMAKE_SUPPORT_DIR}/rocksdb_CMakeLists.txt.in" ${DEPS_TMP_FILE})
endif(${BUILD_WITH_ROCKSDB})
diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt
index e28651824a..05c154af86 100644
--- a/deps/CMakeLists.txt
+++ b/deps/CMakeLists.txt
@@ -48,6 +48,7 @@ endif(${BUILD_WITH_LEVELDB})
if(${BUILD_WITH_ROCKSDB})
option(WITH_TESTS "" OFF)
option(WITH_BENCHMARK_TOOLS "" OFF)
+ option(ROCKSDB_BUILD_SHARED "Build shared versions of the RocksDB libraries" OFF)
add_subdirectory(rocksdb)
target_include_directories(
rocksdb
diff --git a/include/common/trow.h b/include/common/trow.h
index be4b7af32a..6094425bbf 100644
--- a/include/common/trow.h
+++ b/include/common/trow.h
@@ -20,6 +20,13 @@
extern "C" {
#endif
+typedef struct SRow SRow;
+
+#define rowType(r)
+#define rowLen(r)
+#define rowVersion(r)
+#define rowNCols(r)
+
#ifdef __cplusplus
}
#endif
diff --git a/source/server/vnode/CMakeLists.txt b/source/server/vnode/CMakeLists.txt
index 20b50bf244..5e11e45567 100644
--- a/source/server/vnode/CMakeLists.txt
+++ b/source/server/vnode/CMakeLists.txt
@@ -3,7 +3,7 @@ add_subdirectory(tq)
add_subdirectory(tsdb)
aux_source_directory(src VNODE_SRC)
-add_library(vnode ${VNODE_SRC})
+add_library(vnode STATIC ${VNODE_SRC})
target_include_directories(
vnode
PUBLIC "${CMAKE_SOURCE_DIR}/include/server/vnode"
diff --git a/source/server/vnode/meta/CMakeLists.txt b/source/server/vnode/meta/CMakeLists.txt
index 832e13a155..113bcd5d6f 100644
--- a/source/server/vnode/meta/CMakeLists.txt
+++ b/source/server/vnode/meta/CMakeLists.txt
@@ -1,5 +1,5 @@
aux_source_directory(src META_SRC)
-add_library(meta ${META_SRC})
+add_library(meta STATIC ${META_SRC})
target_include_directories(
meta
PUBLIC "${CMAKE_SOURCE_DIR}/include/server/vnode/meta"
@@ -8,4 +8,9 @@ target_include_directories(
target_link_libraries(
meta
PUBLIC common
-)
\ No newline at end of file
+)
+target_link_libraries(meta PUBLIC rocksdb)
+
+# if(${BUILD_TEST})
+# add_subdirectory(test)
+# endif(${BUILD_TEST})
diff --git a/source/server/vnode/meta/src/meta.c b/source/server/vnode/meta/src/meta.c
index d05fa1754f..f35de5eb9e 100644
--- a/source/server/vnode/meta/src/meta.c
+++ b/source/server/vnode/meta/src/meta.c
@@ -13,6 +13,72 @@
* along with this program. If not, see .
*/
+#include
+
+#include "thash.h"
+#include "tlist.h"
+#include "tlockfree.h"
+#include "ttypes.h"
+
#include "meta.h"
+typedef struct STable {
+ uint64_t uid;
+ tstr * name;
+ uint64_t suid;
+ SArray * schema;
+} STable;
+
+typedef struct STableObj {
+ bool pin;
+ uint64_t ref;
+ SRWLatch latch;
+ uint64_t offset;
+ SList * ctbList; // child table list
+ STable * pTable;
+} STableObj;
+
+struct SMeta {
+ pthread_rwlock_t rwLock;
+
+ SHashObj * pTableObjHash; // uid --> STableObj
+ SList * stbList; // super table list
+ rocksdb_t *tbnameDb; // tbname --> uid
+ rocksdb_t *tagDb; // uid --> tag
+ rocksdb_t *schemaDb;
+ size_t totalUsed;
+};
+
+SMeta *metaOpen(SMetaOptions *options) {
+ SMeta *pMeta = NULL;
+ char * err = NULL;
+
+ pMeta = (SMeta *)calloc(1, sizeof(*pMeta));
+ if (pMeta == NULL) {
+ return NULL;
+ }
+
+ pthread_rwlock_init(&(pMeta->rwLock), NULL);
+
+ pMeta->pTableObjHash = taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
+
+ pMeta->stbList = tdListNew(sizeof(STableObj *));
+
+ // Open tbname DB
+ rocksdb_options_t *tbnameDbOptions = rocksdb_options_create();
+ pMeta->tbnameDb = rocksdb_open(tbnameDbOptions, "tbname_uid_db", &err);
+
+ // Open tag DB
+ pMeta->tagDb = rocksdb_open(tbnameDbOptions, "uid_tag_db", &err);
+
+ // Open schema DB
+ pMeta->schemaDb = rocksdb_open(tbnameDbOptions, "schema_db", &err);
+
+ return pMeta;
+}
+
+void metaClose(SMeta *pMeta) {
+ // TODO
+}
+
int metaCommit(SMeta *meta) { return 0; }
\ No newline at end of file
diff --git a/source/server/vnode/meta/test/CMakeLists.txt b/source/server/vnode/meta/test/CMakeLists.txt
new file mode 100644
index 0000000000..ca82d3fb83
--- /dev/null
+++ b/source/server/vnode/meta/test/CMakeLists.txt
@@ -0,0 +1,18 @@
+add_executable(metaTest "")
+target_sources(metaTest
+ PRIVATE
+ "../src/meta.c"
+ "metaTests.cpp"
+)
+target_include_directories(metaTest
+ PUBLIC
+ "${CMAKE_SOURCE_DIR}/include/server/vnode/meta"
+ "${CMAKE_CURRENT_SOURCE_DIR}/../inc"
+)
+target_link_libraries(metaTest
+ os
+ util
+ common
+ rocksdb
+ gtest_main
+)
\ No newline at end of file
diff --git a/source/server/vnode/meta/test/metaTests.cpp b/source/server/vnode/meta/test/metaTests.cpp
index e69de29bb2..c62ae0aa02 100644
--- a/source/server/vnode/meta/test/metaTests.cpp
+++ b/source/server/vnode/meta/test/metaTests.cpp
@@ -0,0 +1,8 @@
+#include
+#include
+
+#include "meta.h"
+
+TEST(MetaTest, meta_open_test) {
+ std::cout << "Hello META!" << std::endl;
+}
\ No newline at end of file