Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d8f1b34f
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
d8f1b34f
编写于
3月 18, 2021
作者:
sangshuduo
提交者:
GitHub
3月 18, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-3356] <fix>: fix bug regarding limit offset with exist child table. (#5495)
Co-authored-by:
N
Shuduo Sang
<
sdsang@taosdata.com
>
上级
af2f6bb0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
41 deletion
+13
-41
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+13
-41
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
d8f1b34f
...
...
@@ -2044,7 +2044,8 @@ static int getChildNameOfSuperTableWithLimitAndOffset(TAOS * taos,
//printf("==== sub table name: %s\n", pTblName);
count
++
;
if
(
count
>=
childTblCount
-
1
)
{
char
*
tmp
=
realloc
(
childTblName
,
(
size_t
)
childTblCount
*
1
.
5
*
TSDB_TABLE_NAME_LEN
+
1
);
char
*
tmp
=
realloc
(
childTblName
,
(
size_t
)
childTblCount
*
1
.
5
*
TSDB_TABLE_NAME_LEN
+
1
);
if
(
tmp
!=
NULL
)
{
childTblName
=
tmp
;
childTblCount
=
(
int
)(
childTblCount
*
1
.
5
);
...
...
@@ -2052,14 +2053,15 @@ static int getChildNameOfSuperTableWithLimitAndOffset(TAOS * taos,
(
size_t
)((
childTblCount
-
count
)
*
TSDB_TABLE_NAME_LEN
));
}
else
{
// exit, if allocate more memory failed
printf
(
"realloc fail for save child table name of %s.%s
\n
"
,
dbName
,
sTblName
);
errorPrint
(
"%s() LN%d, realloc fail for save child table name of %s.%s
\n
"
,
__func__
,
__LINE__
,
dbName
,
sTblName
);
tmfree
(
childTblName
);
taos_free_result
(
res
);
taos_close
(
taos
);
exit
(
-
1
);
}
}
pTblName
=
childTblName
+
count
*
TSDB_TABLE_NAME_LEN
;
pTblName
=
childTblName
+
count
*
TSDB_TABLE_NAME_LEN
;
}
*
childTblCountOfSuperTbl
=
count
;
...
...
@@ -2140,6 +2142,7 @@ static int getSuperTableFromServer(TAOS * taos, char* dbName,
calcRowLen
(
superTbls
);
/*
if (TBL_ALREADY_EXISTS == superTbls->childTblExists) {
//get all child table name use cmd: select tbname from superTblName;
int childTblCount = 10000;
...
...
@@ -2153,6 +2156,7 @@ static int getSuperTableFromServer(TAOS * taos, char* dbName,
&superTbls->childTblName,
&superTbls->childTblCount);
}
*/
return
0
;
}
...
...
@@ -4356,7 +4360,7 @@ static int generateSQLHead(char *tableName, int32_t tableSeq, threadInfo* pThrea
superTblInfo
->
maxSqlLen
,
"insert into %s.%s values"
,
pThreadInfo
->
db_name
,
superTblInfo
->
childTblName
+
tableSeq
*
TSDB_TABLE_NAME_LEN
);
tableName
);
}
else
{
len
=
snprintf
(
buffer
,
(
superTblInfo
?
superTblInfo
->
maxSqlLen
:
g_args
.
max_sql_len
),
...
...
@@ -4561,10 +4565,10 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
int
affectedRows
=
execInsert
(
pThreadInfo
,
buffer
,
recOfBatch
);
verbosePrint
(
"[%d] %s() LN%d affectedRows=%d
\n
"
,
pThreadInfo
->
threadID
,
__func__
,
__LINE__
,
affectedRows
);
if
(
affectedRows
<
0
)
{
errorPrint
(
"[%d] %s() LN%d execInsert affected rows: %d
\n
%s
\n
"
,
if
(
(
affectedRows
<
0
)
||
(
recOfBatch
!=
affectedRows
)
)
{
errorPrint
(
"[%d] %s() LN%d execInsert
insert %d,
affected rows: %d
\n
%s
\n
"
,
pThreadInfo
->
threadID
,
__func__
,
__LINE__
,
affectedRows
,
buffer
);
recOfBatch
,
affectedRows
,
buffer
);
goto
free_and_statistics_interlace
;
}
...
...
@@ -4885,10 +4889,9 @@ static void startMultiThreadInsertData(int threads, char* db_name,
&
start_time
,
strlen
(
superTblInfo
->
startTimestamp
),
timePrec
,
0
))
{
errorPrint
(
"%s() LN%d, failed to parse time!
\n
"
,
__func__
,
__LINE__
);
exit
(
-
1
);
ERROR_EXIT
(
"failed to parse time!
\n
"
);
}
}
}
}
else
{
start_time
=
1500000000000
;
}
...
...
@@ -4911,36 +4914,6 @@ static void startMultiThreadInsertData(int threads, char* db_name,
}
}
if
(
superTblInfo
&&
(
superTblInfo
->
childTblOffset
>=
0
)
&&
(
superTblInfo
->
childTblLimit
>
0
))
{
TAOS
*
taos
=
taos_connect
(
g_Dbs
.
host
,
g_Dbs
.
user
,
g_Dbs
.
password
,
db_name
,
g_Dbs
.
port
);
if
(
NULL
==
taos
)
{
errorPrint
(
"%s() LN%d, connect to server fail , reason: %s
\n
"
,
__func__
,
__LINE__
,
taos_errstr
(
NULL
));
exit
(
-
1
);
}
superTblInfo
->
childTblName
=
(
char
*
)
calloc
(
1
,
superTblInfo
->
childTblLimit
*
TSDB_TABLE_NAME_LEN
);
if
(
superTblInfo
->
childTblName
==
NULL
)
{
errorPrint
(
"%s() LN%d, alloc memory failed!
\n
"
,
__func__
,
__LINE__
);
taos_close
(
taos
);
exit
(
-
1
);
}
int
childTblCount
;
getChildNameOfSuperTableWithLimitAndOffset
(
taos
,
db_name
,
superTblInfo
->
sTblName
,
&
superTblInfo
->
childTblName
,
&
childTblCount
,
superTblInfo
->
childTblLimit
,
superTblInfo
->
childTblOffset
);
taos_close
(
taos
);
}
// read sample data from file first
if
((
superTblInfo
)
&&
(
0
==
strncasecmp
(
superTblInfo
->
dataSource
,
"sample"
,
strlen
(
"sample"
))))
{
...
...
@@ -4950,7 +4923,6 @@ static void startMultiThreadInsertData(int threads, char* db_name,
}
}
TAOS
*
taos
=
taos_connect
(
g_Dbs
.
host
,
g_Dbs
.
user
,
g_Dbs
.
password
,
db_name
,
g_Dbs
.
port
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录