Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
34efc629
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看板
未验证
提交
34efc629
编写于
11月 24, 2021
作者:
Y
Yang Zhao
提交者:
GitHub
11月 24, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-11257]<fix>taosdemo cmdLine -N (#8785)
* [TD-11257]<fix>taosdemo cmdline -N * change init data length
上级
d393cdf7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
72 addition
and
23 deletion
+72
-23
src/kit/taosdemo/inc/demo.h
src/kit/taosdemo/inc/demo.h
+3
-0
src/kit/taosdemo/src/demoCommandOpt.c
src/kit/taosdemo/src/demoCommandOpt.c
+56
-7
src/kit/taosdemo/src/demoData.c
src/kit/taosdemo/src/demoData.c
+10
-12
src/kit/taosdemo/src/demoInsert.c
src/kit/taosdemo/src/demoInsert.c
+2
-4
src/kit/taosdemo/src/demoMain.c
src/kit/taosdemo/src/demoMain.c
+1
-0
未找到文件。
src/kit/taosdemo/inc/demo.h
浏览文件 @
34efc629
...
...
@@ -141,6 +141,8 @@ extern char configDir[];
{ TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_FLOAT }
#define DEFAULT_DATATYPE \
{ "FLOAT", "INT", "FLOAT" }
#define DEFAULT_DATALENGTH \
{ 4, 4, 4 }
#define DEFAULT_BINWIDTH 64
#define DEFAULT_COL_COUNT 4
#define DEFAULT_LEN_ONE_ROW 76
...
...
@@ -306,6 +308,7 @@ typedef struct SArguments_S {
bool
async_mode
;
char
data_type
[
MAX_NUM_COLUMNS
+
1
];
char
*
dataType
[
MAX_NUM_COLUMNS
+
1
];
int32_t
data_length
[
MAX_NUM_COLUMNS
+
1
];
uint32_t
binwidth
;
uint32_t
columnCount
;
uint64_t
lenOfOneRow
;
...
...
src/kit/taosdemo/src/demoCommandOpt.c
浏览文件 @
34efc629
...
...
@@ -1338,9 +1338,10 @@ void setParaFromArg() {
g_args
.
prepared_rand
=
min
(
g_args
.
insertRows
,
MAX_PREPARED_RAND
);
g_Dbs
.
aggr_func
=
g_args
.
aggr_func
;
char
dataString
[
TSDB_MAX_BYTES_PER_ROW
];
char
*
data_type
=
g_args
.
data_type
;
char
**
dataType
=
g_args
.
dataType
;
char
dataString
[
TSDB_MAX_BYTES_PER_ROW
];
char
*
data_type
=
g_args
.
data_type
;
char
**
dataType
=
g_args
.
dataType
;
int32_t
*
data_length
=
g_args
.
data_length
;
memset
(
dataString
,
0
,
TSDB_MAX_BYTES_PER_ROW
);
...
...
@@ -1469,6 +1470,47 @@ void setParaFromArg() {
}
else
{
g_Dbs
.
threadCountForCreateTbl
=
g_args
.
nthreads
;
g_Dbs
.
db
[
0
].
superTbls
[
0
].
tagCount
=
0
;
for
(
int
i
=
0
;
i
<
MAX_NUM_COLUMNS
;
i
++
)
{
if
(
data_type
[
i
]
==
TSDB_DATA_TYPE_NULL
)
{
break
;
}
if
(
1
==
regexMatch
(
dataType
[
i
],
"^(NCHAR|BINARY)(
\\
([1-9][0-9]*
\\
))$"
,
REG_ICASE
|
REG_EXTENDED
))
{
sscanf
(
dataType
[
i
],
"%[^(](%[^)]"
,
type
,
length
);
data_length
[
i
]
=
atoi
(
length
);
}
else
{
switch
(
data_type
[
i
])
{
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_UTINYINT
:
case
TSDB_DATA_TYPE_TINYINT
:
data_length
[
i
]
=
sizeof
(
char
);
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
data_length
[
i
]
=
sizeof
(
int16_t
);
break
;
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_UINT
:
data_length
[
i
]
=
sizeof
(
int32_t
);
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
data_length
[
i
]
=
sizeof
(
int64_t
);
break
;
case
TSDB_DATA_TYPE_FLOAT
:
data_length
[
i
]
=
sizeof
(
float
);
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
data_length
[
i
]
=
sizeof
(
double
);
break
;
default:
data_length
[
i
]
=
g_args
.
binwidth
;
break
;
}
}
}
}
}
...
...
@@ -1698,8 +1740,15 @@ void *queryNtableAggrFunc(void *sarg) {
double
totalT
=
0
;
uint64_t
count
=
0
;
for
(
int64_t
i
=
0
;
i
<
ntables
;
i
++
)
{
sprintf
(
command
,
"SELECT %s FROM %s%"
PRId64
" WHERE ts>= %"
PRIu64
,
aggreFunc
[
j
],
tb_prefix
,
i
,
startTime
);
if
(
g_args
.
escapeChar
)
{
sprintf
(
command
,
"SELECT %s FROM `%s%"
PRId64
"` WHERE ts>= %"
PRIu64
,
aggreFunc
[
j
],
tb_prefix
,
i
,
startTime
);
}
else
{
sprintf
(
command
,
"SELECT %s FROM %s%"
PRId64
" WHERE ts>= %"
PRIu64
,
aggreFunc
[
j
],
tb_prefix
,
i
,
startTime
);
}
double
t
=
(
double
)
taosGetTimestampUs
();
debugPrint
(
"%s() LN%d, sql command: %s
\n
"
,
__func__
,
__LINE__
,
...
...
@@ -1708,9 +1757,9 @@ void *queryNtableAggrFunc(void *sarg) {
int32_t
code
=
taos_errno
(
pSql
);
if
(
code
!=
0
)
{
errorPrint
(
"Failed to query:%s
\n
"
,
taos_errstr
(
pSql
));
errorPrint
(
"Failed to query <%s>, reason:%s
\n
"
,
command
,
taos_errstr
(
pSql
));
taos_free_result
(
pSql
);
taos_close
(
taos
);
fclose
(
fp
);
free
(
command
);
return
NULL
;
...
...
src/kit/taosdemo/src/demoData.c
浏览文件 @
34efc629
...
...
@@ -868,8 +868,8 @@ int64_t generateStbRowData(SSuperTable *stbInfo, char *recBuf,
return
strlen
(
recBuf
);
}
static
int64_t
generateData
(
char
*
recBuf
,
char
*
data_type
,
int
64_t
timestamp
,
int
lenOfBinary
)
{
static
int64_t
generateData
(
char
*
recBuf
,
char
*
data_type
,
int
32_t
*
data_length
,
int
64_t
timestamp
)
{
memset
(
recBuf
,
0
,
MAX_DATA_SIZE
);
char
*
pstr
=
recBuf
;
pstr
+=
sprintf
(
pstr
,
"(%"
PRId64
""
,
timestamp
);
...
...
@@ -915,13 +915,13 @@ static int64_t generateData(char *recBuf, char *data_type, int64_t timestamp,
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
s
=
calloc
(
1
,
lenOfBinary
+
1
);
s
=
calloc
(
1
,
data_length
[
i
]
+
1
);
if
(
NULL
==
s
)
{
errorPrint
(
"%s"
,
"failed to allocate memory
\n
"
);
return
-
1
;
}
rand_string
(
s
,
lenOfBinary
);
rand_string
(
s
,
data_length
[
i
]
);
pstr
+=
sprintf
(
pstr
,
",
\"
%s
\"
"
,
s
);
free
(
s
);
break
;
...
...
@@ -1156,20 +1156,18 @@ static int32_t generateDataTailWithoutStb(
int64_t
retLen
=
0
;
char
*
data_type
=
g_args
.
data_type
;
int
lenOfBinary
=
g_args
.
binwid
th
;
char
*
data_type
=
g_args
.
data_type
;
int
32_t
*
data_length
=
g_args
.
data_leng
th
;
if
(
g_args
.
disorderRatio
)
{
retLen
=
generateData
(
data
,
data_type
,
generateData
(
data
,
data_type
,
data_length
,
startTime
+
getTSRandTail
(
g_args
.
timestamp_step
,
k
,
g_args
.
disorderRatio
,
g_args
.
disorderRange
),
lenOfBinary
);
g_args
.
disorderRange
));
}
else
{
retLen
=
generateData
(
data
,
data_type
,
startTime
+
g_args
.
timestamp_step
*
k
,
lenOfBinary
);
retLen
=
generateData
(
data
,
data_type
,
data_length
,
startTime
+
g_args
.
timestamp_step
*
k
);
}
if
(
len
>
remainderBufLen
)
break
;
...
...
src/kit/taosdemo/src/demoInsert.c
浏览文件 @
34efc629
...
...
@@ -1043,10 +1043,8 @@ int createChildTables() {
// normal table
len
=
snprintf
(
tblColsBuf
,
TSDB_MAX_BYTES_PER_ROW
,
"(TS TIMESTAMP"
);
for
(
int
j
=
0
;
j
<
g_args
.
columnCount
;
j
++
)
{
if
((
strncasecmp
(
g_args
.
dataType
[
j
],
"BINARY"
,
strlen
(
"BINARY"
))
==
0
)
||
(
strncasecmp
(
g_args
.
dataType
[
j
],
"NCHAR"
,
strlen
(
"NCHAR"
))
==
0
))
{
if
((
strcasecmp
(
g_args
.
dataType
[
j
],
"BINARY"
)
==
0
)
||
(
strcasecmp
(
g_args
.
dataType
[
j
],
"NCHAR"
)
==
0
))
{
snprintf
(
tblColsBuf
+
len
,
TSDB_MAX_BYTES_PER_ROW
-
len
,
",C%d %s(%d)"
,
j
,
g_args
.
dataType
[
j
],
g_args
.
binwidth
);
...
...
src/kit/taosdemo/src/demoMain.c
浏览文件 @
34efc629
...
...
@@ -45,6 +45,7 @@ SArguments g_args = {
DEFAULT_SYNC_MODE
,
// mode : sync or async
DEFAULT_DATA_TYPE
,
// data_type
DEFAULT_DATATYPE
,
// dataType
DEFAULT_DATALENGTH
,
// data_length
DEFAULT_BINWIDTH
,
// binwidth
DEFAULT_COL_COUNT
,
// columnCount, timestamp + float + int + float
DEFAULT_LEN_ONE_ROW
,
// lenOfOneRow
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录