Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b7ec3a3c
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b7ec3a3c
编写于
3月 24, 2021
作者:
sangshuduo
提交者:
GitHub
3月 24, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-3357] <fix>: fix child table count if exists. (#5542)
Co-authored-by:
N
Shuduo Sang
<
sdsang@taosdata.com
>
上级
82a947a3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
16 deletion
+12
-16
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+12
-16
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
b7ec3a3c
...
@@ -2422,11 +2422,8 @@ static int createDatabases() {
...
@@ -2422,11 +2422,8 @@ static int createDatabases() {
&
g_Dbs
.
db
[
i
].
superTbls
[
j
],
g_Dbs
.
use_metric
);
&
g_Dbs
.
db
[
i
].
superTbls
[
j
],
g_Dbs
.
use_metric
);
}
else
{
}
else
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
superTblExists
=
TBL_ALREADY_EXISTS
;
g_Dbs
.
db
[
i
].
superTbls
[
j
].
superTblExists
=
TBL_ALREADY_EXISTS
;
ret
=
getSuperTableFromServer
(
taos
,
g_Dbs
.
db
[
i
].
dbName
,
if
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblExists
!=
TBL_ALREADY_EXISTS
)
{
ret
=
getSuperTableFromServer
(
taos
,
g_Dbs
.
db
[
i
].
dbName
,
&
g_Dbs
.
db
[
i
].
superTbls
[
j
]);
&
g_Dbs
.
db
[
i
].
superTbls
[
j
]);
}
}
}
if
(
0
!=
ret
)
{
if
(
0
!=
ret
)
{
...
@@ -2434,16 +2431,16 @@ static int createDatabases() {
...
@@ -2434,16 +2431,16 @@ static int createDatabases() {
taos_close
(
taos
);
taos_close
(
taos
);
return
-
1
;
return
-
1
;
}
}
}
}
}
}
taos_close
(
taos
);
taos_close
(
taos
);
return
0
;
return
0
;
}
}
static
void
*
createTable
(
void
*
sarg
)
static
void
*
createTable
(
void
*
sarg
)
{
{
threadInfo
*
winfo
=
(
threadInfo
*
)
sarg
;
threadInfo
*
winfo
=
(
threadInfo
*
)
sarg
;
SSuperTable
*
superTblInfo
=
winfo
->
superTblInfo
;
SSuperTable
*
superTblInfo
=
winfo
->
superTblInfo
;
int64_t
lastPrintTime
=
taosGetTimestampMs
();
int64_t
lastPrintTime
=
taosGetTimestampMs
();
...
@@ -2463,19 +2460,19 @@ static void* createTable(void *sarg)
...
@@ -2463,19 +2460,19 @@ static void* createTable(void *sarg)
int
len
=
0
;
int
len
=
0
;
int
batchNum
=
0
;
int
batchNum
=
0
;
verbosePrint
(
"%s() LN%d: Creating table from %d to %d
\n
"
,
verbosePrint
(
"%s() LN%d: Creating table from %d to %d
\n
"
,
__func__
,
__LINE__
,
__func__
,
__LINE__
,
winfo
->
start_table_from
,
winfo
->
end_table_to
);
winfo
->
start_table_from
,
winfo
->
end_table_to
);
for
(
int
i
=
winfo
->
start_table_from
;
i
<=
winfo
->
end_table_to
;
i
++
)
{
for
(
int
i
=
winfo
->
start_table_from
;
i
<=
winfo
->
end_table_to
;
i
++
)
{
if
(
0
==
g_Dbs
.
use_metric
)
{
if
(
0
==
g_Dbs
.
use_metric
)
{
snprintf
(
buffer
,
buff_len
,
snprintf
(
buffer
,
buff_len
,
"create table if not exists %s.%s%d %s;"
,
"create table if not exists %s.%s%d %s;"
,
winfo
->
db_name
,
winfo
->
db_name
,
g_args
.
tb_prefix
,
i
,
g_args
.
tb_prefix
,
i
,
winfo
->
cols
);
winfo
->
cols
);
}
else
{
}
else
{
if
(
0
==
len
)
{
if
(
0
==
len
)
{
batchNum
=
0
;
batchNum
=
0
;
memset
(
buffer
,
0
,
buff_len
);
memset
(
buffer
,
0
,
buff_len
);
len
+=
snprintf
(
buffer
+
len
,
len
+=
snprintf
(
buffer
+
len
,
...
@@ -2494,7 +2491,7 @@ static void* createTable(void *sarg)
...
@@ -2494,7 +2491,7 @@ static void* createTable(void *sarg)
free
(
buffer
);
free
(
buffer
);
return
NULL
;
return
NULL
;
}
}
len
+=
snprintf
(
buffer
+
len
,
len
+=
snprintf
(
buffer
+
len
,
superTblInfo
->
maxSqlLen
-
len
,
superTblInfo
->
maxSqlLen
-
len
,
"if not exists %s.%s%d using %s.%s tags %s "
,
"if not exists %s.%s%d using %s.%s tags %s "
,
...
@@ -2505,7 +2502,7 @@ static void* createTable(void *sarg)
...
@@ -2505,7 +2502,7 @@ static void* createTable(void *sarg)
batchNum
++
;
batchNum
++
;
if
((
batchNum
<
superTblInfo
->
batchCreateTableNum
)
if
((
batchNum
<
superTblInfo
->
batchCreateTableNum
)
&&
((
superTblInfo
->
maxSqlLen
-
len
)
&&
((
superTblInfo
->
maxSqlLen
-
len
)
>=
(
superTblInfo
->
lenOfTagOfOneRow
+
256
)))
{
>=
(
superTblInfo
->
lenOfTagOfOneRow
+
256
)))
{
continue
;
continue
;
}
}
...
@@ -2514,8 +2511,8 @@ static void* createTable(void *sarg)
...
@@ -2514,8 +2511,8 @@ static void* createTable(void *sarg)
len
=
0
;
len
=
0
;
verbosePrint
(
"%s() LN%d %s
\n
"
,
__func__
,
__LINE__
,
buffer
);
verbosePrint
(
"%s() LN%d %s
\n
"
,
__func__
,
__LINE__
,
buffer
);
if
(
0
!=
queryDbExec
(
winfo
->
taos
,
buffer
,
NO_INSERT_TYPE
)){
if
(
0
!=
queryDbExec
(
winfo
->
taos
,
buffer
,
NO_INSERT_TYPE
)){
errorPrint
(
"queryDbExec() failed. buffer:
\n
%s
\n
"
,
buffer
);
free
(
buffer
);
free
(
buffer
);
errorPrint
(
"queryDbExec() failed. buffer:
\n
%s
\n
"
,
buffer
);
return
NULL
;
return
NULL
;
}
}
...
@@ -2578,7 +2575,7 @@ static int startMultiThreadCreateChildTable(
...
@@ -2578,7 +2575,7 @@ static int startMultiThreadCreateChildTable(
if
(
t_info
->
taos
==
NULL
)
{
if
(
t_info
->
taos
==
NULL
)
{
errorPrint
(
"Failed to connect to TDengine, reason:%s
\n
"
,
taos_errstr
(
NULL
));
errorPrint
(
"Failed to connect to TDengine, reason:%s
\n
"
,
taos_errstr
(
NULL
));
free
(
pids
);
free
(
pids
);
free
(
infos
);
free
(
infos
);
return
-
1
;
return
-
1
;
}
}
...
@@ -4530,7 +4527,6 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
...
@@ -4530,7 +4527,6 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
recOfBatch
+=
batchPerTbl
;
recOfBatch
+=
batchPerTbl
;
startTime
+=
batchPerTbl
*
superTblInfo
->
timeStampStep
;
startTime
+=
batchPerTbl
*
superTblInfo
->
timeStampStep
;
pThreadInfo
->
totalInsertRows
+=
batchPerTbl
;
pThreadInfo
->
totalInsertRows
+=
batchPerTbl
;
verbosePrint
(
"[%d] %s() LN%d batchPerTbl=%d recOfBatch=%d
\n
"
,
verbosePrint
(
"[%d] %s() LN%d batchPerTbl=%d recOfBatch=%d
\n
"
,
pThreadInfo
->
threadID
,
__func__
,
__LINE__
,
pThreadInfo
->
threadID
,
__func__
,
__LINE__
,
batchPerTbl
,
recOfBatch
);
batchPerTbl
,
recOfBatch
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录