Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
c13f335f
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看板
未验证
提交
c13f335f
编写于
3月 30, 2021
作者:
sangshuduo
提交者:
GitHub
3月 30, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-3591] <fix>: rework limit and offset logic. (#5618)
Co-authored-by:
N
Shuduo Sang
<
sdsang@taosdata.com
>
上级
78e67ebe
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
46 addition
and
45 deletion
+46
-45
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+46
-45
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
c13f335f
...
...
@@ -3118,7 +3118,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
g_args
.
interlace_rows
,
g_args
.
num_of_RPR
);
printf
(
" interlace rows value will be set to num_of_records_per_request %d
\n\n
"
,
g_args
.
num_of_RPR
);
printf
(
" press Enter key to continue or Ctrl
+
C to stop."
);
printf
(
" press Enter key to continue or Ctrl
-
C to stop."
);
(
void
)
getchar
();
g_args
.
interlace_rows
=
g_args
.
num_of_RPR
;
}
...
...
@@ -3621,7 +3621,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
i
,
j
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
interlaceRows
,
g_args
.
num_of_RPR
);
printf
(
" interlace rows value will be set to num_of_records_per_request %d
\n\n
"
,
g_args
.
num_of_RPR
);
printf
(
" press Enter key to continue or Ctrl
+
C to stop."
);
printf
(
" press Enter key to continue or Ctrl
-
C to stop."
);
(
void
)
getchar
();
g_Dbs
.
db
[
i
].
superTbls
[
j
].
interlaceRows
=
g_args
.
num_of_RPR
;
}
...
...
@@ -5008,39 +5008,14 @@ static void *asyncWrite(void *sarg) {
static
void
startMultiThreadInsertData
(
int
threads
,
char
*
db_name
,
char
*
precision
,
SSuperTable
*
superTblInfo
)
{
pthread_t
*
pids
=
malloc
(
threads
*
sizeof
(
pthread_t
));
assert
(
pids
!=
NULL
);
threadInfo
*
infos
=
malloc
(
threads
*
sizeof
(
threadInfo
));
assert
(
infos
!=
NULL
);
memset
(
pids
,
0
,
threads
*
sizeof
(
pthread_t
));
memset
(
infos
,
0
,
threads
*
sizeof
(
threadInfo
));
int
ntables
=
0
;
if
(
superTblInfo
)
{
if
((
superTblInfo
->
childTblOffset
>=
0
)
&&
(
superTblInfo
->
childTblLimit
>
0
))
{
ntables
=
superTblInfo
->
childTblLimit
;
}
else
{
ntables
=
superTblInfo
->
childTblCount
;
}
}
else
{
ntables
=
g_args
.
num_of_tables
;
}
pthread_t
*
pids
=
malloc
(
threads
*
sizeof
(
pthread_t
));
assert
(
pids
!=
NULL
);
int
a
=
ntables
/
threads
;
if
(
a
<
1
)
{
threads
=
ntables
;
a
=
1
;
}
threadInfo
*
infos
=
malloc
(
threads
*
sizeof
(
threadInfo
));
assert
(
infos
!=
NULL
);
int
b
=
0
;
if
(
threads
!=
0
)
{
b
=
ntables
%
threads
;
}
memset
(
pids
,
0
,
threads
*
sizeof
(
pthread_t
));
memset
(
infos
,
0
,
threads
*
sizeof
(
threadInfo
));
//TAOS* taos;
//if (0 == strncasecmp(superTblInfo->insertMode, "taosc", 5)) {
...
...
@@ -5082,13 +5057,6 @@ static void startMultiThreadInsertData(int threads, char* db_name,
double
start
=
getCurrentTime
();
int
startFrom
;
if
((
superTblInfo
)
&&
(
superTblInfo
->
childTblOffset
>=
0
))
startFrom
=
superTblInfo
->
childTblOffset
;
else
startFrom
=
0
;
// read sample data from file first
if
((
superTblInfo
)
&&
(
0
==
strncasecmp
(
superTblInfo
->
dataSource
,
"sample"
,
strlen
(
"sample"
))))
{
...
...
@@ -5118,18 +5086,36 @@ static void startMultiThreadInsertData(int threads, char* db_name,
exit
(
-
1
);
}
if
(
superTblInfo
)
{
int
ntables
=
0
;
int
startFrom
;
if
(
superTblInfo
)
{
int
limit
,
offset
;
if
(
superTblInfo
&&
(
superTblInfo
->
childTblOffset
>=
0
)
&&
(
superTblInfo
->
childTblLimit
>
0
))
{
limit
=
superTblInfo
->
childTblLimit
;
offset
=
superTblInfo
->
childTblOffset
;
if
(
superTblInfo
->
childTblOffset
>=
superTblInfo
->
childTblCount
)
{
printf
(
"WARNING: specified offset >= child table count!
\n
"
);
if
(
!
g_args
.
answer_yes
)
{
printf
(
" Press enter key to continue or Ctrl-C to stop
\n\n
"
);
(
void
)
getchar
();
}
}
if
(
superTblInfo
->
childTblOffset
>=
0
)
{
if
(
superTblInfo
->
childTblLimit
<=
0
)
{
superTblInfo
->
childTblLimit
=
superTblInfo
->
childTblCount
-
superTblInfo
->
childTblOffset
;
}
offset
=
superTblInfo
->
childTblOffset
;
limit
=
superTblInfo
->
childTblLimit
;
}
else
{
limit
=
superTblInfo
->
childTblCount
;
offset
=
0
;
}
ntables
=
limit
;
startFrom
=
offset
;
superTblInfo
->
childTblName
=
(
char
*
)
calloc
(
1
,
limit
*
TSDB_TABLE_NAME_LEN
);
if
(
superTblInfo
->
childTblName
==
NULL
)
{
...
...
@@ -5145,9 +5131,24 @@ static void startMultiThreadInsertData(int threads, char* db_name,
&
superTblInfo
->
childTblName
,
&
childTblCount
,
limit
,
offset
);
}
else
{
ntables
=
g_args
.
num_of_tables
;
startFrom
=
0
;
}
taos_close
(
taos
);
int
a
=
ntables
/
threads
;
if
(
a
<
1
)
{
threads
=
ntables
;
a
=
1
;
}
int
b
=
0
;
if
(
threads
!=
0
)
{
b
=
ntables
%
threads
;
}
for
(
int
i
=
0
;
i
<
threads
;
i
++
)
{
threadInfo
*
t_info
=
infos
+
i
;
t_info
->
threadID
=
i
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录