Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
codyshao
TDengine
提交
a4d710e6
T
TDengine
项目概览
codyshao
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
2
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
a4d710e6
编写于
7月 13, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
7月 13, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2655 from taosdata/feature/vnode
Feature/vnode
上级
708eb167
6e5cb647
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
99 addition
and
54 deletion
+99
-54
packaging/cfg/taos.cfg
packaging/cfg/taos.cfg
+5
-8
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+2
-0
src/common/src/tglobal.c
src/common/src/tglobal.c
+24
-11
src/inc/taosdef.h
src/inc/taosdef.h
+5
-5
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+7
-3
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+1
-1
tests/CMakeLists.txt
tests/CMakeLists.txt
+1
-0
tests/comparisonTest/tdengine/CMakeLists.txt
tests/comparisonTest/tdengine/CMakeLists.txt
+12
-0
tests/comparisonTest/tdengine/tdengineTest.c
tests/comparisonTest/tdengine/tdengineTest.c
+28
-21
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+3
-1
tests/script/sh/deploy.sh
tests/script/sh/deploy.sh
+2
-0
tests/script/tmp/prepare.sim
tests/script/tmp/prepare.sim
+9
-4
未找到文件。
packaging/cfg/taos.cfg
浏览文件 @
a4d710e6
...
...
@@ -51,18 +51,15 @@
# number of threads per CPU core
# numOfThreadsPerCore 1.0
# number of vnodes per core in DNode
# numOfVnodesPerCore 8
# number of vgroups per db
# maxVgroupsPerDb 0
# max number of tables per vnode
# maxTablesPerVnode 1000000
# the ratio of threads responsible for querying in the total thread
# ratioOfQueryThreads 0.5
# number of total vnodes in DNode
# numOfTotalVnodes 0
# max number of tables per vnode
# maxtablesPerVnode 1000
# interval of check load balance when the management node is in normal operation
# balanceInterval 300
...
...
src/common/inc/tglobal.h
浏览文件 @
a4d710e6
...
...
@@ -68,7 +68,9 @@ extern int64_t tsMaxRetentWindow;
// db parameters in client
extern
int32_t
tsCacheBlockSize
;
extern
int32_t
tsBlocksPerVnode
;
extern
int32_t
tsMinTablePerVnode
;
extern
int32_t
tsMaxTablePerVnode
;
extern
int32_t
tsTableIncStepPerVnode
;
extern
int32_t
tsMaxVgroupsPerDb
;
extern
int16_t
tsDaysPerFile
;
extern
int32_t
tsDaysToKeep
;
...
...
src/common/src/tglobal.c
浏览文件 @
a4d710e6
...
...
@@ -38,7 +38,7 @@ uint16_t tsDnodeShellPort = 6030; // udp[6035-6039] tcp[6035]
uint16_t
tsDnodeDnodePort
=
6035
;
// udp/tcp
uint16_t
tsSyncPort
=
6040
;
int32_t
tsStatusInterval
=
1
;
// second
int16_t
tsNumOfVnodesPerCore
=
8
;
int16_t
tsNumOfVnodesPerCore
=
32
;
int16_t
tsNumOfTotalVnodes
=
TSDB_INVALID_VNODE_NUM
;
int32_t
tsNumOfMnodes
=
3
;
int32_t
tsEnableVnodeBak
=
1
;
...
...
@@ -112,7 +112,10 @@ int16_t tsCompression = TSDB_DEFAULT_COMP_LEVEL;
int16_t
tsWAL
=
TSDB_DEFAULT_WAL_LEVEL
;
int32_t
tsReplications
=
TSDB_DEFAULT_DB_REPLICA_OPTION
;
int32_t
tsMaxVgroupsPerDb
=
0
;
int32_t
tsMinTablePerVnode
=
100
;
int32_t
tsMaxTablePerVnode
=
TSDB_DEFAULT_TABLES
;
int32_t
tsTableIncStepPerVnode
=
TSDB_TABLES_STEP
;
// balance
int32_t
tsEnableBalance
=
1
;
int32_t
tsAlternativeRole
=
0
;
...
...
@@ -389,16 +392,6 @@ static void doInitGlobalConfig() {
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"numOfVnodesPerCore"
;
cfg
.
ptr
=
&
tsNumOfVnodesPerCore
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT16
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
;
cfg
.
minValue
=
1
;
cfg
.
maxValue
=
64
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"numOfTotalVnodes"
;
cfg
.
ptr
=
&
tsNumOfTotalVnodes
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT16
;
...
...
@@ -622,6 +615,26 @@ static void doInitGlobalConfig() {
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"minTablesPerVnode"
;
cfg
.
ptr
=
&
tsMinTablePerVnode
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
;
cfg
.
minValue
=
TSDB_MIN_TABLES
;
cfg
.
maxValue
=
TSDB_MAX_TABLES
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"tableIncStepPerVnode"
;
cfg
.
ptr
=
&
tsTableIncStepPerVnode
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
;
cfg
.
minValue
=
TSDB_MIN_TABLES
;
cfg
.
maxValue
=
TSDB_MAX_TABLES
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"cache"
;
cfg
.
ptr
=
&
tsCacheBlockSize
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
...
...
src/inc/taosdef.h
浏览文件 @
a4d710e6
...
...
@@ -274,8 +274,8 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TSDB_DEFAULT_PAYLOAD_SIZE 5120 // default payload size, greater than PATH_MAX value
#define TSDB_EXTRA_PAYLOAD_SIZE 128 // extra bytes for auth
#define TSDB_CQ_SQL_SIZE 1024
#define TSDB_MAX_VNODES 2
56
#define TSDB_MIN_VNODES
50
#define TSDB_MAX_VNODES 2
048
#define TSDB_MIN_VNODES
256
#define TSDB_INVALID_VNODE_NUM 0
#define TSDB_DNODE_ROLE_ANY 0
...
...
@@ -296,9 +296,9 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TSDB_DEFAULT_TOTAL_BLOCKS 4
#define TSDB_MIN_TABLES 4
#define TSDB_MAX_TABLES
5
000000
#define TSDB_DEFAULT_TABLES
2
00000
#define TSDB_TABLES_STEP 1000
0
#define TSDB_MAX_TABLES
10
000000
#define TSDB_DEFAULT_TABLES
10
00000
#define TSDB_TABLES_STEP 1000
#define TSDB_MIN_DAYS_PER_FILE 1
#define TSDB_MAX_DAYS_PER_FILE 3650
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
a4d710e6
...
...
@@ -323,7 +323,7 @@ static int32_t mnodeAllocVgroupIdPool(SVgObj *pInputVgroup) {
if
(
pDb
==
NULL
)
return
TSDB_CODE_MND_APP_ERROR
;
int32_t
minIdPoolSize
=
TSDB_MAX_TABLES
;
int32_t
maxIdPoolSize
=
TSDB_MIN_TABLES
;
int32_t
maxIdPoolSize
=
tsMinTablePerVnode
;
for
(
int32_t
v
=
0
;
v
<
pDb
->
numOfVgroups
;
++
v
)
{
SVgObj
*
pVgroup
=
pDb
->
vgList
[
v
];
if
(
pVgroup
==
NULL
)
continue
;
...
...
@@ -347,10 +347,10 @@ static int32_t mnodeAllocVgroupIdPool(SVgObj *pInputVgroup) {
// realloc all vgroups in db
int32_t
newIdPoolSize
;
if
(
minIdPoolSize
*
4
<
TSDB_TABLES_STEP
)
{
if
(
minIdPoolSize
*
4
<
tsTableIncStepPerVnode
)
{
newIdPoolSize
=
minIdPoolSize
*
4
;
}
else
{
newIdPoolSize
=
((
minIdPoolSize
/
TSDB_TABLES_STEP
)
+
1
)
*
TSDB_TABLES_STEP
;
newIdPoolSize
=
((
minIdPoolSize
/
tsTableIncStepPerVnode
)
+
1
)
*
tsTableIncStepPerVnode
;
}
if
(
newIdPoolSize
>
tsMaxTablePerVnode
)
{
...
...
@@ -471,6 +471,8 @@ static int32_t mnodeCreateVgroupCb(SMnodeMsg *pMsg, int32_t code) {
}
pMsg
->
expected
=
pVgroup
->
numOfVnodes
;
pMsg
->
successed
=
0
;
pMsg
->
received
=
0
;
mnodeSendCreateVgroupMsg
(
pVgroup
,
pMsg
);
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
...
...
@@ -836,6 +838,8 @@ static void mnodeProcessCreateVnodeRsp(SRpcMsg *rpcMsg) {
pVgroup
->
vgId
,
tstrerror
(
rpcMsg
->
code
),
mnodeMsg
->
received
,
mnodeMsg
->
successed
,
mnodeMsg
->
expected
,
mnodeMsg
->
rpcMsg
.
handle
,
rpcMsg
->
ahandle
);
assert
(
mnodeMsg
->
received
<=
mnodeMsg
->
expected
);
if
(
mnodeMsg
->
received
!=
mnodeMsg
->
expected
)
return
;
if
(
mnodeMsg
->
received
==
mnodeMsg
->
successed
)
{
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
a4d710e6
...
...
@@ -59,7 +59,7 @@ int32_t vnodeInitResources() {
vnodeInitWriteFp
();
vnodeInitReadFp
();
tsDnodeVnodesHash
=
taosHashInit
(
TSDB_M
AX
_VNODES
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
true
);
tsDnodeVnodesHash
=
taosHashInit
(
TSDB_M
IN
_VNODES
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
true
);
if
(
tsDnodeVnodesHash
==
NULL
)
{
vError
(
"failed to init vnode list"
);
return
TSDB_CODE_VND_OUT_OF_MEMORY
;
...
...
tests/CMakeLists.txt
浏览文件 @
a4d710e6
...
...
@@ -12,3 +12,4 @@ SET(CMAKE_VERBOSE_MAKEFILE ON)
ADD_SUBDIRECTORY
(
examples/c
)
ADD_SUBDIRECTORY
(
tsim
)
ADD_SUBDIRECTORY
(
test/c
)
ADD_SUBDIRECTORY
(
comparisonTest/tdengine
)
tests/comparisonTest/tdengine/CMakeLists.txt
0 → 100644
浏览文件 @
a4d710e6
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/common/inc
)
INCLUDE_DIRECTORIES
(
${
TD_OS_DIR
}
/inc
)
IF
((
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
))
add_executable
(
tdengineTest tdengineTest.c
)
target_link_libraries
(
tdengineTest taos_static tutil common pthread
)
ENDIF
()
tests/comparisonTest/tdengine/tdengineTest.c
浏览文件 @
a4d710e6
...
...
@@ -7,6 +7,7 @@
#include <time.h>
#include <pthread.h>
#include <sys/time.h>
#include <inttypes.h>
typedef
struct
{
char
sql
[
256
];
...
...
@@ -123,19 +124,21 @@ void writeDataImp(void *param) {
if
(
taos
==
NULL
)
taos_error
(
taos
);
int
code
=
taos_query
(
taos
,
"use db"
);
TAOS_RES
*
result
=
taos_query
(
taos
,
"use db"
);
int32_t
code
=
taos_errno
(
result
);
if
(
code
!=
0
)
{
taos_error
(
taos
);
}
taos_free_result
(
result
);
char
sql
[
65000
]
;
char
*
sql
=
calloc
(
1
,
8
*
1024
*
1024
)
;
int
sqlLen
=
0
;
int
lastMachineid
=
0
;
int
counter
=
0
;
int
totalRecords
=
0
;
for
(
int
j
=
pThread
->
sID
;
j
<=
pThread
->
eID
;
j
++
)
{
char
fileName
[
256
];
char
fileName
[
300
];
sprintf
(
fileName
,
"%s/testdata%d.csv"
,
arguments
.
dataDir
,
j
);
FILE
*
fp
=
fopen
(
fileName
,
"r"
);
...
...
@@ -162,7 +165,7 @@ void writeDataImp(void *param) {
int64_t
timestamp
;
int
temperature
;
float
humidity
;
sscanf
(
line
,
"%d%s%d%
lld
%d%f"
,
&
machineid
,
machinename
,
&
machinegroup
,
&
timestamp
,
&
temperature
,
&
humidity
);
sscanf
(
line
,
"%d%s%d%
"
PRId64
"
%d%f"
,
&
machineid
,
machinename
,
&
machinegroup
,
&
timestamp
,
&
temperature
,
&
humidity
);
if
(
counter
==
0
)
{
sqlLen
=
sprintf
(
sql
,
"insert into"
);
...
...
@@ -174,14 +177,16 @@ void writeDataImp(void *param) {
machineid
,
machineid
,
machinename
,
machinegroup
);
}
sqlLen
+=
sprintf
(
sql
+
sqlLen
,
"(%
lld
,%d,%f)"
,
timestamp
,
temperature
,
humidity
);
sqlLen
+=
sprintf
(
sql
+
sqlLen
,
"(%
"
PRId64
"
,%d,%f)"
,
timestamp
,
temperature
,
humidity
);
counter
++
;
if
(
counter
>=
arguments
.
rowsPerRequest
)
{
int
code
=
taos_query
(
taos
,
sql
);
TAOS_RES
*
result
=
taos_query
(
taos
,
sql
);
int32_t
code
=
taos_errno
(
result
);
if
(
code
!=
0
)
{
printf
(
"thread:%d error:%d reason:%s
\n
"
,
pThread
->
pi
d
,
code
,
taos_errstr
(
taos
));
printf
(
"thread:%d error:%d reason:%s
\n
"
,
pThread
->
threadI
d
,
code
,
taos_errstr
(
taos
));
}
taos_free_result
(
result
);
totalRecords
+=
counter
;
counter
=
0
;
...
...
@@ -194,15 +199,18 @@ void writeDataImp(void *param) {
}
if
(
counter
>
0
)
{
int
code
=
taos_query
(
taos
,
sql
);
TAOS_RES
*
result
=
taos_query
(
taos
,
sql
);
int32_t
code
=
taos_errno
(
result
);
if
(
code
!=
0
)
{
printf
(
"thread:%d error:%d reason:%s
\n
"
,
pThread
->
pi
d
,
code
,
taos_errstr
(
taos
));
printf
(
"thread:%d error:%d reason:%s
\n
"
,
pThread
->
threadI
d
,
code
,
taos_errstr
(
taos
));
}
taos_free_result
(
result
);
totalRecords
+=
counter
;
}
__sync_fetch_and_add
(
&
statis
.
totalRows
,
totalRecords
);
free
(
sql
);
}
void
writeData
()
{
...
...
@@ -215,19 +223,23 @@ void writeData() {
taos_init
();
void
*
taos
=
taos_connect
(
"127.0.0.1"
,
"root"
,
"taosdata"
,
NULL
,
0
);
if
(
taos
==
NULL
)
taos_error
(
taos
);
if
(
taos
==
NULL
)
taos_error
(
taos
);
int
code
=
taos_query
(
taos
,
"create database if not exists db"
);
TAOS_RES
*
result
=
taos_query
(
taos
,
"create database if not exists db"
);
int32_t
code
=
taos_errno
(
result
);
if
(
code
!=
0
)
{
taos_error
(
taos
);
}
taos_free_result
(
result
);
code
=
taos_query
(
taos
,
"create table if not exists db.devices(ts timestamp, temperature int, humidity float) "
"tags(devid int, devname binary(16), devgroup int)"
);
result
=
taos_query
(
taos
,
"create table if not exists db.devices(ts timestamp, temperature int, humidity float) "
"tags(devid int, devname binary(16), devgroup int)"
);
code
=
taos_errno
(
result
);
if
(
code
!=
0
)
{
taos_error
(
taos
);
}
taos_free_result
(
result
);
int64_t
st
=
getTimeStampMs
();
...
...
@@ -292,17 +304,12 @@ void readData() {
int64_t
st
=
getTimeStampMs
();
int
code
=
taos_query
(
taos
,
line
);
TAOS_RES
*
result
=
taos_query
(
taos
,
line
);
int32_t
code
=
taos_errno
(
result
);
if
(
code
!=
0
)
{
taos_error
(
taos
);
}
void
*
result
=
taos_use_result
(
taos
);
if
(
result
==
NULL
)
{
printf
(
"failed to get result, reason:%s
\n
"
,
taos_errstr
(
taos
));
exit
(
1
);
}
TAOS_ROW
row
;
int
rows
=
0
;
//int num_fields = taos_field_count(taos);
...
...
tests/pytest/util/dnodes.py
浏览文件 @
a4d710e6
...
...
@@ -28,7 +28,9 @@ class TDSimClient:
"locale"
:
"en_US.UTF-8"
,
"charset"
:
"UTF-8"
,
"asyncLog"
:
"0"
,
"maxTablesPerVnode"
:
"4"
,
"minTablesPerVnode"
:
"4"
,
"maxTablesPerVnode"
:
"1000"
,
"tableIncStepPerVnode"
:
"10000"
,
"maxVgroupsPerDb"
:
"1000"
,
"sdbDebugFlag"
:
"143"
,
"rpcDebugFlag"
:
"135"
,
...
...
tests/script/sh/deploy.sh
浏览文件 @
a4d710e6
...
...
@@ -139,7 +139,9 @@ echo "clog 2" >> $TAOS_CFG
echo
"statusInterval 1"
>>
$TAOS_CFG
echo
"numOfTotalVnodes 4"
>>
$TAOS_CFG
echo
"maxVgroupsPerDb 4"
>>
$TAOS_CFG
echo
"minTablesPerVnode 4"
>>
$TAOS_CFG
echo
"maxTablesPerVnode 1000"
>>
$TAOS_CFG
echo
"tableIncStepPerVnode 10000"
>>
$TAOS_CFG
echo
"asyncLog 0"
>>
$TAOS_CFG
echo
"numOfMnodes 1"
>>
$TAOS_CFG
echo
"locale en_US.UTF-8"
>>
$TAOS_CFG
...
...
tests/script/tmp/prepare.sim
浏览文件 @
a4d710e6
...
...
@@ -25,10 +25,15 @@ system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 20
system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 20
system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 20
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 20
system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 20
system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 20
system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 20
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 2
system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 2
system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 2
system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 2
system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 100000
system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 100000
system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 100000
system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 100000
system sh/cfg.sh -n dnode1 -c http -v 1
system sh/cfg.sh -n dnode2 -c http -v 1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录