Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
199bf6e0
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看板
未验证
提交
199bf6e0
编写于
7月 22, 2021
作者:
sangshuduo
提交者:
GitHub
7月 22, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-5445]<fix>: taosdemo bug stmt interface with sample data. (#6971)
sync from develop branch.
上级
c41d23da
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
1440 addition
and
1432 deletion
+1440
-1432
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+1440
-1432
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
199bf6e0
...
...
@@ -16,7 +16,7 @@
/*
when in some thread query return error, thread don't exit, but return, otherwise coredump in other thread.
*/
*/
#include <stdint.h>
#include <taos.h>
...
...
@@ -24,24 +24,24 @@
#define CURL_STATICLIB
#ifdef LINUX
#include <argp.h>
#include <inttypes.h>
#ifndef _ALPINE
#include <error.h>
#endif
#include <pthread.h>
#include <semaphore.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include <wordexp.h>
#include <regex.h>
#include <argp.h>
#include <inttypes.h>
#ifndef _ALPINE
#include <error.h>
#endif
#include <pthread.h>
#include <semaphore.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include <wordexp.h>
#include <regex.h>
#else
#include <regex.h>
#include <stdio.h>
#include <regex.h>
#include <stdio.h>
#endif
#include <assert.h>
...
...
@@ -485,7 +485,7 @@ typedef unsigned __int32 uint32_t;
#pragma comment ( lib, "ws2_32.lib" )
// Some old MinGW/CYGWIN distributions don't define this:
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#endif // ENABLE_VIRTUAL_TERMINAL_PROCESSING
static
HANDLE
g_stdoutHandle
;
...
...
@@ -2697,7 +2697,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;
...
...
@@ -3270,7 +3270,7 @@ static void createChildTables() {
/*
Read 10000 lines at most. If more than 10000 lines, continue to read after using
*/
*/
static
int
readTagFromCsvFileToMem
(
SSuperTable
*
superTblInfo
)
{
size_t
n
=
0
;
ssize_t
readLen
=
0
;
...
...
@@ -3338,7 +3338,7 @@ static int readTagFromCsvFileToMem(SSuperTable * superTblInfo) {
/*
Read 10000 lines at most. If more than 10000 lines, continue to read after using
*/
*/
static
int
readSampleFromCsvFileToMem
(
SSuperTable
*
superTblInfo
)
{
size_t
n
=
0
;
...
...
@@ -5118,7 +5118,8 @@ static int32_t execInsert(threadInfo *pThreadInfo, uint32_t k)
#if STMT_IFACE_ENABLED == 1
case
STMT_IFACE
:
debugPrint
(
"%s() LN%d, stmt=%p"
,
__func__
,
__LINE__
,
pThreadInfo
->
stmt
);
debugPrint
(
"%s() LN%d, stmt=%p"
,
__func__
,
__LINE__
,
pThreadInfo
->
stmt
);
if
(
0
!=
taos_stmt_execute
(
pThreadInfo
->
stmt
))
{
errorPrint
(
"%s() LN%d, failied to execute insert statement
\n
"
,
__func__
,
__LINE__
);
...
...
@@ -5771,6 +5772,8 @@ static int32_t prepareStbStmtBind(
TAOS_BIND
*
bind
;
if
(
isColumn
)
{
int
cursor
=
0
;
for
(
int
i
=
0
;
i
<
stbInfo
->
columnCount
+
1
;
i
++
)
{
bind
=
(
TAOS_BIND
*
)((
char
*
)
bindArray
+
(
sizeof
(
TAOS_BIND
)
*
i
));
...
...
@@ -5794,7 +5797,6 @@ static int32_t prepareStbStmtBind(
ptr
+=
bind
->
buffer_length
;
}
else
{
int
cursor
=
0
;
if
(
sourceRand
)
{
if
(
-
1
==
prepareStmtBindArrayByType
(
...
...
@@ -5851,6 +5853,7 @@ static int32_t prepareStbStmtBind(
}
free
(
bindBuffer
);
return
0
;
}
...
...
@@ -6570,7 +6573,7 @@ static void callBack(void *param, TAOS_RES *res, int code) {
pstr
+=
sprintf
(
pstr
,
"insert into %s.%s%"
PRId64
" values"
,
pThreadInfo
->
db_name
,
pThreadInfo
->
tb_prefix
,
pThreadInfo
->
start_table_from
);
// if (pThreadInfo->counter >= pThreadInfo->superTblInfo->insertRows) {
// if (pThreadInfo->counter >= pThreadInfo->superTblInfo->insertRows) {
if
(
pThreadInfo
->
counter
>=
g_args
.
num_of_RPR
)
{
pThreadInfo
->
start_table_from
++
;
pThreadInfo
->
counter
=
0
;
...
...
@@ -6724,14 +6727,17 @@ static void startMultiThreadInsertData(int threads, char* db_name,
int64_t
limit
;
uint64_t
offset
;
if
((
NULL
!=
g_args
.
sqlFile
)
&&
(
superTblInfo
->
childTblExists
==
TBL_NO_EXISTS
)
&&
((
superTblInfo
->
childTblOffset
!=
0
)
||
(
superTblInfo
->
childTblLimit
>=
0
)))
{
if
((
NULL
!=
g_args
.
sqlFile
)
&&
(
superTblInfo
->
childTblExists
==
TBL_NO_EXISTS
)
&&
((
superTblInfo
->
childTblOffset
!=
0
)
||
(
superTblInfo
->
childTblLimit
>=
0
)))
{
printf
(
"WARNING: offset and limit will not be used since the child tables not exists!
\n
"
);
}
if
(
superTblInfo
->
childTblExists
==
TBL_ALREADY_EXISTS
)
{
if
((
superTblInfo
->
childTblLimit
<
0
)
||
((
superTblInfo
->
childTblOffset
+
superTblInfo
->
childTblLimit
)
||
((
superTblInfo
->
childTblOffset
+
superTblInfo
->
childTblLimit
)
>
(
superTblInfo
->
childTblCount
)))
{
superTblInfo
->
childTblLimit
=
superTblInfo
->
childTblCount
-
superTblInfo
->
childTblOffset
;
...
...
@@ -6837,7 +6843,8 @@ static void startMultiThreadInsertData(int threads, char* db_name,
#if STMT_IFACE_ENABLED == 1
if
((
g_args
.
iface
==
STMT_IFACE
)
||
((
superTblInfo
)
&&
(
superTblInfo
->
iface
==
STMT_IFACE
)))
{
||
((
superTblInfo
)
&&
(
superTblInfo
->
iface
==
STMT_IFACE
)))
{
int
columnCount
;
if
(
superTblInfo
)
{
...
...
@@ -6865,7 +6872,8 @@ static void startMultiThreadInsertData(int threads, char* db_name,
==
superTblInfo
->
autoCreateTable
))
{
pstr
+=
sprintf
(
pstr
,
"INSERT INTO ? USING %s TAGS(?"
,
superTblInfo
->
sTblName
);
for
(
int
tag
=
0
;
tag
<
(
superTblInfo
->
tagCount
-
1
);
tag
++
)
{
for
(
int
tag
=
0
;
tag
<
(
superTblInfo
->
tagCount
-
1
);
tag
++
)
{
pstr
+=
sprintf
(
pstr
,
",?"
);
}
pstr
+=
sprintf
(
pstr
,
") VALUES(?"
);
...
...
@@ -7027,12 +7035,12 @@ static void *readTable(void *sarg) {
}
int64_t
num_of_DPT
;
/* if (pThreadInfo->superTblInfo) {
/* if (pThreadInfo->superTblInfo) {
num_of_DPT = pThreadInfo->superTblInfo->insertRows; // nrecords_per_table;
} else {
*/
num_of_DPT
=
g_args
.
num_of_DPT
;
// }
// }
int64_t
num_of_tables
=
pThreadInfo
->
ntables
;
// rinfo->end_table_to - rinfo->start_table_from + 1;
int64_t
totalData
=
num_of_DPT
*
num_of_tables
;
...
...
@@ -7591,7 +7599,7 @@ static int queryTestProcess() {
tmfree
((
char
*
)
pidsOfSub
);
tmfree
((
char
*
)
infosOfSub
);
// taos_close(taos);// TODO: workaround to use separate taos connection;
// taos_close(taos);// TODO: workaround to use separate taos connection;
uint64_t
endTs
=
taosGetTimestampMs
();
uint64_t
totalQueried
=
g_queryInfo
.
specifiedQueryInfo
.
totalQueried
+
...
...
@@ -7817,7 +7825,7 @@ static void *superSubscribe(void *sarg) {
static
void
*
specifiedSubscribe
(
void
*
sarg
)
{
threadInfo
*
pThreadInfo
=
(
threadInfo
*
)
sarg
;
// TAOS_SUB* tsub = NULL;
// TAOS_SUB* tsub = NULL;
setThreadName
(
"specSub"
);
...
...
@@ -8076,7 +8084,7 @@ static int subscribeTestProcess() {
tmfree
((
char
*
)
pidsOfStable
);
tmfree
((
char
*
)
infosOfStable
);
// taos_close(taos);
// taos_close(taos);
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录