diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a05cc0224a1a4c9d82579721cd7870ec81766686..326f00dbbd5c4565c03b3c8b253d511d42b7668c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -12,7 +12,6 @@ ADD_SUBDIRECTORY(client)
ADD_SUBDIRECTORY(query)
ADD_SUBDIRECTORY(kit)
ADD_SUBDIRECTORY(plugins)
-ADD_SUBDIRECTORY(sdb)
ADD_SUBDIRECTORY(mnode)
ADD_SUBDIRECTORY(vnode)
ADD_SUBDIRECTORY(dnode)
diff --git a/src/dnode/CMakeLists.txt b/src/dnode/CMakeLists.txt
index 298eb6110c8dab7ac34a24446d851b37a6b5dace..d85782b463f4ca579c9874ee1050593ff01f40ca 100644
--- a/src/dnode/CMakeLists.txt
+++ b/src/dnode/CMakeLists.txt
@@ -13,7 +13,7 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
AUX_SOURCE_DIRECTORY(src SRC)
ADD_EXECUTABLE(taosd ${SRC})
- TARGET_LINK_LIBRARIES(taosd mnode sdb taos_static monitor http tsdb)
+ TARGET_LINK_LIBRARIES(taosd mnode taos_static monitor http tsdb)
#IF (TD_CLUSTER)
# TARGET_LINK_LIBRARIES(taosd dcluster)
diff --git a/src/mnode/CMakeLists.txt b/src/mnode/CMakeLists.txt
index 5bf4cfd604c81f14a95129bcd6887d2ca2904b4f..bacd7497ad5832b963db7d188550e4ce560829c7 100644
--- a/src/mnode/CMakeLists.txt
+++ b/src/mnode/CMakeLists.txt
@@ -13,7 +13,7 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
AUX_SOURCE_DIRECTORY(src SRC)
ADD_LIBRARY(mnode ${SRC})
- TARGET_LINK_LIBRARIES(mnode trpc tutil sdb pthread)
+ TARGET_LINK_LIBRARIES(mnode trpc tutil pthread)
IF (TD_CLUSTER)
TARGET_LINK_LIBRARIES(mnode)
diff --git a/src/sdb/inc/sdbint.h b/src/mnode/inc/mgmtSdb.h
similarity index 100%
rename from src/sdb/inc/sdbint.h
rename to src/mnode/inc/mgmtSdb.h
diff --git a/src/sdb/src/sdbEngine.c b/src/mnode/src/mgmtSdb.c
similarity index 97%
rename from src/sdb/src/sdbEngine.c
rename to src/mnode/src/mgmtSdb.c
index fbc41089d1c9917aa5adae26b0052450a44e844d..04802e77da0190f76f72dd9aecb7b04405211fee 100644
--- a/src/sdb/src/sdbEngine.c
+++ b/src/mnode/src/mgmtSdb.c
@@ -13,11 +13,11 @@
* along with this program. If not, see .
*/
+#define _DEFAULT_SOURCE
#include "os.h"
-
#include "sdb.h"
-#include "sdbint.h"
#include "tutil.h"
+#include "mgmtSdb.h"
#define abs(x) (((x) < 0) ? -(x) : (x))
@@ -1015,3 +1015,46 @@ void *sdbFetchRow(void *handle, void *pNode, void **ppRow) {
int64_t sdbGetId(void *handle) { return ((SSdbTable *)handle)->id; }
int64_t sdbGetNumOfRows(void *handle) { return ((SSdbTable *)handle)->numOfRows; }
+
+
+int32_t (*mpeerInitMnodesFp)(char *directory) = NULL;
+void (*mpeerCleanUpMnodesFp)() = NULL;
+int32_t (*mpeerForwardRequestFp)(SSdbTable *pTable, char type, void *cont, int32_t contLen) = NULL;
+
+char *sdbStatusStr[] = {
+ "offline",
+ "unsynced",
+ "syncing",
+ "serving",
+ "null"
+};
+
+char *sdbRoleStr[] = {
+ "unauthed",
+ "undecided",
+ "master",
+ "slave",
+ "null"
+};
+
+int32_t sdbForwardDbReqToPeer(SSdbTable *pTable, char type, char *data, int32_t dataLen) {
+ if (mpeerForwardRequestFp) {
+ return mpeerForwardRequestFp(pTable, type, data, dataLen);
+ } else {
+ return 0;
+ }
+}
+
+int32_t sdbInitPeers(char *directory) {
+ if (mpeerInitMnodesFp) {
+ return (*mpeerInitMnodesFp)(directory);
+ } else {
+ return 0;
+ }
+}
+
+void sdbCleanUpPeers() {
+ if (mpeerCleanUpMnodesFp) {
+ (*mpeerCleanUpMnodesFp)();
+ }
+}
diff --git a/src/sdb/CMakeLists.txt b/src/sdb/CMakeLists.txt
deleted file mode 100644
index 47ea6e15b8cf5d8ba6f5d24c562e2b133f58f5d0..0000000000000000000000000000000000000000
--- a/src/sdb/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-PROJECT(TDengine)
-
-INCLUDE_DIRECTORIES(${TD_OS_DIR}/inc)
-INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/inc)
-INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/util/inc)
-INCLUDE_DIRECTORIES(inc)
-
-IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
- AUX_SOURCE_DIRECTORY(src SRC)
- ADD_LIBRARY(sdb ${SRC})
- TARGET_LINK_LIBRARIES(sdb trpc)
- IF (TD_CLUSTER)
- TARGET_LINK_LIBRARIES(sdb)
- ENDIF()
-ENDIF ()
diff --git a/src/sdb/src/sdbstr.c b/src/sdb/src/sdbstr.c
deleted file mode 100644
index 59c01eb15a95a7354b5f37acb1d521a5e89c100d..0000000000000000000000000000000000000000
--- a/src/sdb/src/sdbstr.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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 .
- */
-#define _DEFAULT_SOURCE
-#include "sdbint.h"
-
-int32_t (*mpeerInitMnodesFp)(char *directory) = NULL;
-void (*mpeerCleanUpMnodesFp)() = NULL;
-int32_t (*mpeerForwardRequestFp)(SSdbTable *pTable, char type, void *cont, int32_t contLen) = NULL;
-
-char *sdbStatusStr[] = {
- "offline",
- "unsynced",
- "syncing",
- "serving",
- "null"
-};
-
-char *sdbRoleStr[] = {
- "unauthed",
- "undecided",
- "master",
- "slave",
- "null"
-};
-
-int32_t sdbForwardDbReqToPeer(SSdbTable *pTable, char type, char *data, int32_t dataLen) {
- if (mpeerForwardRequestFp) {
- return mpeerForwardRequestFp(pTable, type, data, dataLen);
- } else {
- return 0;
- }
-}
-
-int32_t sdbInitPeers(char *directory) {
- if (mpeerInitMnodesFp) {
- return (*mpeerInitMnodesFp)(directory);
- } else {
- return 0;
- }
-}
-
-void sdbCleanUpPeers() {
- if (mpeerCleanUpMnodesFp) {
- (*mpeerCleanUpMnodesFp)();
- }
-}
diff --git a/src/sdb/inc/hashint.h b/src/util/inc/hashint.h
similarity index 100%
rename from src/sdb/inc/hashint.h
rename to src/util/inc/hashint.h
diff --git a/src/sdb/inc/hashstr.h b/src/util/inc/hashstr.h
similarity index 100%
rename from src/sdb/inc/hashstr.h
rename to src/util/inc/hashstr.h
diff --git a/src/sdb/src/hashint.c b/src/util/src/hashint.c
similarity index 100%
rename from src/sdb/src/hashint.c
rename to src/util/src/hashint.c
diff --git a/src/sdb/src/hashstr.c b/src/util/src/hashstr.c
similarity index 100%
rename from src/sdb/src/hashstr.c
rename to src/util/src/hashstr.c