Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
d75ce171
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d75ce171
编写于
9月 02, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1310
上级
ddc67482
变更
16
显示空白变更内容
内联
并排
Showing
16 changed file
with
133 addition
and
31 deletion
+133
-31
CMakeLists.txt
CMakeLists.txt
+2
-0
cmake/define.inc
cmake/define.inc
+8
-0
deps/CMakeLists.txt
deps/CMakeLists.txt
+1
-1
deps/MQTT-C/CMakeLists.txt
deps/MQTT-C/CMakeLists.txt
+1
-2
src/dnode/CMakeLists.txt
src/dnode/CMakeLists.txt
+12
-2
src/dnode/src/dnodeModule.c
src/dnode/src/dnodeModule.c
+2
-0
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+7
-0
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+63
-0
src/plugins/CMakeLists.txt
src/plugins/CMakeLists.txt
+3
-1
src/plugins/http/CMakeLists.txt
src/plugins/http/CMakeLists.txt
+3
-2
src/plugins/monitor/CMakeLists.txt
src/plugins/monitor/CMakeLists.txt
+3
-3
src/plugins/mqtt/CMakeLists.txt
src/plugins/mqtt/CMakeLists.txt
+7
-9
src/query/CMakeLists.txt
src/query/CMakeLists.txt
+2
-3
src/tsdb/CMakeLists.txt
src/tsdb/CMakeLists.txt
+2
-5
src/util/CMakeLists.txt
src/util/CMakeLists.txt
+4
-3
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+13
-0
未找到文件。
CMakeLists.txt
浏览文件 @
d75ce171
...
...
@@ -13,6 +13,8 @@ ENDIF ()
SET
(
TD_ACCOUNT FALSE
)
SET
(
TD_ADMIN FALSE
)
SET
(
TD_GRANT FALSE
)
SET
(
TD_SYNC TRUE
)
SET
(
TD_MQTT TRUE
)
SET
(
TD_COVER FALSE
)
SET
(
TD_MEM_CHECK FALSE
)
...
...
cmake/define.inc
浏览文件 @
d75ce171
...
...
@@ -13,6 +13,14 @@ IF (TD_GRANT)
ADD_DEFINITIONS
(
-
D_GRANT
)
ENDIF
()
IF
(
TD_SYNC
)
ADD_DEFINITIONS
(
-
D_SYNC
)
ENDIF
()
IF
(
TD_MQTT
)
ADD_DEFINITIONS
(
-
D_MQTT
)
ENDIF
()
IF
(
TD_GODLL
)
ADD_DEFINITIONS
(
-
D_TD_GO_DLL_
)
ENDIF
()
...
...
deps/CMakeLists.txt
浏览文件 @
d75ce171
...
...
@@ -10,6 +10,6 @@ ADD_SUBDIRECTORY(cJson)
ADD_SUBDIRECTORY
(
wepoll
)
ADD_SUBDIRECTORY
(
MsvcLibX
)
IF
(
TD_LINUX
)
IF
(
TD_LINUX
AND TD_MQTT
)
ADD_SUBDIRECTORY
(
MQTT-C
)
ENDIF
()
\ No newline at end of file
deps/MQTT-C/CMakeLists.txt
浏览文件 @
d75ce171
cmake_minimum_required
(
VERSION 3.5
)
project
(
MQTT-C VERSION 1.1.2 LANGUAGES C
)
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
# MQTT-C build options
option
(
MQTT_C_OpenSSL_SUPPORT
"Build MQTT-C with OpenSSL support?"
OFF
)
...
...
src/dnode/CMakeLists.txt
浏览文件 @
d75ce171
...
...
@@ -11,10 +11,12 @@ AUX_SOURCE_DIRECTORY(src SRC)
IF
(
TD_LINUX
)
ADD_EXECUTABLE
(
taosd
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
taosd mnode monitor http tsdb twal vnode cJson lz4
)
IF
(
TD_SOMODE_STATIC
)
TARGET_LINK_LIBRARIES
(
taosd
mnode taos_static monitor http mqtt tsdb twal vnode cJson lz4 balance syn
c
)
TARGET_LINK_LIBRARIES
(
taosd
taos_stati
c
)
ELSE
()
TARGET_LINK_LIBRARIES
(
taosd
mnode taos monitor http mqtt tsdb twal vnode cJson lz4 balance sync
)
TARGET_LINK_LIBRARIES
(
taosd
taos
)
ENDIF
()
IF
(
TD_ACCOUNT
)
...
...
@@ -25,6 +27,14 @@ IF (TD_LINUX)
TARGET_LINK_LIBRARIES
(
taosd grant
)
ENDIF
()
IF
(
TD_MQTT
)
TARGET_LINK_LIBRARIES
(
taosd mqtt
)
ENDIF
()
IF
(
TD_SYNC
)
TARGET_LINK_LIBRARIES
(
taosd balance sync
)
ENDIF
()
SET
(
PREPARE_ENV_CMD
"prepare_env_cmd"
)
SET
(
PREPARE_ENV_TARGET
"prepare_env_target"
)
ADD_CUSTOM_COMMAND
(
OUTPUT
${
PREPARE_ENV_CMD
}
...
...
src/dnode/src/dnodeModule.c
浏览文件 @
d75ce171
...
...
@@ -62,6 +62,7 @@ static void dnodeAllocModules() {
dnodeSetModuleStatus
(
TSDB_MOD_HTTP
);
}
#ifdef _MQTT
tsModule
[
TSDB_MOD_MQTT
].
enable
=
(
tsEnableMqttModule
==
1
);
tsModule
[
TSDB_MOD_MQTT
].
name
=
"mqtt"
;
tsModule
[
TSDB_MOD_MQTT
].
initFp
=
mqttInitSystem
;
...
...
@@ -71,6 +72,7 @@ static void dnodeAllocModules() {
if
(
tsEnableMqttModule
)
{
dnodeSetModuleStatus
(
TSDB_MOD_MQTT
);
}
#endif
tsModule
[
TSDB_MOD_MONITOR
].
enable
=
(
tsEnableMonitorModule
==
1
);
tsModule
[
TSDB_MOD_MONITOR
].
name
=
"monitor"
;
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
d75ce171
...
...
@@ -310,6 +310,13 @@ static int32_t mnodeCheckDbCfg(SDbCfg *pCfg) {
return
TSDB_CODE_MND_INVALID_DB_OPTION
;
}
#ifndef _SYNC
if
(
pCfg
->
replications
!=
1
)
{
mError
(
"invalid db option replications:%d can only be 1 in this version"
,
pCfg
->
replications
);
return
TSDB_CODE_MND_INVALID_DB_OPTION
;
}
#endif
return
TSDB_CODE_SUCCESS
;
}
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
d75ce171
...
...
@@ -78,6 +78,9 @@ static int32_t mnodeDnodeActionInsert(SSdbOper *pOper) {
static
int32_t
mnodeDnodeActionDelete
(
SSdbOper
*
pOper
)
{
SDnodeObj
*
pDnode
=
pOper
->
pObj
;
#ifndef _SYNC
mnodeDropAllDnodeVgroups
(
pDnode
);
#endif
mnodeDropMnodeLocal
(
pDnode
->
dnodeId
);
balanceAsyncNotify
();
...
...
@@ -585,7 +588,11 @@ static int32_t mnodeDropDnodeByEp(char *ep, SMnodeMsg *pMsg) {
mInfo
(
"dnode:%d, start to drop it"
,
pDnode
->
dnodeId
);
#ifndef _SYNC
int32_t
code
=
mnodeDropDnode
(
pDnode
,
pMsg
);
#else
int32_t
code
=
balanceDropDnode
(
pDnode
);
#endif
mnodeDecDnodeRef
(
pDnode
);
return
code
;
}
...
...
@@ -1043,3 +1050,59 @@ static char* mnodeGetDnodeAlternativeRoleStr(int32_t alternativeRole) {
}
}
#ifndef _SYNC
int32_t
balanceInit
()
{
return
TSDB_CODE_SUCCESS
;
}
void
balanceCleanUp
()
{}
void
balanceAsyncNotify
()
{}
void
balanceSyncNotify
()
{}
void
balanceReset
()
{}
int32_t
balanceAlterDnode
(
struct
SDnodeObj
*
pDnode
,
int32_t
vnodeId
,
int32_t
dnodeId
)
{
return
TSDB_CODE_SYN_NOT_ENABLED
;
}
char
*
syncRole
[]
=
{
"offline"
,
"unsynced"
,
"syncing"
,
"slave"
,
"master"
};
int32_t
balanceAllocVnodes
(
SVgObj
*
pVgroup
)
{
void
*
pIter
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
SDnodeObj
*
pSelDnode
=
NULL
;
float
vnodeUsage
=
1000
.
0
;
while
(
1
)
{
pIter
=
mnodeGetNextDnode
(
pIter
,
&
pDnode
);
if
(
pDnode
==
NULL
)
break
;
if
(
pDnode
->
numOfCores
>
0
&&
pDnode
->
openVnodes
<
TSDB_MAX_VNODES
)
{
float
openVnodes
=
pDnode
->
openVnodes
;
if
(
pDnode
->
isMgmt
)
openVnodes
+=
tsMnodeEqualVnodeNum
;
float
usage
=
openVnodes
/
pDnode
->
numOfCores
;
if
(
usage
<=
vnodeUsage
)
{
pSelDnode
=
pDnode
;
vnodeUsage
=
usage
;
}
}
mnodeDecDnodeRef
(
pDnode
);
}
sdbFreeIter
(
pIter
);
if
(
pSelDnode
==
NULL
)
{
mError
(
"failed to alloc vnode to vgroup"
);
return
TSDB_CODE_MND_NO_ENOUGH_DNODES
;
}
pVgroup
->
vnodeGid
[
0
].
dnodeId
=
pSelDnode
->
dnodeId
;
pVgroup
->
vnodeGid
[
0
].
pDnode
=
pSelDnode
;
mDebug
(
"dnode:%d, alloc one vnode to vgroup, openVnodes:%d"
,
pSelDnode
->
dnodeId
,
pSelDnode
->
openVnodes
);
return
TSDB_CODE_SUCCESS
;
}
#endif
src/plugins/CMakeLists.txt
浏览文件 @
d75ce171
...
...
@@ -3,4 +3,6 @@ PROJECT(TDengine)
ADD_SUBDIRECTORY
(
monitor
)
ADD_SUBDIRECTORY
(
http
)
ADD_SUBDIRECTORY
(
mqtt
)
IF
(
TD_MQTT
)
ADD_SUBDIRECTORY
(
mqtt
)
ENDIF
()
\ No newline at end of file
src/plugins/http/CMakeLists.txt
浏览文件 @
d75ce171
...
...
@@ -11,11 +11,12 @@ AUX_SOURCE_DIRECTORY(src SRC)
IF
(
TD_LINUX
)
ADD_LIBRARY
(
http
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
http z
)
IF
(
TD_SOMODE_STATIC
)
TARGET_LINK_LIBRARIES
(
http taos_static
z
)
TARGET_LINK_LIBRARIES
(
http taos_static
)
ELSE
()
TARGET_LINK_LIBRARIES
(
http taos
z
)
TARGET_LINK_LIBRARIES
(
http taos
)
ENDIF
()
IF
(
TD_ADMIN
)
...
...
src/plugins/monitor/CMakeLists.txt
浏览文件 @
d75ce171
...
...
@@ -2,11 +2,11 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT
(
TDengine
)
INCLUDE_DIRECTORIES
(
inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/client/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
AUX_SOURCE_DIRECTORY
(
./src SRC
)
IF
(
TD_LINUX
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/client/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
ADD_LIBRARY
(
monitor
${
SRC
}
)
IF
(
TD_SOMODE_STATIC
)
...
...
src/plugins/mqtt/CMakeLists.txt
浏览文件 @
d75ce171
...
...
@@ -2,21 +2,19 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT
(
TDengine
)
INCLUDE_DIRECTORIES
(
inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/client/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/MQTT-C/include
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/MQTT-C/examples/templates
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
IF
(
TD_LINUX
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/client/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/MQTT-C/include
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/MQTT-C/examples/templates
)
ADD_LIBRARY
(
mqtt
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
mqtt cJson mqttc
)
IF
(
TD_SOMODE_STATIC
)
TARGET_LINK_LIBRARIES
(
mqtt taos_static
cJson mqttc
)
TARGET_LINK_LIBRARIES
(
mqtt taos_static
)
ELSE
()
TARGET_LINK_LIBRARIES
(
mqtt taos cJson mqttc
)
ENDIF
()
IF
(
TD_ADMIN
)
TARGET_LINK_LIBRARIES
(
mqtt admin cJson
)
TARGET_LINK_LIBRARIES
(
mqtt taos
)
ENDIF
()
ENDIF
()
src/query/CMakeLists.txt
浏览文件 @
d75ce171
...
...
@@ -8,10 +8,9 @@ INCLUDE_DIRECTORIES(inc)
AUX_SOURCE_DIRECTORY
(
src SRC
)
ADD_LIBRARY
(
query
${
SRC
}
)
SET_SOURCE_FILES_PROPERTIES
(
src/sql.c PROPERTIES COMPILE_FLAGS -w
)
TARGET_LINK_LIBRARIES
(
query tsdb tutil
)
IF
(
TD_LINUX
)
TARGET_LINK_LIBRARIES
(
query
tsdb tutil
m rt
)
TARGET_LINK_LIBRARIES
(
query m rt
)
ADD_SUBDIRECTORY
(
tests
)
ELSEIF
(
TD_WINDOWS
)
TARGET_LINK_LIBRARIES
(
query tsdb tutil
)
ENDIF
()
src/tsdb/CMakeLists.txt
浏览文件 @
d75ce171
...
...
@@ -3,13 +3,10 @@ PROJECT(TDengine)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
ADD_LIBRARY
(
tsdb
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
tsdb common tutil
)
IF
(
TD_LINUX
)
ADD_LIBRARY
(
tsdb
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
tsdb common tutil
)
# Someone has no gtest directory, so comment it
# ADD_SUBDIRECTORY(tests)
ELSEIF
(
TD_WINDOWS
)
ADD_LIBRARY
(
tsdb
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
tsdb common tutil
)
ENDIF
()
src/util/CMakeLists.txt
浏览文件 @
d75ce171
...
...
@@ -3,9 +3,10 @@ PROJECT(TDengine)
AUX_SOURCE_DIRECTORY
(
src SRC
)
ADD_LIBRARY
(
tutil
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
tutil pthread osdetail lz4
)
IF
(
TD_LINUX
)
TARGET_LINK_LIBRARIES
(
tutil
pthread osdetail m rt lz4
)
TARGET_LINK_LIBRARIES
(
tutil
m rt
)
ADD_SUBDIRECTORY
(
tests
)
FIND_PATH
(
ICONV_INCLUDE_EXIST iconv.h /usr/include/ /usr/local/include/
)
...
...
@@ -24,7 +25,7 @@ IF (TD_LINUX)
ENDIF
()
ELSEIF
(
TD_WINDOWS
)
TARGET_LINK_LIBRARIES
(
tutil iconv regex
pthread osdetail winmm IPHLPAPI ws2_32 lz4
wepoll
)
TARGET_LINK_LIBRARIES
(
tutil iconv regex
winmm IPHLPAPI ws2_32
wepoll
)
ELSEIF
(
TD_DARWIN
)
TARGET_LINK_LIBRARIES
(
tutil iconv
pthread osdetail lz4
)
TARGET_LINK_LIBRARIES
(
tutil iconv
)
ENDIF
()
src/vnode/src/vnodeMain.c
浏览文件 @
d75ce171
...
...
@@ -47,6 +47,15 @@ static void vnodeNotifyRole(void *ahandle, int8_t role);
static
void
vnodeCtrlFlow
(
void
*
handle
,
int32_t
mseconds
);
static
int
vnodeNotifyFileSynced
(
void
*
ahandle
,
uint64_t
fversion
);
#ifndef _SYNC
tsync_h
syncStart
(
const
SSyncInfo
*
info
)
{
return
NULL
;
}
int32_t
syncForwardToPeer
(
tsync_h
shandle
,
void
*
pHead
,
void
*
mhandle
,
int
qtype
)
{
return
0
;
}
void
syncStop
(
tsync_h
shandle
)
{}
int32_t
syncReconfig
(
tsync_h
shandle
,
const
SSyncCfg
*
cfg
)
{
return
0
;
}
int
syncGetNodesRole
(
tsync_h
shandle
,
SNodesRole
*
cfg
)
{
return
0
;
}
void
syncConfirmForward
(
tsync_h
shandle
,
uint64_t
version
,
int32_t
code
)
{}
#endif
int32_t
vnodeInitResources
()
{
vnodeInitWriteFp
();
vnodeInitReadFp
();
...
...
@@ -289,12 +298,16 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) {
syncInfo
.
notifyFileSynced
=
vnodeNotifyFileSynced
;
pVnode
->
sync
=
syncStart
(
&
syncInfo
);
#ifndef _SYNC
pVnode
->
role
=
TAOS_SYNC_ROLE_MASTER
;
#else
if
(
pVnode
->
sync
==
NULL
)
{
vError
(
"vgId:%d, failed to open sync module, replica:%d reason:%s"
,
pVnode
->
vgId
,
pVnode
->
syncCfg
.
replica
,
tstrerror
(
terrno
));
vnodeCleanUp
(
pVnode
);
return
terrno
;
}
#endif
pVnode
->
qMgmt
=
qOpenQueryMgmt
(
pVnode
->
vgId
);
if
(
pVnode
->
qMgmt
==
NULL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录