Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_46246346
TDengine
提交
f956c90b
TDengine
项目概览
weixin_46246346
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f956c90b
编写于
8月 05, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1057
上级
947ad27e
变更
27
展开全部
隐藏空白更改
内联
并排
Showing
27 changed file
with
135 addition
and
3429 deletion
+135
-3429
cmake/define.inc
cmake/define.inc
+26
-37
cmake/platform.inc
cmake/platform.inc
+36
-43
src/balance/CMakeLists.txt
src/balance/CMakeLists.txt
+9
-12
src/client/CMakeLists.txt
src/client/CMakeLists.txt
+2
-2
src/cq/CMakeLists.txt
src/cq/CMakeLists.txt
+5
-10
src/dnode/CMakeLists.txt
src/dnode/CMakeLists.txt
+9
-18
src/kit/CMakeLists.txt
src/kit/CMakeLists.txt
+1
-3
src/kit/shell/CMakeLists.txt
src/kit/shell/CMakeLists.txt
+2
-8
src/kit/taosdemo/CMakeLists.txt
src/kit/taosdemo/CMakeLists.txt
+2
-5
src/kit/taosdump/CMakeLists.txt
src/kit/taosdump/CMakeLists.txt
+0
-23
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+0
-2235
src/kit/taosmigrate/CMakeLists.txt
src/kit/taosmigrate/CMakeLists.txt
+0
-18
src/kit/taosmigrate/taosmigrate.c
src/kit/taosmigrate/taosmigrate.c
+0
-225
src/kit/taosmigrate/taosmigrate.h
src/kit/taosmigrate/taosmigrate.h
+0
-77
src/kit/taosmigrate/taosmigrateDnodeCfg.c
src/kit/taosmigrate/taosmigrateDnodeCfg.c
+0
-156
src/kit/taosmigrate/taosmigrateMnodeWal.c
src/kit/taosmigrate/taosmigrateMnodeWal.c
+0
-145
src/kit/taosmigrate/taosmigrateVnodeCfg.c
src/kit/taosmigrate/taosmigrateVnodeCfg.c
+0
-332
src/mnode/CMakeLists.txt
src/mnode/CMakeLists.txt
+1
-2
src/plugins/http/CMakeLists.txt
src/plugins/http/CMakeLists.txt
+9
-13
src/plugins/monitor/CMakeLists.txt
src/plugins/monitor/CMakeLists.txt
+4
-8
src/plugins/mqtt/CMakeLists.txt
src/plugins/mqtt/CMakeLists.txt
+4
-9
src/query/CMakeLists.txt
src/query/CMakeLists.txt
+3
-7
src/sync/CMakeLists.txt
src/sync/CMakeLists.txt
+4
-9
src/tsdb/CMakeLists.txt
src/tsdb/CMakeLists.txt
+3
-9
src/util/CMakeLists.txt
src/util/CMakeLists.txt
+3
-3
src/vnode/CMakeLists.txt
src/vnode/CMakeLists.txt
+7
-12
src/wal/CMakeLists.txt
src/wal/CMakeLists.txt
+5
-8
未找到文件。
cmake/define.inc
浏览文件 @
f956c90b
...
...
@@ -29,41 +29,30 @@ IF (TD_RANDOM_NETWORK_FAIL)
ADD_DEFINITIONS
(
-
DTAOS_RANDOM_NETWORK_FAIL
)
ENDIF
()
IF
(
TD_ARM
)
ADD_DEFINITIONS
(
-
D_TD_ARM_
)
IF
(
TD_ARM_64
)
ADD_DEFINITIONS
(
-
D_TD_ARM_64_
)
ENDIF
()
IF
(
TD_ARM_32
)
ADD_DEFINITIONS
(
-
D_TD_ARM_32_
)
ENDIF
()
IF
(
TD_ARM_64
)
ADD_DEFINITIONS
(
-
D_TD_ARM_64_
)
SET
(
COMMON_FLAGS
"-std=gnu99 -Wall -Werror -fPIC -g -fsigned-char -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE"
)
ENDIF
()
IF
(
TD_MIPS
)
ADD_DEFINITIONS
(
-
D_TD_MIPS_
)
IF
(
TD_MIPS_64
)
ADD_DEFINITIONS
(
-
D_TD_MIPS_64_
)
ENDIF
()
IF
(
TD_MIPS_32
)
ADD_DEFINITIONS
(
-
D_TD_MIPS_32_
)
ENDIF
()
IF
(
TD_ARM_32
)
ADD_DEFINITIONS
(
-
D_TD_ARM_32_
)
SET
(
COMMON_FLAGS
"-std=gnu99 -Wall -Werror -fPIC -g -fsigned-char -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE"
)
ENDIF
()
IF
(
TD_MIPS_64
)
ADD_DEFINITIONS
(
-
D_TD_MIPS_64_
)
SET
(
COMMON_FLAGS
"-std=gnu99 -Wall -Werror -fPIC -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE"
)
ENDIF
()
IF
(
TD_MIPS_32
)
ADD_DEFINITIONS
(
-
D_TD_MIPS_32_
)
SET
(
COMMON_FLAGS
"-std=gnu99 -Wall -Werror -fPIC -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE"
)
ENDIF
()
IF
(
TD_LINUX_64
)
ADD_DEFINITIONS
(
-
D_M_X64
)
ADD_DEFINITIONS
(
-
D_TD_LINUX_64
)
IF
(
NOT
TD_ARM
)
#IF ((${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") OR (${CMAKE_CXX_COMPILER_ID} MATCHES "clang"))
# SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -Wno-missing-braces -fPIC -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
#ELSE ()
# SET(COMMON_FLAGS "-std=gnu99 -Wall -Werror -fPIC -malign-double -g3 -gdwarf-2 -malign-stringops -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE")
#ENDIF ()
SET
(
COMMON_FLAGS
"-std=gnu99 -Wall -Werror -fPIC -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE"
)
ELSE
()
SET
(
COMMON_FLAGS
"-std=gnu99 -Wall -Werror -fPIC -g -fsigned-char -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE"
)
ENDIF
()
MESSAGE
(
STATUS
"CMAKE_CXX_COMPILER_ID: "
$
{
CMAKE_CXX_COMPILER_ID
})
MESSAGE
(
STATUS
"COMMON_FLAGS: "
$
{
COMMON_FLAGS
})
SET
(
COMMON_FLAGS
"-std=gnu99 -Wall -Werror -fPIC -g3 -gdwarf-2 -msse4.2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE"
)
FIND_PATH
(
ICONV_INCLUDE_EXIST
iconv
.
h
/
usr
/
include
/
/
usr
/
local
/
include
/
)
IF
(
ICONV_INCLUDE_EXIST
)
...
...
@@ -75,13 +64,17 @@ IF (TD_LINUX_32)
ADD_DEFINITIONS
(
-
D_TD_LINUX_32
)
ADD_DEFINITIONS
(
-
DUSE_LIBICONV
)
SET
(
COMMON_FLAGS
"-std=gnu99 -Wall -Werror -fPIC -g -fsigned-char -munaligned-access -fpack-struct=8 -latomic -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE"
)
IF
(
NOT
TD_ARM
)
EXIT
()
ENDIF
()
ENDIF
()
IF
(
TD_APLHINE
)
SET
(
COMMON_FLAGS
"${COMMON_FLAGS} -largp"
)
link_libraries
(
/
usr
/
lib
/
libargp
.
a
)
ADD_DEFINITIONS
(
-
D_ALPINE
)
ENDIF
()
IF
(
TD_LINUX
)
ADD_DEFINITIONS
(
-
DLINUX
)
ADD_DEFINITIONS
(
-
D_LINUX
)
ADD_DEFINITIONS
(
-
D_TD_LINUX
)
ADD_DEFINITIONS
(
-
D_REENTRANT
-
D__USE_POSIX
-
D_LIBC_REENTRANT
)
...
...
@@ -99,12 +92,6 @@ IF (TD_LINUX)
INCLUDE_DIRECTORIES
(
$
{
TD_COMMUNITY_DIR
}
/
deps
/
lz4
/
inc
)
ENDIF
()
IF
(
TD_APLHINE
)
SET
(
COMMON_FLAGS
"${COMMON_FLAGS} -largp"
)
link_libraries
(
/
usr
/
lib
/
libargp
.
a
)
ADD_DEFINITIONS
(
-
D_ALPINE
)
ENDIF
()
IF
(
TD_DARWIN_64
)
ADD_DEFINITIONS
(
-
D_TD_DARWIN_64
)
ADD_DEFINITIONS
(
-
DDARWIN
)
...
...
@@ -148,3 +135,5 @@ INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/inc)
INCLUDE_DIRECTORIES
(
$
{
TD_COMMUNITY_DIR
}
/
src
/
os
/
inc
)
INCLUDE_DIRECTORIES
(
$
{
TD_COMMUNITY_DIR
}
/
src
/
util
/
inc
)
INCLUDE_DIRECTORIES
(
$
{
TD_COMMUNITY_DIR
}
/
src
/
common
/
inc
)
MESSAGE
(
STATUS
"CMAKE_CXX_COMPILER_ID: "
$
{
CMAKE_CXX_COMPILER_ID
})
cmake/platform.inc
浏览文件 @
f956c90b
...
...
@@ -15,44 +15,18 @@ PROJECT(TDengine)
# Set macro definitions according to os platform
SET
(
TD_LINUX
FALSE
)
SET
(
TD_LINUX_64
FALSE
)
SET
(
TD_LINUX_32
FALSE
)
SET
(
TD_ARM
FALSE
)
SET
(
TD_ARM_64
FALSE
)
SET
(
TD_ARM_32
FALSE
)
SET
(
TD_MIPS
FALSE
)
SET
(
TD_MIPS_64
FALSE
)
SET
(
TD_MIPS_32
FALSE
)
SET
(
TD_LINUX_64
FALSE
)
SET
(
TD_LINUX_32
FALSE
)
SET
(
TD_ARM_64
FALSE
)
SET
(
TD_ARM_32
FALSE
)
SET
(
TD_MIPS_64
FALSE
)
SET
(
TD_MIPS_32
FALSE
)
SET
(
TD_APLHINE
FALSE
)
SET
(
TD_WINDOWS
FALSE
)
SET
(
TD_WINDOWS_64
FALSE
)
SET
(
TD_WINDOWS_32
FALSE
)
SET
(
TD_DARWIN_64
FALSE
)
SET
(
TD_APLHINE
FALSE
)
# if generate ARM version:
# cmake -DCPUTYPE=aarch32 .. or cmake -DCPUTYPE=aarch64
IF
(
$
{
CPUTYPE
}
MATCHES
"aarch32"
)
SET
(
TD_ARM
TRUE
)
SET
(
TD_ARM_32
TRUE
)
SET
(
TD_PAGMODE_LITE
TRUE
)
MESSAGE
(
STATUS
"input cpuType: aarch32"
)
ELSEIF
(
$
{
CPUTYPE
}
MATCHES
"aarch64"
)
SET
(
TD_ARM
TRUE
)
SET
(
TD_ARM_64
TRUE
)
MESSAGE
(
STATUS
"input cpuType: aarch64"
)
ELSEIF
(
$
{
CPUTYPE
}
MATCHES
"mips64"
)
SET
(
TD_MIPS
TRUE
)
SET
(
TD_MIPS_64
TRUE
)
MESSAGE
(
STATUS
"input cpuType: mips64"
)
ELSEIF
(
$
{
CPUTYPE
}
MATCHES
"x64"
)
MESSAGE
(
STATUS
"input cpuType: x64"
)
ELSEIF
(
$
{
CPUTYPE
}
MATCHES
"x86"
)
MESSAGE
(
STATUS
"input cpuType: x86"
)
ELSE
()
MESSAGE
(
STATUS
"input cpuType unknown "
$
{
CPUTYPE
})
ENDIF
()
SET
(
TD_WINDOWS_64
FALSE
)
SET
(
TD_WINDOWS_32
FALSE
)
SET
(
TD_DARWIN
FALSE
)
SET
(
TD_DARWIN_64
FALSE
)
IF
(
$
{
CMAKE_SYSTEM_NAME
}
MATCHES
"Linux"
)
#
...
...
@@ -68,12 +42,8 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
MESSAGE
(
STATUS
"The current platform is Linux 64-bit"
)
ELSEIF
(
$
{
CMAKE_SIZEOF_VOID_P
}
MATCHES
4
)
SET
(
TD_LINUX_32
TRUE
)
IF
(
TD_ARM
)
MESSAGE
(
STATUS
"The current platform is Linux 32-bit"
)
ELSE
()
MESSAGE
(
FATAL_ERROR
"The current platform is Linux 32-bit, but no ARM not supported yet"
)
EXIT
()
ENDIF
()
MESSAGE
(
STATUS
"The current platform is Linux 32-bit"
)
ELSE
()
MESSAGE
(
FATAL_ERROR
"The current platform is Linux neither 32-bit nor 64-bit, not supported yet"
)
EXIT
()
...
...
@@ -84,6 +54,7 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
MESSAGE
(
STATUS
"The current OS is Alpine, append extra flags"
)
ENDIF
()
ELSEIF
(
$
{
CMAKE_SYSTEM_NAME
}
MATCHES
"Darwin"
)
SET
(
TD_DARWIN
TRUE
)
IF
(
$
{
CMAKE_SIZEOF_VOID_P
}
MATCHES
8
)
SET
(
TD_DARWIN_64
TRUE
)
MESSAGE
(
STATUS
"The current platform is Darwin 64-bit"
)
...
...
@@ -105,3 +76,25 @@ ELSE()
MESSAGE
(
FATAL_ERROR
"The current platform is not Linux/Darwin/Windows, stop compile"
)
EXIT
()
ENDIF
()
# if generate ARM version:
# cmake -DCPUTYPE=aarch32 .. or cmake -DCPUTYPE=aarch64
IF
(
$
{
CPUTYPE
}
MATCHES
"aarch32"
)
SET
(
TD_LINUX
TRUE
)
SET
(
TD_ARM_32
TRUE
)
MESSAGE
(
STATUS
"input cpuType: aarch32"
)
ELSEIF
(
$
{
CPUTYPE
}
MATCHES
"aarch64"
)
SET
(
TD_LINUX
TRUE
)
SET
(
TD_ARM_64
TRUE
)
MESSAGE
(
STATUS
"input cpuType: aarch64"
)
ELSEIF
(
$
{
CPUTYPE
}
MATCHES
"mips64"
)
SET
(
TD_LINUX
TRUE
)
SET
(
TD_MIPS_64
TRUE
)
MESSAGE
(
STATUS
"input cpuType: mips64"
)
ELSEIF
(
$
{
CPUTYPE
}
MATCHES
"x64"
)
MESSAGE
(
STATUS
"input cpuType: x64"
)
ELSEIF
(
$
{
CPUTYPE
}
MATCHES
"x86"
)
MESSAGE
(
STATUS
"input cpuType: x86"
)
ELSE
()
MESSAGE
(
STATUS
"input cpuType unknown "
$
{
CPUTYPE
})
ENDIF
()
src/balance/CMakeLists.txt
浏览文件 @
f956c90b
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
IF
((
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
))
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/os/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/common/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/mnode/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/dnode/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/sdb/inc
)
INCLUDE_DIRECTORIES
(
${
TD_ENTERPRISE_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/mnode/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/dnode/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/sdb/inc
)
INCLUDE_DIRECTORIES
(
${
TD_ENTERPRISE_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
IF
(
TD_LINUX
)
ADD_LIBRARY
(
balance
${
SRC
}
)
ENDIF
()
ENDIF
()
\ No newline at end of file
src/client/CMakeLists.txt
浏览文件 @
f956c90b
...
...
@@ -6,7 +6,7 @@ INCLUDE_DIRECTORIES(jni)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
IF
(
(
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
)
)
IF
(
TD_LINUX
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/jni/linux
)
# set the static lib name
...
...
@@ -46,7 +46,7 @@ ELSEIF (TD_WINDOWS)
ENDIF
()
TARGET_LINK_LIBRARIES
(
taos trpc tutil
)
ELSEIF
(
TD_DARWIN
_64
)
ELSEIF
(
TD_DARWIN
)
SET
(
CMAKE_MACOSX_RPATH 1
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/jni/linux
)
...
...
src/cq/CMakeLists.txt
浏览文件 @
f956c90b
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/os/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/common/inc
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/src SRC
)
ADD_LIBRARY
(
tcq
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
tcq tutil common taos
)
ADD_SUBDIRECTORY
(
test
)
IF
(
TD_LINUX
)
ADD_LIBRARY
(
tcq
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
tcq tutil common taos
)
ADD_SUBDIRECTORY
(
test
)
ENDIF
()
src/dnode/CMakeLists.txt
浏览文件 @
f956c90b
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
IF
((
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
))
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/os/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/mnode/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/tsdb/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/common/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/cJson/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/lz4/inc
)
INCLUDE_DIRECTORIES
(
${
TD_ENTERPRISE_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/mnode/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/tsdb/inc
)
INCLUDE_DIRECTORIES
(
${
TD_ENTERPRISE_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
IF
(
TD_LINUX
)
ADD_EXECUTABLE
(
taosd
${
SRC
}
)
# TARGET_LINK_LIBRARIES(taosd mnode taos_static monitor http mqtt tsdb twal vnode cJson lz4 balance sync)
TARGET_LINK_LIBRARIES
(
taosd mnode taos monitor http mqtt tsdb twal vnode cJson lz4 balance sync
)
IF
(
TD_ACCOUNT
)
...
...
@@ -41,7 +35,4 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
COMMAND
${
CMAKE_COMMAND
}
-E echo charset UTF-8 >>
${
TD_TESTS_OUTPUT_DIR
}
/cfg/taos.cfg
COMMENT
"prepare taosd environment"
)
ADD_CUSTOM_TARGET
(
${
PREPARE_ENV_TARGET
}
ALL WORKING_DIRECTORY
${
TD_EXECUTABLE_OUTPUT_PATH
}
DEPENDS
${
PREPARE_ENV_CMD
}
)
ENDIF
()
ENDIF
()
\ No newline at end of file
src/kit/CMakeLists.txt
浏览文件 @
f956c90b
...
...
@@ -2,6 +2,4 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT
(
TDengine
)
ADD_SUBDIRECTORY
(
shell
)
ADD_SUBDIRECTORY
(
taosdemo
)
ADD_SUBDIRECTORY
(
taosdump
)
ADD_SUBDIRECTORY
(
taosmigrate
)
\ No newline at end of file
ADD_SUBDIRECTORY
(
taosdemo
)
\ No newline at end of file
src/kit/shell/CMakeLists.txt
浏览文件 @
f956c90b
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/os/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/client/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/common/inc
)
INCLUDE_DIRECTORIES
(
inc
)
IF
(
(
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
)
)
IF
(
TD_LINUX
)
AUX_SOURCE_DIRECTORY
(
./src SRC
)
LIST
(
REMOVE_ITEM SRC ./src/shellWindows.c
)
LIST
(
REMOVE_ITEM SRC ./src/shellDarwin.c
)
...
...
@@ -23,15 +19,13 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
SET_TARGET_PROPERTIES
(
shell PROPERTIES OUTPUT_NAME taos
)
ELSEIF
(
TD_WINDOWS
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/pthread
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/regex
)
LIST
(
APPEND SRC ./src/shellEngine.c
)
LIST
(
APPEND SRC ./src/shellMain.c
)
LIST
(
APPEND SRC ./src/shellWindows.c
)
ADD_EXECUTABLE
(
shell
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
shell taos_static
)
SET_TARGET_PROPERTIES
(
shell PROPERTIES OUTPUT_NAME taos
)
ELSEIF
(
TD_DARWIN
_64
)
ELSEIF
(
TD_DARWIN
)
LIST
(
APPEND SRC ./src/shellEngine.c
)
LIST
(
APPEND SRC ./src/shellMain.c
)
LIST
(
APPEND SRC ./src/shellDarwin.c
)
...
...
src/kit/taosdemo/CMakeLists.txt
浏览文件 @
f956c90b
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/os/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/client/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
inc
)
IF
(
(
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
)
)
IF
(
TD_LINUX
)
AUX_SOURCE_DIRECTORY
(
. SRC
)
ADD_EXECUTABLE
(
taosdemo
${
SRC
}
)
...
...
@@ -16,5 +13,5 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
# ELSE ()
# TARGET_LINK_LIBRARIES(taosdemo taos_static)
# ENDIF ()
ENDIF
()
src/kit/taosdump/CMakeLists.txt
已删除
100644 → 0
浏览文件 @
947ad27e
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/os/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/common/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/client/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
INCLUDE_DIRECTORIES
(
inc
)
IF
((
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
))
AUX_SOURCE_DIRECTORY
(
. SRC
)
ADD_EXECUTABLE
(
taosdump
${
SRC
}
)
# IF (TD_PAGMODE_LITE)
TARGET_LINK_LIBRARIES
(
taosdump taos
)
# ELSE ()
# TARGET_LINK_LIBRARIES(taosdump taos_static)
# ENDIF ()
ENDIF
()
src/kit/taosdump/taosdump.c
已删除
100644 → 0
浏览文件 @
947ad27e
此差异已折叠。
点击以展开。
src/kit/taosmigrate/CMakeLists.txt
已删除
100644 → 0
浏览文件 @
947ad27e
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
IF
((
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
))
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/os/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/mnode/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/vnode/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/common/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/cJson/inc
)
AUX_SOURCE_DIRECTORY
(
. SRC
)
ADD_EXECUTABLE
(
taosmigrate
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
taosmigrate common cJson osdetail tutil
)
ENDIF
()
SET_SOURCE_FILES_PROPERTIES
(
./taosmigrate.c PROPERTIES COMPILE_FLAGS -w
)
src/kit/taosmigrate/taosmigrate.c
已删除
100644 → 0
浏览文件 @
947ad27e
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "taosmigrate.h"
/* The options we understand. */
static
struct
argp_option
options
[]
=
{
{
0
,
'r'
,
"data dir"
,
0
,
"data dir"
,
0
},
{
0
,
'd'
,
"dnodeId"
,
0
,
"dnode id"
,
1
},
{
0
,
'p'
,
"port"
,
0
,
"dnode port"
,
1
},
{
0
,
'f'
,
"fqdn"
,
0
,
"dnode fqdn"
,
1
},
{
0
,
'g'
,
"multi dnodes"
,
0
,
"multi dnode info, e.g.
\"
2 7030 fqdn1, 3 8030 fqdn2
\"
"
,
2
},
{
0
}};
/* Used by main to communicate with parse_opt. */
struct
arguments
{
char
*
dataDir
;
int32_t
dnodeId
;
uint16_t
port
;
char
*
fqdn
;
char
*
dnodeGroups
;
char
**
arg_list
;
int
arg_list_len
;
};
/* Parse a single option. */
static
error_t
parse_opt
(
int
key
,
char
*
arg
,
struct
argp_state
*
state
)
{
struct
arguments
*
arguments
=
state
->
input
;
switch
(
key
)
{
case
'r'
:
arguments
->
dataDir
=
arg
;
break
;
case
'd'
:
arguments
->
dnodeId
=
atoi
(
arg
);
break
;
case
'p'
:
arguments
->
port
=
atoi
(
arg
);
break
;
case
'f'
:
arguments
->
fqdn
=
arg
;
break
;
case
'g'
:
arguments
->
dnodeGroups
=
arg
;
break
;
case
ARGP_KEY_ARG
:
arguments
->
arg_list
=
&
state
->
argv
[
state
->
next
-
1
];
arguments
->
arg_list_len
=
state
->
argc
-
state
->
next
+
1
;
state
->
next
=
state
->
argc
;
argp_usage
(
state
);
break
;
default:
return
ARGP_ERR_UNKNOWN
;
}
return
0
;
}
static
struct
argp
argp
=
{
options
,
parse_opt
,
0
,
0
};
struct
arguments
arguments
=
{
NULL
,
0
,
0
,
NULL
,
NULL
,
NULL
,
0
};
SdnodeGroup
tsDnodeGroup
=
{
0
};
int
tSystemShell
(
const
char
*
cmd
)
{
FILE
*
fp
;
int
res
;
char
buf
[
1024
];
if
(
cmd
==
NULL
)
{
printf
(
"tSystem cmd is NULL!
\n
"
);
return
-
1
;
}
if
((
fp
=
popen
(
cmd
,
"r"
)
)
==
NULL
)
{
printf
(
"popen cmd:%s error: %s/n"
,
cmd
,
strerror
(
errno
));
return
-
1
;
}
else
{
while
(
fgets
(
buf
,
sizeof
(
buf
),
fp
))
{
printf
(
"popen result:%s"
,
buf
);
}
if
((
res
=
pclose
(
fp
))
==
-
1
)
{
printf
(
"close popen file pointer fp error!
\n
"
);
}
else
{
printf
(
"popen res is :%d
\n
"
,
res
);
}
return
res
;
}
}
void
taosMvFile
(
char
*
destFile
,
char
*
srcFile
)
{
char
shellCmd
[
1024
+
1
]
=
{
0
};
//(void)snprintf(shellCmd, 1024, "cp -rf %s %s", srcDir, destDir);
(
void
)
snprintf
(
shellCmd
,
1024
,
"mv -f %s %s"
,
srcFile
,
destFile
);
tSystemShell
(
shellCmd
);
}
SdnodeIfo
*
getDnodeInfo
(
int32_t
dnodeId
)
{
for
(
int32_t
i
=
0
;
i
<
tsDnodeGroup
.
dnodeNum
;
i
++
)
{
if
(
dnodeId
==
tsDnodeGroup
.
dnodeArray
[
i
].
dnodeId
)
{
return
&
(
tsDnodeGroup
.
dnodeArray
[
i
]);
}
}
return
NULL
;
}
void
parseOneDnodeInfo
(
char
*
buf
,
SdnodeIfo
*
pDnodeInfo
)
{
char
*
ptr
;
char
*
p
;
int32_t
i
=
0
;
ptr
=
strtok_r
(
buf
,
" "
,
&
p
);
while
(
ptr
!=
NULL
)
{
if
(
0
==
i
)
{
pDnodeInfo
->
dnodeId
=
atoi
(
ptr
);
}
else
if
(
1
==
i
)
{
pDnodeInfo
->
port
=
atoi
(
ptr
);
}
else
if
(
2
==
i
)
{
tstrncpy
(
pDnodeInfo
->
fqdn
,
ptr
,
TSDB_FQDN_LEN
);
}
else
{
printf
(
"input parameter error near:%s
\n
"
,
buf
);
exit
(
-
1
);
}
i
++
;
ptr
=
strtok_r
(
NULL
,
" "
,
&
p
);
}
snprintf
(
pDnodeInfo
->
ep
,
TSDB_EP_LEN
,
"%s:%d"
,
pDnodeInfo
->
fqdn
,
pDnodeInfo
->
port
);
}
void
saveDnodeGroups
()
{
if
((
NULL
!=
arguments
.
fqdn
)
&&
(
arguments
.
dnodeId
>
0
)
&&
(
0
!=
arguments
.
port
))
{
//printf("dnodeId:%d port:%d fqdn:%s ep:%s\n", arguments.dnodeId, arguments.port, arguments.fqdn, arguments.ep);
tsDnodeGroup
.
dnodeArray
[
tsDnodeGroup
.
dnodeNum
].
dnodeId
=
arguments
.
dnodeId
;
tsDnodeGroup
.
dnodeArray
[
tsDnodeGroup
.
dnodeNum
].
port
=
arguments
.
port
;
tstrncpy
(
tsDnodeGroup
.
dnodeArray
[
tsDnodeGroup
.
dnodeNum
].
fqdn
,
arguments
.
fqdn
,
TSDB_FQDN_LEN
);
snprintf
(
tsDnodeGroup
.
dnodeArray
[
tsDnodeGroup
.
dnodeNum
].
ep
,
TSDB_EP_LEN
,
"%s:%d"
,
tsDnodeGroup
.
dnodeArray
[
tsDnodeGroup
.
dnodeNum
].
fqdn
,
tsDnodeGroup
.
dnodeArray
[
tsDnodeGroup
.
dnodeNum
].
port
);
tsDnodeGroup
.
dnodeNum
++
;
}
if
(
NULL
==
arguments
.
dnodeGroups
)
{
return
;
}
//printf("dnodeGroups:%s\n", arguments.dnodeGroups);
char
buf
[
1024
];
char
*
str
=
NULL
;
char
*
start
=
arguments
.
dnodeGroups
;
while
(
NULL
!=
(
str
=
strstr
(
start
,
","
)))
{
memcpy
(
buf
,
start
,
str
-
start
);
// parse one dnode info: dnodeId port fqdn ep
parseOneDnodeInfo
(
buf
,
&
(
tsDnodeGroup
.
dnodeArray
[
tsDnodeGroup
.
dnodeNum
]));
tsDnodeGroup
.
dnodeNum
++
;
// next
start
=
str
+
1
;
str
=
NULL
;
}
if
(
strlen
(
start
))
{
parseOneDnodeInfo
(
start
,
&
(
tsDnodeGroup
.
dnodeArray
[
tsDnodeGroup
.
dnodeNum
]));
tsDnodeGroup
.
dnodeNum
++
;
}
}
int32_t
main
(
int32_t
argc
,
char
*
argv
[])
{
memset
(
&
tsDnodeGroup
,
0
,
sizeof
(
SdnodeGroup
));
argp_parse
(
&
argp
,
argc
,
argv
,
0
,
0
,
&
arguments
);
if
((
NULL
==
arguments
.
dataDir
)
||
((
NULL
==
arguments
.
dnodeGroups
)
&&
(
NULL
==
arguments
.
fqdn
||
arguments
.
dnodeId
<
1
||
0
==
arguments
.
port
)))
{
printf
(
"input parameter error!
\n
"
);
return
-
1
;
}
saveDnodeGroups
();
printf
(
"===================arguments:==================
\n
"
);
printf
(
"oldWal:%s
\n
"
,
arguments
.
dataDir
);
for
(
int32_t
i
=
0
;
i
<
tsDnodeGroup
.
dnodeNum
;
i
++
)
{
printf
(
"dnodeId:%d port:%d fqdn:%s ep:%s
\n
"
,
tsDnodeGroup
.
dnodeArray
[
i
].
dnodeId
,
tsDnodeGroup
.
dnodeArray
[
i
].
port
,
tsDnodeGroup
.
dnodeArray
[
i
].
fqdn
,
tsDnodeGroup
.
dnodeArray
[
i
].
ep
);
}
printf
(
"===========================
\n
"
);
// 1. modify wal for mnode
char
mnodeWal
[
TSDB_FILENAME_LEN
*
2
]
=
{
0
};
(
void
)
snprintf
(
mnodeWal
,
TSDB_FILENAME_LEN
*
2
,
"%s/mnode/wal/wal0"
,
arguments
.
dataDir
);
walModWalFile
(
mnodeWal
);
// 2. modfiy dnode config: mnodeEpSet.json
char
dnodeEpSet
[
TSDB_FILENAME_LEN
*
2
]
=
{
0
};
(
void
)
snprintf
(
dnodeEpSet
,
TSDB_FILENAME_LEN
*
2
,
"%s/dnode/mnodeEpSet.json"
,
arguments
.
dataDir
);
modDnodeEpSet
(
dnodeEpSet
);
// 3. modify vnode config: config.json
char
vnodeDir
[
TSDB_FILENAME_LEN
*
2
]
=
{
0
};
(
void
)
snprintf
(
vnodeDir
,
TSDB_FILENAME_LEN
*
2
,
"%s/vnode"
,
arguments
.
dataDir
);
modAllVnode
(
vnodeDir
);
return
0
;
}
src/kit/taosmigrate/taosmigrate.h
已删除
100644 → 0
浏览文件 @
947ad27e
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef TAOS_MIGRATE_H
#define TAOS_MIGRATE_H
#ifdef __cplusplus
extern
"C"
{
#endif
#define _GNU_SOURCE
#ifndef _ALPINE
#include <error.h>
#endif
#include <argp.h>
#include <assert.h>
#include <inttypes.h>
#include <pthread.h>
#include <semaphore.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include "taosdef.h"
#include "tutil.h"
#include "twal.h"
#include "tchecksum.h"
#include "mnodeDef.h"
#include "mnodeSdb.h"
#include "cJSON.h"
#include "taosmsg.h"
#include "tglobal.h"
#include "tsdb.h"
//#include "vnode.h"
#include "vnodeInt.h"
#define MAX_DNODE_NUM 128
typedef
struct
_SdnodeIfo
{
int32_t
dnodeId
;
uint16_t
port
;
char
fqdn
[
TSDB_FQDN_LEN
+
1
];
char
ep
[
TSDB_EP_LEN
+
1
];
}
SdnodeIfo
;
typedef
struct
_SdnodeGroup
{
int32_t
dnodeNum
;
SdnodeIfo
dnodeArray
[
MAX_DNODE_NUM
];
}
SdnodeGroup
;
int
tSystemShell
(
const
char
*
cmd
);
void
taosMvFile
(
char
*
destFile
,
char
*
srcFile
)
;
void
walModWalFile
(
char
*
walfile
);
SdnodeIfo
*
getDnodeInfo
(
int32_t
dnodeId
);
void
modDnodeEpSet
(
char
*
dnodeEpSet
);
void
modAllVnode
(
char
*
vnodeDir
);
#endif
src/kit/taosmigrate/taosmigrateDnodeCfg.c
已删除
100644 → 0
浏览文件 @
947ad27e
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "taosmigrate.h"
//#include "dnodeInt.h"
//#include "dnodeMgmt.h"
//#include "dnodeVRead.h"
//#include "dnodeVWrite.h"
//#include "dnodeModule.h"
static
SDMMnodeInfos
tsDnodeIpInfos
=
{
0
};
static
bool
dnodeReadMnodeInfos
(
char
*
dnodeEpSet
)
{
FILE
*
fp
=
fopen
(
dnodeEpSet
,
"r"
);
if
(
!
fp
)
{
printf
(
"failed to read mnodeEpSet.json, file not exist
\n
"
);
return
false
;
}
bool
ret
=
false
;
int
maxLen
=
2000
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
int
len
=
fread
(
content
,
1
,
maxLen
,
fp
);
if
(
len
<=
0
)
{
free
(
content
);
fclose
(
fp
);
printf
(
"failed to read mnodeEpSet.json, content is null
\n
"
);
return
false
;
}
content
[
len
]
=
0
;
cJSON
*
root
=
cJSON_Parse
(
content
);
if
(
root
==
NULL
)
{
printf
(
"failed to read mnodeEpSet.json, invalid json format
\n
"
);
goto
PARSE_OVER
;
}
cJSON
*
inUse
=
cJSON_GetObjectItem
(
root
,
"inUse"
);
if
(
!
inUse
||
inUse
->
type
!=
cJSON_Number
)
{
printf
(
"failed to read mnodeEpSet.json, inUse not found
\n
"
);
goto
PARSE_OVER
;
}
tsDnodeIpInfos
.
inUse
=
inUse
->
valueint
;
cJSON
*
nodeNum
=
cJSON_GetObjectItem
(
root
,
"nodeNum"
);
if
(
!
nodeNum
||
nodeNum
->
type
!=
cJSON_Number
)
{
printf
(
"failed to read mnodeEpSet.json, nodeNum not found
\n
"
);
goto
PARSE_OVER
;
}
tsDnodeIpInfos
.
nodeNum
=
nodeNum
->
valueint
;
cJSON
*
nodeInfos
=
cJSON_GetObjectItem
(
root
,
"nodeInfos"
);
if
(
!
nodeInfos
||
nodeInfos
->
type
!=
cJSON_Array
)
{
printf
(
"failed to read mnodeEpSet.json, nodeInfos not found
\n
"
);
goto
PARSE_OVER
;
}
int
size
=
cJSON_GetArraySize
(
nodeInfos
);
if
(
size
!=
tsDnodeIpInfos
.
nodeNum
)
{
printf
(
"failed to read mnodeEpSet.json, nodeInfos size not matched
\n
"
);
goto
PARSE_OVER
;
}
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
cJSON
*
nodeInfo
=
cJSON_GetArrayItem
(
nodeInfos
,
i
);
if
(
nodeInfo
==
NULL
)
continue
;
cJSON
*
nodeId
=
cJSON_GetObjectItem
(
nodeInfo
,
"nodeId"
);
if
(
!
nodeId
||
nodeId
->
type
!=
cJSON_Number
)
{
printf
(
"failed to read mnodeEpSet.json, nodeId not found
\n
"
);
goto
PARSE_OVER
;
}
tsDnodeIpInfos
.
nodeInfos
[
i
].
nodeId
=
nodeId
->
valueint
;
cJSON
*
nodeEp
=
cJSON_GetObjectItem
(
nodeInfo
,
"nodeEp"
);
if
(
!
nodeEp
||
nodeEp
->
type
!=
cJSON_String
||
nodeEp
->
valuestring
==
NULL
)
{
printf
(
"failed to read mnodeEpSet.json, nodeName not found
\n
"
);
goto
PARSE_OVER
;
}
strncpy
(
tsDnodeIpInfos
.
nodeInfos
[
i
].
nodeEp
,
nodeEp
->
valuestring
,
TSDB_EP_LEN
);
SdnodeIfo
*
pDnodeInfo
=
getDnodeInfo
(
tsDnodeIpInfos
.
nodeInfos
[
i
].
nodeId
);
if
(
NULL
==
pDnodeInfo
)
{
continue
;
}
tstrncpy
(
tsDnodeIpInfos
.
nodeInfos
[
i
].
nodeEp
,
pDnodeInfo
->
ep
,
TSDB_EP_LEN
);
}
ret
=
true
;
//printf("read mnode epSet successed, numOfEps:%d inUse:%d\n", tsDnodeIpInfos.nodeNum, tsDnodeIpInfos.inUse);
//for (int32_t i = 0; i < tsDnodeIpInfos.nodeNum; i++) {
// printf("mnode:%d, %s\n", tsDnodeIpInfos.nodeInfos[i].nodeId, tsDnodeIpInfos.nodeInfos[i].nodeEp);
//}
PARSE_OVER:
free
(
content
);
cJSON_Delete
(
root
);
fclose
(
fp
);
return
ret
;
}
static
void
dnodeSaveMnodeInfos
(
char
*
dnodeEpSet
)
{
FILE
*
fp
=
fopen
(
dnodeEpSet
,
"w"
);
if
(
!
fp
)
return
;
int32_t
len
=
0
;
int32_t
maxLen
=
2000
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
inUse
\"
: %d,
\n
"
,
tsDnodeIpInfos
.
inUse
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeNum
\"
: %d,
\n
"
,
tsDnodeIpInfos
.
nodeNum
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeInfos
\"
: [{
\n
"
);
for
(
int32_t
i
=
0
;
i
<
tsDnodeIpInfos
.
nodeNum
;
i
++
)
{
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeId
\"
: %d,
\n
"
,
tsDnodeIpInfos
.
nodeInfos
[
i
].
nodeId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeEp
\"
:
\"
%s
\"\n
"
,
tsDnodeIpInfos
.
nodeInfos
[
i
].
nodeEp
);
if
(
i
<
tsDnodeIpInfos
.
nodeNum
-
1
)
{
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
" },{
\n
"
);
}
else
{
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
" }]
\n
"
);
}
}
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"}
\n
"
);
fwrite
(
content
,
1
,
len
,
fp
);
fflush
(
fp
);
fclose
(
fp
);
free
(
content
);
printf
(
"mod mnode epSet successed
\n
"
);
}
void
modDnodeEpSet
(
char
*
dnodeEpSet
)
{
(
void
)
dnodeReadMnodeInfos
(
dnodeEpSet
);
dnodeSaveMnodeInfos
(
dnodeEpSet
);
return
;
}
src/kit/taosmigrate/taosmigrateMnodeWal.c
已删除
100644 → 0
浏览文件 @
947ad27e
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "taosmigrate.h"
static
void
recordWrite
(
int
fd
,
SWalHead
*
pHead
)
{
taosCalcChecksumAppend
(
0
,
(
uint8_t
*
)
pHead
,
sizeof
(
SWalHead
));
int
contLen
=
pHead
->
len
+
sizeof
(
SWalHead
);
if
(
write
(
fd
,
pHead
,
contLen
)
!=
contLen
)
{
printf
(
"failed to write(%s)"
,
strerror
(
errno
));
exit
(
-
1
);
}
}
static
void
recordMod
(
SWalHead
*
pHead
)
{
SDnodeObj
*
pDnode
;
ESdbTable
tableId
=
(
ESdbTable
)(
pHead
->
msgType
/
10
);
switch
(
tableId
)
{
case
SDB_TABLE_DNODE
:
case
SDB_TABLE_MNODE
:
pDnode
=
(
SDnodeObj
*
)
pHead
->
cont
;
printf
(
"dnodeId:%d port:%d fqdn:%s ep:%s
\n
"
,
pDnode
->
dnodeId
,
pDnode
->
dnodePort
,
pDnode
->
dnodeFqdn
,
pDnode
->
dnodeEp
);
SdnodeIfo
*
pDnodeInfo
=
getDnodeInfo
(
pDnode
->
dnodeId
);
if
(
NULL
==
pDnodeInfo
)
{
break
;
}
pDnode
->
dnodePort
=
pDnodeInfo
->
port
;
tstrncpy
(
pDnode
->
dnodeFqdn
,
pDnodeInfo
->
fqdn
,
sizeof
(
pDnode
->
dnodeFqdn
));
tstrncpy
(
pDnode
->
dnodeEp
,
pDnodeInfo
->
ep
,
sizeof
(
pDnode
->
dnodeEp
));
break
;
#if 0
case SDB_TABLE_ACCOUNT:
SAcctObj *pAcct = (SDnodeObj *)pHead->cont;
break;
case SDB_TABLE_USER:
SUserObj *pUser = (SDnodeObj *)pHead->cont;
break;
case SDB_TABLE_DB:
SDbObj *pDb = (SDnodeObj *)pHead->cont;
break;
case SDB_TABLE_VGROUP:
SVgObj *pVgroup = (SDnodeObj *)pHead->cont;
break;
case SDB_TABLE_STABLE:
SSuperTableObj *pStable = (SDnodeObj *)pHead->cont;
break;
case SDB_TABLE_CTABLE:
SChildTableObj *pCTable = (SDnodeObj *)pHead->cont;
break;
#endif
default:
break
;
}
}
void
walModWalFile
(
char
*
walfile
)
{
char
*
buffer
=
malloc
(
1024000
);
// size for one record
if
(
buffer
==
NULL
)
{
printf
(
"failed to malloc:%s
\n
"
,
strerror
(
errno
));
return
;
}
SWalHead
*
pHead
=
(
SWalHead
*
)
buffer
;
int
rfd
=
open
(
walfile
,
O_RDONLY
);
if
(
rfd
<
0
)
{
printf
(
"failed to open %s failed:%s
\n
"
,
walfile
,
strerror
(
errno
));
free
(
buffer
);
return
;
}
char
newWalFile
[
32
]
=
"wal0"
;
int
wfd
=
open
(
newWalFile
,
O_WRONLY
|
O_CREAT
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
if
(
wfd
<
0
)
{
printf
(
"wal:%s, failed to open(%s)
\n
"
,
newWalFile
,
strerror
(
errno
));
free
(
buffer
);
close
(
rfd
);
return
;
}
printf
(
"start to mod %s into %s
\n
"
,
walfile
,
newWalFile
);
while
(
1
)
{
memset
(
buffer
,
0
,
1024000
);
int
ret
=
read
(
rfd
,
pHead
,
sizeof
(
SWalHead
));
if
(
ret
==
0
)
break
;
if
(
ret
!=
sizeof
(
SWalHead
))
{
printf
(
"wal:%s, failed to read head, skip, ret:%d(%s)
\n
"
,
walfile
,
ret
,
strerror
(
errno
));
break
;
}
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
pHead
,
sizeof
(
SWalHead
)))
{
printf
(
"wal:%s, cksum is messed up, skip the rest of file
\n
"
,
walfile
);
break
;
}
if
(
pHead
->
len
>=
1024000
-
sizeof
(
SWalHead
))
{
printf
(
"wal:%s, SWalHead.len(%d) overflow, skip the rest of file
\n
"
,
walfile
,
pHead
->
len
);
break
;
}
ret
=
read
(
rfd
,
pHead
->
cont
,
pHead
->
len
);
if
(
ret
!=
pHead
->
len
)
{
printf
(
"wal:%s, failed to read body, skip, len:%d ret:%d
\n
"
,
walfile
,
pHead
->
len
,
ret
);
break
;
}
recordMod
(
pHead
);
recordWrite
(
wfd
,
pHead
);
}
close
(
rfd
);
close
(
wfd
);
free
(
buffer
);
taosMvFile
(
walfile
,
newWalFile
);
return
;
}
src/kit/taosmigrate/taosmigrateVnodeCfg.c
已删除
100644 → 0
浏览文件 @
947ad27e
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "taosmigrate.h"
static
int32_t
saveVnodeCfg
(
SVnodeObj
*
pVnode
,
char
*
cfgFile
)
{
FILE
*
fp
=
fopen
(
cfgFile
,
"w"
);
if
(
!
fp
)
{
printf
(
"failed to open vnode cfg file for write, file:%s error:%s
\n
"
,
cfgFile
,
strerror
(
errno
));
return
errno
;
}
int32_t
len
=
0
;
int32_t
maxLen
=
1000
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
if
(
content
==
NULL
)
{
fclose
(
fp
);
return
-
1
;
}
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
db
\"
:
\"
%s
\"
,
\n
"
,
pVnode
->
db
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
cfgVersion
\"
: %d,
\n
"
,
pVnode
->
cfgVersion
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
cacheBlockSize
\"
: %d,
\n
"
,
pVnode
->
tsdbCfg
.
cacheBlockSize
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
totalBlocks
\"
: %d,
\n
"
,
pVnode
->
tsdbCfg
.
totalBlocks
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
daysPerFile
\"
: %d,
\n
"
,
pVnode
->
tsdbCfg
.
daysPerFile
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
daysToKeep
\"
: %d,
\n
"
,
pVnode
->
tsdbCfg
.
keep
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
daysToKeep1
\"
: %d,
\n
"
,
pVnode
->
tsdbCfg
.
keep1
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
daysToKeep2
\"
: %d,
\n
"
,
pVnode
->
tsdbCfg
.
keep2
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
minRowsPerFileBlock
\"
: %d,
\n
"
,
pVnode
->
tsdbCfg
.
minRowsPerFileBlock
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
maxRowsPerFileBlock
\"
: %d,
\n
"
,
pVnode
->
tsdbCfg
.
maxRowsPerFileBlock
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
precision
\"
: %d,
\n
"
,
pVnode
->
tsdbCfg
.
precision
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
compression
\"
: %d,
\n
"
,
pVnode
->
tsdbCfg
.
compression
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
walLevel
\"
: %d,
\n
"
,
pVnode
->
walCfg
.
walLevel
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
fsync
\"
: %d,
\n
"
,
pVnode
->
walCfg
.
fsyncPeriod
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
replica
\"
: %d,
\n
"
,
pVnode
->
syncCfg
.
replica
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
wals
\"
: %d,
\n
"
,
pVnode
->
walCfg
.
wals
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
quorum
\"
: %d,
\n
"
,
pVnode
->
syncCfg
.
quorum
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeInfos
\"
: [{
\n
"
);
for
(
int32_t
i
=
0
;
i
<
pVnode
->
syncCfg
.
replica
;
i
++
)
{
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeId
\"
: %d,
\n
"
,
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodeId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeEp
\"
:
\"
%s:%d
\"\n
"
,
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodeFqdn
,
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodePort
);
if
(
i
<
pVnode
->
syncCfg
.
replica
-
1
)
{
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
" },{
\n
"
);
}
else
{
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
" }]
\n
"
);
}
}
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"}
\n
"
);
fwrite
(
content
,
1
,
len
,
fp
);
fflush
(
fp
);
fclose
(
fp
);
free
(
content
);
printf
(
"mod vnode cfg %s successed
\n
"
,
cfgFile
);
return
0
;
}
static
int32_t
readVnodeCfg
(
SVnodeObj
*
pVnode
,
char
*
cfgFile
)
{
cJSON
*
root
=
NULL
;
char
*
content
=
NULL
;
int
maxLen
=
1000
;
int32_t
ret
=
-
1
;
FILE
*
fp
=
fopen
(
cfgFile
,
"r"
);
if
(
!
fp
)
{
printf
(
"failed to open vnode cfg file:%s to read, error:%s
\n
"
,
cfgFile
,
strerror
(
errno
));
goto
PARSE_OVER
;
}
content
=
calloc
(
1
,
maxLen
+
1
);
if
(
content
==
NULL
)
{
goto
PARSE_OVER
;
}
int
len
=
fread
(
content
,
1
,
maxLen
,
fp
);
if
(
len
<=
0
)
{
printf
(
"failed to read vnode cfg, content is null, error:%s
\n
"
,
strerror
(
errno
));
goto
PARSE_OVER
;
}
content
[
maxLen
]
=
(
char
)
0
;
root
=
cJSON_Parse
(
content
);
if
(
root
==
NULL
)
{
printf
(
"failed to json parse %s, invalid json format
\n
"
,
cfgFile
);
goto
PARSE_OVER
;
}
cJSON
*
db
=
cJSON_GetObjectItem
(
root
,
"db"
);
if
(
!
db
||
db
->
type
!=
cJSON_String
||
db
->
valuestring
==
NULL
)
{
printf
(
"vgId:%d, failed to read vnode cfg, db not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
strcpy
(
pVnode
->
db
,
db
->
valuestring
);
cJSON
*
cfgVersion
=
cJSON_GetObjectItem
(
root
,
"cfgVersion"
);
if
(
!
cfgVersion
||
cfgVersion
->
type
!=
cJSON_Number
)
{
printf
(
"vgId:%d, failed to read vnode cfg, cfgVersion not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
cfgVersion
=
cfgVersion
->
valueint
;
cJSON
*
cacheBlockSize
=
cJSON_GetObjectItem
(
root
,
"cacheBlockSize"
);
if
(
!
cacheBlockSize
||
cacheBlockSize
->
type
!=
cJSON_Number
)
{
printf
(
"vgId:%d, failed to read vnode cfg, cacheBlockSize not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
tsdbCfg
.
cacheBlockSize
=
cacheBlockSize
->
valueint
;
cJSON
*
totalBlocks
=
cJSON_GetObjectItem
(
root
,
"totalBlocks"
);
if
(
!
totalBlocks
||
totalBlocks
->
type
!=
cJSON_Number
)
{
printf
(
"vgId:%d, failed to read vnode cfg, totalBlocks not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
tsdbCfg
.
totalBlocks
=
totalBlocks
->
valueint
;
// cJSON *maxTables = cJSON_GetObjectItem(root, "maxTables");
// if (!maxTables || maxTables->type != cJSON_Number) {
// printf("vgId:%d, failed to read vnode cfg, maxTables not found\n", pVnode->vgId);
// goto PARSE_OVER;
// }
// pVnode->tsdbCfg.maxTables = maxTables->valueint;
cJSON
*
daysPerFile
=
cJSON_GetObjectItem
(
root
,
"daysPerFile"
);
if
(
!
daysPerFile
||
daysPerFile
->
type
!=
cJSON_Number
)
{
printf
(
"vgId:%d, failed to read vnode cfg, daysPerFile not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
tsdbCfg
.
daysPerFile
=
daysPerFile
->
valueint
;
cJSON
*
daysToKeep
=
cJSON_GetObjectItem
(
root
,
"daysToKeep"
);
if
(
!
daysToKeep
||
daysToKeep
->
type
!=
cJSON_Number
)
{
printf
(
"vgId:%d, failed to read vnode cfg, daysToKeep not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
tsdbCfg
.
keep
=
daysToKeep
->
valueint
;
cJSON
*
daysToKeep1
=
cJSON_GetObjectItem
(
root
,
"daysToKeep1"
);
if
(
!
daysToKeep1
||
daysToKeep1
->
type
!=
cJSON_Number
)
{
printf
(
"vgId:%d, failed to read vnode cfg, daysToKeep1 not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
tsdbCfg
.
keep1
=
daysToKeep1
->
valueint
;
cJSON
*
daysToKeep2
=
cJSON_GetObjectItem
(
root
,
"daysToKeep2"
);
if
(
!
daysToKeep2
||
daysToKeep2
->
type
!=
cJSON_Number
)
{
printf
(
"vgId:%d, failed to read vnode cfg, daysToKeep2 not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
tsdbCfg
.
keep2
=
daysToKeep2
->
valueint
;
cJSON
*
minRowsPerFileBlock
=
cJSON_GetObjectItem
(
root
,
"minRowsPerFileBlock"
);
if
(
!
minRowsPerFileBlock
||
minRowsPerFileBlock
->
type
!=
cJSON_Number
)
{
printf
(
"vgId:%d, failed to read vnode cfg, minRowsPerFileBlock not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
tsdbCfg
.
minRowsPerFileBlock
=
minRowsPerFileBlock
->
valueint
;
cJSON
*
maxRowsPerFileBlock
=
cJSON_GetObjectItem
(
root
,
"maxRowsPerFileBlock"
);
if
(
!
maxRowsPerFileBlock
||
maxRowsPerFileBlock
->
type
!=
cJSON_Number
)
{
printf
(
"vgId:%d, failed to read vnode cfg, maxRowsPerFileBlock not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
tsdbCfg
.
maxRowsPerFileBlock
=
maxRowsPerFileBlock
->
valueint
;
// cJSON *commitTime = cJSON_GetObjectItem(root, "commitTime");
// if (!commitTime || commitTime->type != cJSON_Number) {
// printf("vgId:%d, failed to read vnode cfg, commitTime not found\n", pVnode->vgId);
// goto PARSE_OVER;
// }
// pVnode->tsdbCfg.commitTime = (int8_t)commitTime->valueint;
cJSON
*
precision
=
cJSON_GetObjectItem
(
root
,
"precision"
);
if
(
!
precision
||
precision
->
type
!=
cJSON_Number
)
{
printf
(
"vgId:%d, failed to read vnode cfg, precision not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
tsdbCfg
.
precision
=
(
int8_t
)
precision
->
valueint
;
cJSON
*
compression
=
cJSON_GetObjectItem
(
root
,
"compression"
);
if
(
!
compression
||
compression
->
type
!=
cJSON_Number
)
{
printf
(
"vgId:%d, failed to read vnode cfg, compression not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
tsdbCfg
.
compression
=
(
int8_t
)
compression
->
valueint
;
cJSON
*
walLevel
=
cJSON_GetObjectItem
(
root
,
"walLevel"
);
if
(
!
walLevel
||
walLevel
->
type
!=
cJSON_Number
)
{
printf
(
"vgId:%d, failed to read vnode cfg, walLevel not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
walCfg
.
walLevel
=
(
int8_t
)
walLevel
->
valueint
;
cJSON
*
fsyncPeriod
=
cJSON_GetObjectItem
(
root
,
"fsync"
);
if
(
!
fsyncPeriod
||
fsyncPeriod
->
type
!=
cJSON_Number
)
{
printf
(
"vgId:%d, failed to read vnode cfg, fsyncPeriod not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
walCfg
.
fsyncPeriod
=
fsyncPeriod
->
valueint
;
cJSON
*
wals
=
cJSON_GetObjectItem
(
root
,
"wals"
);
if
(
!
wals
||
wals
->
type
!=
cJSON_Number
)
{
printf
(
"vgId:%d, failed to read vnode cfg, wals not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
walCfg
.
wals
=
(
int8_t
)
wals
->
valueint
;
pVnode
->
walCfg
.
keep
=
0
;
cJSON
*
replica
=
cJSON_GetObjectItem
(
root
,
"replica"
);
if
(
!
replica
||
replica
->
type
!=
cJSON_Number
)
{
printf
(
"vgId:%d, failed to read vnode cfg, replica not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
syncCfg
.
replica
=
(
int8_t
)
replica
->
valueint
;
cJSON
*
quorum
=
cJSON_GetObjectItem
(
root
,
"quorum"
);
if
(
!
quorum
||
quorum
->
type
!=
cJSON_Number
)
{
printf
(
"vgId: %d, failed to read vnode cfg, quorum not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
syncCfg
.
quorum
=
(
int8_t
)
quorum
->
valueint
;
cJSON
*
nodeInfos
=
cJSON_GetObjectItem
(
root
,
"nodeInfos"
);
if
(
!
nodeInfos
||
nodeInfos
->
type
!=
cJSON_Array
)
{
printf
(
"vgId:%d, failed to read vnode cfg, nodeInfos not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
int
size
=
cJSON_GetArraySize
(
nodeInfos
);
if
(
size
!=
pVnode
->
syncCfg
.
replica
)
{
printf
(
"vgId:%d, failed to read vnode cfg, nodeInfos size not matched
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
cJSON
*
nodeInfo
=
cJSON_GetArrayItem
(
nodeInfos
,
i
);
if
(
nodeInfo
==
NULL
)
continue
;
cJSON
*
nodeId
=
cJSON_GetObjectItem
(
nodeInfo
,
"nodeId"
);
if
(
!
nodeId
||
nodeId
->
type
!=
cJSON_Number
)
{
printf
(
"vgId:%d, failed to read vnode cfg, nodeId not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodeId
=
nodeId
->
valueint
;
cJSON
*
nodeEp
=
cJSON_GetObjectItem
(
nodeInfo
,
"nodeEp"
);
if
(
!
nodeEp
||
nodeEp
->
type
!=
cJSON_String
||
nodeEp
->
valuestring
==
NULL
)
{
printf
(
"vgId:%d, failed to read vnode cfg, nodeFqdn not found
\n
"
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
taosGetFqdnPortFromEp
(
nodeEp
->
valuestring
,
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodeFqdn
,
&
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodePort
);
//pVnode->syncCfg.nodeInfo[i].nodePort += TSDB_PORT_SYNC;
SdnodeIfo
*
pDnodeInfo
=
getDnodeInfo
(
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodeId
);
if
(
NULL
==
pDnodeInfo
)
{
continue
;
}
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodePort
=
pDnodeInfo
->
port
;
tstrncpy
(
pVnode
->
syncCfg
.
nodeInfo
[
i
].
nodeFqdn
,
pDnodeInfo
->
fqdn
,
TSDB_FQDN_LEN
);
}
ret
=
0
;
//printf("read vnode cfg successfully, replcia:%d\n", pVnode->syncCfg.replica);
//for (int32_t i = 0; i < pVnode->syncCfg.replica; i++) {
// printf("dnode:%d, %s:%d\n", pVnode->syncCfg.nodeInfo[i].nodeId, pVnode->syncCfg.nodeInfo[i].nodeFqdn, pVnode->syncCfg.nodeInfo[i].nodePort);
//}
PARSE_OVER:
taosTFree
(
content
);
cJSON_Delete
(
root
);
if
(
fp
)
fclose
(
fp
);
return
ret
;
}
static
void
modVnodeCfg
(
char
*
vnodeCfg
)
{
int32_t
ret
;
SVnodeObj
vnodeObj
=
{
0
};
ret
=
readVnodeCfg
(
&
vnodeObj
,
vnodeCfg
);
if
(
0
!=
ret
)
{
printf
(
"read vnode cfg %s fail!
\n
"
,
vnodeCfg
);
return
;
}
(
void
)
saveVnodeCfg
(
&
vnodeObj
,
vnodeCfg
);
return
;
}
void
modAllVnode
(
char
*
vnodeDir
)
{
DIR
*
dir
=
opendir
(
vnodeDir
);
if
(
dir
==
NULL
)
return
;
char
filename
[
1024
];
struct
dirent
*
de
=
NULL
;
while
((
de
=
readdir
(
dir
))
!=
NULL
)
{
if
(
strcmp
(
de
->
d_name
,
"."
)
==
0
||
strcmp
(
de
->
d_name
,
".."
)
==
0
)
continue
;
if
((
de
->
d_type
&
DT_DIR
)
&&
(
strncmp
(
de
->
d_name
,
"vnode"
,
5
)
==
0
))
{
memset
(
filename
,
0
,
1024
);
snprintf
(
filename
,
1023
,
"%s/%s/config.json"
,
vnodeDir
,
de
->
d_name
);
modVnodeCfg
(
filename
);
}
}
closedir
(
dir
);
}
src/mnode/CMakeLists.txt
浏览文件 @
f956c90b
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
IF
(
(
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
)
)
IF
(
TD_LINUX
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/os/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/common/inc
)
...
...
@@ -13,5 +13,4 @@ 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 pthread)
ENDIF
()
\ No newline at end of file
src/plugins/http/CMakeLists.txt
浏览文件 @
f956c90b
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
IF
((
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
))
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/os/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/client/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/common/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/zlib-1.2.11/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/cJson/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/lz4/inc
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/zlib-1.2.11/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/cJson/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/lz4/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/client/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
IF
(
TD_LINUX
)
ADD_LIBRARY
(
http
${
SRC
}
)
# TARGET_LINK_LIBRARIES(http taos_static z)
TARGET_LINK_LIBRARIES
(
http taos z
)
IF
(
TD_ADMIN
)
...
...
src/plugins/monitor/CMakeLists.txt
浏览文件 @
f956c90b
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
IF
((
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
))
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/os/inc
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
./src SRC
)
IF
(
TD_LINUX
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/client/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/common/inc
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
./src SRC
)
ADD_LIBRARY
(
monitor
${
SRC
}
)
# TARGET_LINK_LIBRARIES(monitor taos_static)
TARGET_LINK_LIBRARIES
(
monitor taos
)
ENDIF
()
src/plugins/mqtt/CMakeLists.txt
浏览文件 @
f956c90b
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
IF
((
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
))
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/os/inc
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
IF
(
TD_LINUX
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/client/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/common/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/cJson/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/MQTT-C/include
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/MQTT-C/examples/templates
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
ADD_LIBRARY
(
mqtt
${
SRC
}
)
# TARGET_LINK_LIBRARIES(mqtt taos_static cJson mqttc)
TARGET_LINK_LIBRARIES
(
mqtt taos cJson mqttc
)
IF
(
TD_ADMIN
)
...
...
src/query/CMakeLists.txt
浏览文件 @
f956c90b
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/os/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/common/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/tsdb/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/client/inc
)
INCLUDE_DIRECTORIES
(
inc
)
IF
(
(
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
)
)
IF
(
TD_LINUX
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
ADD_LIBRARY
(
query
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
query tsdb tutil m rt
)
ADD_SUBDIRECTORY
(
tests
)
SET_SOURCE_FILES_PROPERTIES
(
src/sql.c PROPERTIES COMPILE_FLAGS -w
)
ENDIF
()
ADD_SUBDIRECTORY
(
tests
)
SET_SOURCE_FILES_PROPERTIES
(
src/sql.c PROPERTIES COMPILE_FLAGS -w
)
src/sync/CMakeLists.txt
浏览文件 @
f956c90b
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
IF
((
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
))
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/os/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/common/inc
)
INCLUDE_DIRECTORIES
(
${
TD_ENTERPRISE_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
IF
(
TD_LINUX
)
LIST
(
REMOVE_ITEM SRC ./src/tarbitrator.c
)
ADD_LIBRARY
(
sync
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
sync tutil pthread common
)
...
...
src/tsdb/CMakeLists.txt
浏览文件 @
f956c90b
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
IF
((
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
))
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/os/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/common/inc
)
# INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/vnode/common/inc)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
IF
(
TD_LINUX
)
ADD_LIBRARY
(
tsdb
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
tsdb common tutil
)
...
...
src/util/CMakeLists.txt
浏览文件 @
f956c90b
...
...
@@ -4,7 +4,7 @@ PROJECT(TDengine)
AUX_SOURCE_DIRECTORY
(
src SRC
)
ADD_LIBRARY
(
tutil
${
SRC
}
)
IF
(
(
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
)
)
IF
(
TD_LINUX
)
TARGET_LINK_LIBRARIES
(
tutil pthread osdetail m rt lz4
)
ADD_SUBDIRECTORY
(
tests
)
...
...
@@ -23,8 +23,8 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
MESSAGE
(
STATUS
"Failed to find iconv, use default encoding method"
)
ENDIF
()
ELSEIF
(
TD_WINDOWS
_64
)
ELSEIF
(
TD_WINDOWS
)
TARGET_LINK_LIBRARIES
(
tutil iconv regex pthread osdetail winmm IPHLPAPI ws2_32 lz4
)
ELSEIF
(
TD_DARWIN
_64
)
ELSEIF
(
TD_DARWIN
)
TARGET_LINK_LIBRARIES
(
tutil iconv pthread osdetail lz4
)
ENDIF
()
src/vnode/CMakeLists.txt
浏览文件 @
f956c90b
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
IF
((
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
))
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/os/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/tsdb/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/common/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/dnode/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/cJson/inc
)
INCLUDE_DIRECTORIES
(
${
TD_ENTERPRISE_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/tsdb/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/dnode/inc
)
INCLUDE_DIRECTORIES
(
${
TD_ENTERPRISE_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
IF
(
TD_LINUX
)
ADD_LIBRARY
(
vnode
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
vnode tsdb tcq
)
ENDIF
()
src/wal/CMakeLists.txt
浏览文件 @
f956c90b
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/os/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/src SRC
)
ADD_LIBRARY
(
twal
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
twal tutil common
)
ADD_SUBDIRECTORY
(
test
)
IF
(
TD_LINUX
)
ADD_LIBRARY
(
twal
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
twal tutil common
)
ADD_SUBDIRECTORY
(
test
)
ENDIF
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录