Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d127421d
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看板
未验证
提交
d127421d
编写于
8月 30, 2021
作者:
sangshuduo
提交者:
GitHub
8月 30, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-5852]<fix>: taosdemo data generation race. (#7708)
上级
ac5f6b26
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
18 addition
and
12 deletion
+18
-12
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+18
-12
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
d127421d
...
@@ -1332,7 +1332,7 @@ static char *rand_bool_str(){
...
@@ -1332,7 +1332,7 @@ static char *rand_bool_str(){
static
int
cursor
;
static
int
cursor
;
cursor
++
;
cursor
++
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
return
g_randbool_buff
+
(
cursor
*
BOOL_BUFF_LEN
);
return
g_randbool_buff
+
(
(
cursor
%
MAX_PREPARED_RAND
)
*
BOOL_BUFF_LEN
);
}
}
static
int32_t
rand_bool
(){
static
int32_t
rand_bool
(){
...
@@ -1347,7 +1347,8 @@ static char *rand_tinyint_str()
...
@@ -1347,7 +1347,8 @@ static char *rand_tinyint_str()
static
int
cursor
;
static
int
cursor
;
cursor
++
;
cursor
++
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
return
g_randtinyint_buff
+
(
cursor
*
TINYINT_BUFF_LEN
);
return
g_randtinyint_buff
+
((
cursor
%
MAX_PREPARED_RAND
)
*
TINYINT_BUFF_LEN
);
}
}
static
int32_t
rand_tinyint
()
static
int32_t
rand_tinyint
()
...
@@ -1363,7 +1364,8 @@ static char *rand_smallint_str()
...
@@ -1363,7 +1364,8 @@ static char *rand_smallint_str()
static
int
cursor
;
static
int
cursor
;
cursor
++
;
cursor
++
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
return
g_randsmallint_buff
+
(
cursor
*
SMALLINT_BUFF_LEN
);
return
g_randsmallint_buff
+
((
cursor
%
MAX_PREPARED_RAND
)
*
SMALLINT_BUFF_LEN
);
}
}
static
int32_t
rand_smallint
()
static
int32_t
rand_smallint
()
...
@@ -1379,7 +1381,7 @@ static char *rand_int_str()
...
@@ -1379,7 +1381,7 @@ static char *rand_int_str()
static
int
cursor
;
static
int
cursor
;
cursor
++
;
cursor
++
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
return
g_randint_buff
+
(
cursor
*
INT_BUFF_LEN
);
return
g_randint_buff
+
(
(
cursor
%
MAX_PREPARED_RAND
)
*
INT_BUFF_LEN
);
}
}
static
int32_t
rand_int
()
static
int32_t
rand_int
()
...
@@ -1395,7 +1397,8 @@ static char *rand_bigint_str()
...
@@ -1395,7 +1397,8 @@ static char *rand_bigint_str()
static
int
cursor
;
static
int
cursor
;
cursor
++
;
cursor
++
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
return
g_randbigint_buff
+
(
cursor
*
BIGINT_BUFF_LEN
);
return
g_randbigint_buff
+
((
cursor
%
MAX_PREPARED_RAND
)
*
BIGINT_BUFF_LEN
);
}
}
static
int64_t
rand_bigint
()
static
int64_t
rand_bigint
()
...
@@ -1411,7 +1414,7 @@ static char *rand_float_str()
...
@@ -1411,7 +1414,7 @@ static char *rand_float_str()
static
int
cursor
;
static
int
cursor
;
cursor
++
;
cursor
++
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
return
g_randfloat_buff
+
(
cursor
*
FLOAT_BUFF_LEN
);
return
g_randfloat_buff
+
(
(
cursor
%
MAX_PREPARED_RAND
)
*
FLOAT_BUFF_LEN
);
}
}
static
float
rand_float
()
static
float
rand_float
()
...
@@ -1427,7 +1430,8 @@ static char *demo_current_float_str()
...
@@ -1427,7 +1430,8 @@ static char *demo_current_float_str()
static
int
cursor
;
static
int
cursor
;
cursor
++
;
cursor
++
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
return
g_rand_current_buff
+
(
cursor
*
FLOAT_BUFF_LEN
);
return
g_rand_current_buff
+
((
cursor
%
MAX_PREPARED_RAND
)
*
FLOAT_BUFF_LEN
);
}
}
static
float
UNUSED_FUNC
demo_current_float
()
static
float
UNUSED_FUNC
demo_current_float
()
...
@@ -1443,7 +1447,8 @@ static char *demo_voltage_int_str()
...
@@ -1443,7 +1447,8 @@ static char *demo_voltage_int_str()
static
int
cursor
;
static
int
cursor
;
cursor
++
;
cursor
++
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
return
g_rand_voltage_buff
+
(
cursor
*
INT_BUFF_LEN
);
return
g_rand_voltage_buff
+
((
cursor
%
MAX_PREPARED_RAND
)
*
INT_BUFF_LEN
);
}
}
static
int32_t
UNUSED_FUNC
demo_voltage_int
()
static
int32_t
UNUSED_FUNC
demo_voltage_int
()
...
@@ -1458,7 +1463,7 @@ static char *demo_phase_float_str() {
...
@@ -1458,7 +1463,7 @@ static char *demo_phase_float_str() {
static
int
cursor
;
static
int
cursor
;
cursor
++
;
cursor
++
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
if
(
cursor
>
(
MAX_PREPARED_RAND
-
1
))
cursor
=
0
;
return
g_rand_phase_buff
+
(
cursor
*
FLOAT_BUFF_LEN
);
return
g_rand_phase_buff
+
(
(
cursor
%
MAX_PREPARED_RAND
)
*
FLOAT_BUFF_LEN
);
}
}
static
float
UNUSED_FUNC
demo_phase_float
(){
static
float
UNUSED_FUNC
demo_phase_float
(){
...
@@ -5169,7 +5174,8 @@ static int64_t generateStbRowData(
...
@@ -5169,7 +5174,8 @@ static int64_t generateStbRowData(
"SMALLINT"
,
8
))
{
"SMALLINT"
,
8
))
{
tmp
=
rand_smallint_str
();
tmp
=
rand_smallint_str
();
tmpLen
=
strlen
(
tmp
);
tmpLen
=
strlen
(
tmp
);
tstrncpy
(
pstr
+
dataLen
,
tmp
,
min
(
tmpLen
+
1
,
SMALLINT_BUFF_LEN
));
tstrncpy
(
pstr
+
dataLen
,
tmp
,
min
(
tmpLen
+
1
,
SMALLINT_BUFF_LEN
));
}
else
if
(
0
==
strncasecmp
(
stbInfo
->
columns
[
i
].
dataType
,
}
else
if
(
0
==
strncasecmp
(
stbInfo
->
columns
[
i
].
dataType
,
"TINYINT"
,
7
))
{
"TINYINT"
,
7
))
{
tmp
=
rand_tinyint_str
();
tmp
=
rand_tinyint_str
();
...
@@ -5182,9 +5188,9 @@ static int64_t generateStbRowData(
...
@@ -5182,9 +5188,9 @@ static int64_t generateStbRowData(
tstrncpy
(
pstr
+
dataLen
,
tmp
,
min
(
tmpLen
+
1
,
BOOL_BUFF_LEN
));
tstrncpy
(
pstr
+
dataLen
,
tmp
,
min
(
tmpLen
+
1
,
BOOL_BUFF_LEN
));
}
else
if
(
0
==
strncasecmp
(
stbInfo
->
columns
[
i
].
dataType
,
}
else
if
(
0
==
strncasecmp
(
stbInfo
->
columns
[
i
].
dataType
,
"TIMESTAMP"
,
9
))
{
"TIMESTAMP"
,
9
))
{
tmp
=
rand_int_str
();
tmp
=
rand_
big
int_str
();
tmpLen
=
strlen
(
tmp
);
tmpLen
=
strlen
(
tmp
);
tstrncpy
(
pstr
+
dataLen
,
tmp
,
min
(
tmpLen
+
1
,
INT_BUFF_LEN
));
tstrncpy
(
pstr
+
dataLen
,
tmp
,
min
(
tmpLen
+
1
,
BIG
INT_BUFF_LEN
));
}
else
{
}
else
{
errorPrint
(
"Not support data type: %s
\n
"
,
stbInfo
->
columns
[
i
].
dataType
);
errorPrint
(
"Not support data type: %s
\n
"
,
stbInfo
->
columns
[
i
].
dataType
);
return
-
1
;
return
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录