Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e0f94ef3
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
e0f94ef3
编写于
3月 12, 2021
作者:
sangshuduo
提交者:
GitHub
3月 12, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5408 from taosdata/hotfix/sangshuduo/TD-3228-taosdemo-support-quorum
Hotfix/sangshuduo/td 3228 taosdemo support quorum
上级
4d56f92d
5c84228e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
18 deletion
+23
-18
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+23
-18
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
e0f94ef3
...
...
@@ -2161,31 +2161,35 @@ static int createDatabases() {
int
dataLen
=
0
;
dataLen
+=
snprintf
(
command
+
dataLen
,
BUFFER_SIZE
-
dataLen
,
"create database if not exists %s
"
,
g_Dbs
.
db
[
i
].
dbName
);
BUFFER_SIZE
-
dataLen
,
"create database if not exists %s"
,
g_Dbs
.
db
[
i
].
dbName
);
if
(
g_Dbs
.
db
[
i
].
dbCfg
.
blocks
>
0
)
{
dataLen
+=
snprintf
(
command
+
dataLen
,
BUFFER_SIZE
-
dataLen
,
"
blocks %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
blocks
);
BUFFER_SIZE
-
dataLen
,
"
blocks %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
blocks
);
}
if
(
g_Dbs
.
db
[
i
].
dbCfg
.
cache
>
0
)
{
dataLen
+=
snprintf
(
command
+
dataLen
,
BUFFER_SIZE
-
dataLen
,
"
cache %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
cache
);
BUFFER_SIZE
-
dataLen
,
"
cache %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
cache
);
}
if
(
g_Dbs
.
db
[
i
].
dbCfg
.
days
>
0
)
{
dataLen
+=
snprintf
(
command
+
dataLen
,
BUFFER_SIZE
-
dataLen
,
"
days %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
days
);
BUFFER_SIZE
-
dataLen
,
"
days %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
days
);
}
if
(
g_Dbs
.
db
[
i
].
dbCfg
.
keep
>
0
)
{
dataLen
+=
snprintf
(
command
+
dataLen
,
BUFFER_SIZE
-
dataLen
,
"keep %d "
,
g_Dbs
.
db
[
i
].
dbCfg
.
keep
);
BUFFER_SIZE
-
dataLen
,
" keep %d"
,
g_Dbs
.
db
[
i
].
dbCfg
.
keep
);
}
if
(
g_Dbs
.
db
[
i
].
dbCfg
.
quorum
>
1
)
{
dataLen
+=
snprintf
(
command
+
dataLen
,
BUFFER_SIZE
-
dataLen
,
" quorum %d"
,
g_Dbs
.
db
[
i
].
dbCfg
.
quorum
);
}
if
(
g_Dbs
.
db
[
i
].
dbCfg
.
replica
>
0
)
{
dataLen
+=
snprintf
(
command
+
dataLen
,
BUFFER_SIZE
-
dataLen
,
"
replica %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
replica
);
BUFFER_SIZE
-
dataLen
,
"
replica %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
replica
);
}
if
(
g_Dbs
.
db
[
i
].
dbCfg
.
update
>
0
)
{
dataLen
+=
snprintf
(
command
+
dataLen
,
BUFFER_SIZE
-
dataLen
,
"
update %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
update
);
BUFFER_SIZE
-
dataLen
,
"
update %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
update
);
}
//if (g_Dbs.db[i].dbCfg.maxtablesPerVnode > 0) {
// dataLen += snprintf(command + dataLen,
...
...
@@ -2193,31 +2197,32 @@ static int createDatabases() {
//}
if
(
g_Dbs
.
db
[
i
].
dbCfg
.
minRows
>
0
)
{
dataLen
+=
snprintf
(
command
+
dataLen
,
BUFFER_SIZE
-
dataLen
,
"
minrows %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
minRows
);
BUFFER_SIZE
-
dataLen
,
"
minrows %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
minRows
);
}
if
(
g_Dbs
.
db
[
i
].
dbCfg
.
maxRows
>
0
)
{
dataLen
+=
snprintf
(
command
+
dataLen
,
BUFFER_SIZE
-
dataLen
,
"
maxrows %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
maxRows
);
BUFFER_SIZE
-
dataLen
,
"
maxrows %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
maxRows
);
}
if
(
g_Dbs
.
db
[
i
].
dbCfg
.
comp
>
0
)
{
dataLen
+=
snprintf
(
command
+
dataLen
,
BUFFER_SIZE
-
dataLen
,
"
comp %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
comp
);
BUFFER_SIZE
-
dataLen
,
"
comp %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
comp
);
}
if
(
g_Dbs
.
db
[
i
].
dbCfg
.
walLevel
>
0
)
{
dataLen
+=
snprintf
(
command
+
dataLen
,
BUFFER_SIZE
-
dataLen
,
"
wal %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
walLevel
);
BUFFER_SIZE
-
dataLen
,
"
wal %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
walLevel
);
}
if
(
g_Dbs
.
db
[
i
].
dbCfg
.
cacheLast
>
0
)
{
dataLen
+=
snprintf
(
command
+
dataLen
,
BUFFER_SIZE
-
dataLen
,
"
cachelast %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
cacheLast
);
BUFFER_SIZE
-
dataLen
,
"
cachelast %d
"
,
g_Dbs
.
db
[
i
].
dbCfg
.
cacheLast
);
}
if
(
g_Dbs
.
db
[
i
].
dbCfg
.
fsync
>
0
)
{
dataLen
+=
snprintf
(
command
+
dataLen
,
BUFFER_SIZE
-
dataLen
,
"fsync %d "
,
g_Dbs
.
db
[
i
].
dbCfg
.
fsync
);
dataLen
+=
snprintf
(
command
+
dataLen
,
BUFFER_SIZE
-
dataLen
,
" fsync %d"
,
g_Dbs
.
db
[
i
].
dbCfg
.
fsync
);
}
if
((
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"ms"
,
2
))
||
(
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"us"
,
2
)))
{
if
((
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"ms"
,
strlen
(
"ms"
)
))
||
(
0
==
strncasecmp
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
"us"
,
strlen
(
"us"
)
)))
{
dataLen
+=
snprintf
(
command
+
dataLen
,
BUFFER_SIZE
-
dataLen
,
"precision
\'
%s
\'
;"
,
g_Dbs
.
db
[
i
].
dbCfg
.
precision
);
"
precision
\'
%s
\'
;"
,
g_Dbs
.
db
[
i
].
dbCfg
.
precision
);
}
debugPrint
(
"%s() %d command: %s
\n
"
,
__func__
,
__LINE__
,
command
);
...
...
@@ -3044,9 +3049,9 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
if
(
quorum
&&
quorum
->
type
==
cJSON_Number
)
{
g_Dbs
.
db
[
i
].
dbCfg
.
quorum
=
quorum
->
valueint
;
}
else
if
(
!
quorum
)
{
g_Dbs
.
db
[
i
].
dbCfg
.
quorum
=
-
1
;
g_Dbs
.
db
[
i
].
dbCfg
.
quorum
=
1
;
}
else
{
printf
(
"failed to read json,
walLevel not found
"
);
printf
(
"failed to read json,
quorum input mistake
"
);
goto
PARSE_OVER
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录