Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
49bbdb23
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
49bbdb23
编写于
1月 24, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into feature/tkv
上级
6632640d
f7392620
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
52 addition
and
43 deletion
+52
-43
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+6
-1
tests/test/c/create_table.c
tests/test/c/create_table.c
+46
-42
未找到文件。
source/client/src/clientImpl.c
浏览文件 @
49bbdb23
...
...
@@ -215,6 +215,8 @@ int32_t getPlan(SRequestObj* pRequest, SQueryNode* pQueryNode, SQueryDag** pDag,
if
(
pQueryNode
->
type
==
TSDB_SQL_SELECT
)
{
setResSchemaInfo
(
&
pRequest
->
body
.
resInfo
,
pSchema
,
numOfCols
);
pRequest
->
type
=
TDMT_VND_QUERY
;
}
else
{
tfree
(
pSchema
);
}
return
code
;
...
...
@@ -237,6 +239,8 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryDag* pDag, SArray* pNodeList)
if
(
TSDB_SQL_INSERT
==
pRequest
->
type
||
TSDB_SQL_CREATE_TABLE
==
pRequest
->
type
)
{
SQueryResult
res
=
{.
code
=
0
,
.
numOfRows
=
0
,
.
msgSize
=
ERROR_MSG_BUF_DEFAULT_SIZE
,
.
msg
=
pRequest
->
msgBuf
};
taosArrayDestroy
(
pNodeList
);
int32_t
code
=
schedulerExecJob
(
pRequest
->
pTscObj
->
pAppInfo
->
pTransporter
,
NULL
,
pDag
,
&
pRequest
->
body
.
pQueryJob
,
&
res
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// handle error and retry
...
...
@@ -641,7 +645,6 @@ TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen) {
SRequestObj
*
pRequest
=
NULL
;
SQueryNode
*
pQueryNode
=
NULL
;
SArray
*
pNodeList
=
taosArrayInit
(
4
,
sizeof
(
struct
SQueryNodeAddr
));
terrno
=
TSDB_CODE_SUCCESS
;
CHECK_CODE_GOTO
(
buildRequest
(
pTscObj
,
sql
,
sqlLen
,
&
pRequest
),
_return
);
...
...
@@ -650,6 +653,8 @@ TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen) {
if
(
qIsDdlQuery
(
pQueryNode
))
{
CHECK_CODE_GOTO
(
execDdlQuery
(
pRequest
,
pQueryNode
),
_return
);
}
else
{
SArray
*
pNodeList
=
taosArrayInit
(
4
,
sizeof
(
struct
SQueryNodeAddr
));
CHECK_CODE_GOTO
(
getPlan
(
pRequest
,
pQueryNode
,
&
pRequest
->
body
.
pDag
,
pNodeList
),
_return
);
CHECK_CODE_GOTO
(
scheduleQuery
(
pRequest
,
pRequest
->
body
.
pDag
,
pNodeList
),
_return
);
pRequest
->
code
=
terrno
;
...
...
tests/test/c/create_table.c
浏览文件 @
49bbdb23
...
...
@@ -31,6 +31,7 @@ int32_t createTable = 1;
int32_t
insertData
=
0
;
int32_t
batchNumOfTbl
=
100
;
int32_t
batchNumOfRow
=
1
;
int32_t
totalRowsOfPerTbl
=
1
;
int32_t
numOfVgroups
=
2
;
int32_t
showTablesFlag
=
0
;
int32_t
queryFlag
=
0
;
...
...
@@ -106,14 +107,14 @@ void printCreateProgress(SThreadInfo *pInfo, int64_t t) {
totalTables
,
seconds
,
speed
);
}
void
printInsertProgress
(
SThreadInfo
*
pInfo
,
int64_t
t
)
{
void
printInsertProgress
(
SThreadInfo
*
pInfo
,
int64_t
insertTotalRows
)
{
int64_t
endMs
=
taosGetTimestampMs
();
int64_t
totalTables
=
t
-
pInfo
->
tableBeginIndex
;
//
int64_t totalTables = t - pInfo->tableBeginIndex;
float
seconds
=
(
endMs
-
pInfo
->
startMs
)
/
1000
.
0
;
float
speed
=
totalTable
s
/
seconds
;
float
speed
=
insertTotalRow
s
/
seconds
;
pInfo
->
insertDataSpeed
=
speed
;
pPrint
(
"thread:%d, %"
PRId64
" rows inserted, time:%.2f sec, speed:%.1f rows/second, "
,
pInfo
->
threadIndex
,
totalTable
s
,
seconds
,
speed
);
insertTotalRow
s
,
seconds
,
speed
);
}
static
int64_t
getResult
(
TAOS_RES
*
tres
)
{
...
...
@@ -181,14 +182,13 @@ void *threadFunc(void *param) {
exit
(
1
);
}
pPrint
(
"====before thread:%d, table range: %"
PRId64
" - %"
PRId64
"
\n
"
,
pInfo
->
threadIndex
,
pInfo
->
tableBeginIndex
,
pInfo
->
tableEndIndex
);
//
pPrint("====before thread:%d, table range: %" PRId64 " - %" PRId64 "\n", pInfo->threadIndex, pInfo->tableBeginIndex,
//
pInfo->tableEndIndex);
pInfo
->
tableBeginIndex
+=
startOffset
;
pInfo
->
tableEndIndex
+=
startOffset
;
pPrint
(
"====after thread:%d, table range: %"
PRId64
" - %"
PRId64
"
\n
"
,
pInfo
->
threadIndex
,
pInfo
->
tableBeginIndex
,
pInfo
->
tableEndIndex
);
pPrint
(
"====thread:%d, table range: %"
PRId64
" - %"
PRId64
"
\n
"
,
pInfo
->
threadIndex
,
pInfo
->
tableBeginIndex
,
pInfo
->
tableEndIndex
);
sprintf
(
qstr
,
"use %s"
,
pInfo
->
dbName
);
TAOS_RES
*
pRes
=
taos_query
(
con
,
qstr
);
...
...
@@ -237,51 +237,50 @@ void *threadFunc(void *param) {
}
if
(
insertData
)
{
int64_t
insertTotalRows
=
0
;
int64_t
curMs
=
0
;
int64_t
beginMs
=
taosGetTimestampMs
();
pInfo
->
startMs
=
beginMs
;
int64_t
t
=
pInfo
->
tableBeginIndex
;
for
(;
t
<=
pInfo
->
tableEndIndex
;)
{
// int64_t batch = (pInfo->tableEndIndex - t);
// batch = MIN(batch, batchNum);
int32_t
len
=
sprintf
(
qstr
,
"insert into "
);
for
(
int32_t
i
=
0
;
i
<
batchNumOfTbl
;)
{
int64_t
ts
=
startTimestamp
;
for
(;
t
<=
pInfo
->
tableEndIndex
;
t
++
)
{
//printf("table name: %"PRId64"\n", t);
int64_t
ts
=
startTimestamp
;
for
(
int32_t
i
=
0
;
i
<
totalRowsOfPerTbl
;)
{
int32_t
len
=
sprintf
(
qstr
,
"insert into "
);
len
+=
sprintf
(
qstr
+
len
,
"%s_t%"
PRId64
" values "
,
stbName
,
t
);
for
(
int32_t
j
=
0
;
j
<
batchNumOfRow
;
j
++
)
{
len
+=
sprintf
(
qstr
+
len
,
"(%"
PRId64
", 6666) "
,
ts
++
);
i
++
;
insertTotalRows
++
;
if
(
i
>=
totalRowsOfPerTbl
)
{
break
;
}
}
t
++
;
i
++
;
if
(
t
>
pInfo
->
tableEndIndex
)
{
break
;
#if 1
int64_t
startTs
=
taosGetTimestampUs
();
TAOS_RES
*
pRes
=
taos_query
(
con
,
qstr
);
code
=
taos_errno
(
pRes
);
if
((
code
!=
0
)
&&
(
code
!=
TSDB_CODE_RPC_AUTH_REQUIRED
))
{
pError
(
"failed to insert %s_t%"
PRId64
", reason:%s"
,
stbName
,
t
,
tstrerror
(
code
));
}
taos_free_result
(
pRes
);
int64_t
endTs
=
taosGetTimestampUs
();
int64_t
delay
=
endTs
-
startTs
;
// printf("==== %"PRId64" - %"PRId64", %"PRId64"\n", startTs, endTs, delay);
if
(
delay
>
pInfo
->
maxDelay
)
pInfo
->
maxDelay
=
delay
;
if
(
delay
<
pInfo
->
minDelay
)
pInfo
->
minDelay
=
delay
;
curMs
=
taosGetTimestampMs
();
if
(
curMs
-
beginMs
>
10000
)
{
beginMs
=
curMs
;
// printf("==== tableBeginIndex: %"PRId64", t: %"PRId64"\n", pInfo->tableBeginIndex, t);
printInsertProgress
(
pInfo
,
insertTotalRows
);
}
#endif
}
int64_t
startTs
=
taosGetTimestampUs
();
TAOS_RES
*
pRes
=
taos_query
(
con
,
qstr
);
code
=
taos_errno
(
pRes
);
if
((
code
!=
0
)
&&
(
code
!=
TSDB_CODE_RPC_AUTH_REQUIRED
))
{
pError
(
"failed to insert %s_t%"
PRId64
", reason:%s"
,
stbName
,
t
,
tstrerror
(
code
));
}
taos_free_result
(
pRes
);
int64_t
endTs
=
taosGetTimestampUs
();
int64_t
delay
=
endTs
-
startTs
;
// printf("==== %"PRId64" - %"PRId64", %"PRId64"\n", startTs, endTs, delay);
if
(
delay
>
pInfo
->
maxDelay
)
pInfo
->
maxDelay
=
delay
;
if
(
delay
<
pInfo
->
minDelay
)
pInfo
->
minDelay
=
delay
;
curMs
=
taosGetTimestampMs
();
if
(
curMs
-
beginMs
>
10000
)
{
beginMs
=
curMs
;
// printf("==== tableBeginIndex: %"PRId64", t: %"PRId64"\n", pInfo->tableBeginIndex, t);
printInsertProgress
(
pInfo
,
t
);
}
}
printInsertProgress
(
pInfo
,
t
);
}
printInsertProgress
(
pInfo
,
insertTotalRows
);
}
taos_close
(
con
);
...
...
@@ -319,6 +318,8 @@ void printHelp() {
printf
(
"%s%s%s%d
\n
"
,
indent
,
indent
,
"queryFlag, default is "
,
queryFlag
);
printf
(
"%s%s
\n
"
,
indent
,
"-l"
);
printf
(
"%s%s%s%d
\n
"
,
indent
,
indent
,
"batchNumOfRow, default is "
,
batchNumOfRow
);
printf
(
"%s%s
\n
"
,
indent
,
"-r"
);
printf
(
"%s%s%s%d
\n
"
,
indent
,
indent
,
"totalRowsOfPerTbl, default is "
,
totalRowsOfPerTbl
);
exit
(
EXIT_SUCCESS
);
}
...
...
@@ -350,6 +351,8 @@ void parseArgument(int32_t argc, char *argv[]) {
batchNumOfTbl
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-l"
)
==
0
)
{
batchNumOfRow
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-r"
)
==
0
)
{
totalRowsOfPerTbl
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-w"
)
==
0
)
{
showTablesFlag
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-q"
)
==
0
)
{
...
...
@@ -370,6 +373,7 @@ void parseArgument(int32_t argc, char *argv[]) {
pPrint
(
"%s insertData:%d %s"
,
GREEN
,
insertData
,
NC
);
pPrint
(
"%s batchNumOfTbl:%d %s"
,
GREEN
,
batchNumOfTbl
,
NC
);
pPrint
(
"%s batchNumOfRow:%d %s"
,
GREEN
,
batchNumOfRow
,
NC
);
pPrint
(
"%s totalRowsOfPerTbl:%d %s"
,
GREEN
,
totalRowsOfPerTbl
,
NC
);
pPrint
(
"%s showTablesFlag:%d %s"
,
GREEN
,
showTablesFlag
,
NC
);
pPrint
(
"%s queryFlag:%d %s"
,
GREEN
,
queryFlag
,
NC
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录