Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
624a9191
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看板
未验证
提交
624a9191
编写于
3月 18, 2021
作者:
sangshuduo
提交者:
GitHub
3月 18, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-3357] <fix>: fix child table count if exists. (#5488)
Co-authored-by:
N
Shuduo Sang
<
sdsang@taosdata.com
>
上级
c72ca2e9
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
45 addition
and
36 deletion
+45
-36
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+45
-36
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
624a9191
...
...
@@ -101,8 +101,8 @@ typedef enum CREATE_SUB_TALBE_MOD_EN {
}
CREATE_SUB_TALBE_MOD_EN
;
typedef
enum
TALBE_EXISTS_EN
{
TBL_ALREADY_EXISTS
,
TBL_NO_EXISTS
,
TBL_ALREADY_EXISTS
,
TBL_EXISTS_BUTT
}
TALBE_EXISTS_EN
;
...
...
@@ -2401,9 +2401,12 @@ static int createDatabases() {
&
g_Dbs
.
db
[
i
].
superTbls
[
j
],
g_Dbs
.
use_metric
);
}
else
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
superTblExists
=
TBL_ALREADY_EXISTS
;
if
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblExists
!=
TBL_ALREADY_EXISTS
)
{
ret
=
getSuperTableFromServer
(
taos
,
g_Dbs
.
db
[
i
].
dbName
,
&
g_Dbs
.
db
[
i
].
superTbls
[
j
]);
}
}
if
(
0
!=
ret
)
{
printf
(
"
\n
create super table %d failed!
\n\n
"
,
j
);
...
...
@@ -2794,7 +2797,8 @@ void readSampleFromFileToMem(SSuperTable * supterTblInfo) {
}
}
*/
static
bool
getColumnAndTagTypeFromInsertJsonFile
(
cJSON
*
stbInfo
,
SSuperTable
*
superTbls
)
{
static
bool
getColumnAndTagTypeFromInsertJsonFile
(
cJSON
*
stbInfo
,
SSuperTable
*
superTbls
)
{
bool
ret
=
false
;
// columns
...
...
@@ -2856,7 +2860,8 @@ static bool getColumnAndTagTypeFromInsertJsonFile(cJSON* stbInfo, SSuperTable* s
}
for
(
int
n
=
0
;
n
<
count
;
++
n
)
{
tstrncpy
(
superTbls
->
columns
[
index
].
dataType
,
columnCase
.
dataType
,
MAX_TB_NAME_SIZE
);
tstrncpy
(
superTbls
->
columns
[
index
].
dataType
,
columnCase
.
dataType
,
MAX_TB_NAME_SIZE
);
superTbls
->
columns
[
index
].
dataLen
=
columnCase
.
dataLen
;
index
++
;
}
...
...
@@ -3103,8 +3108,10 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
}
cJSON
*
precision
=
cJSON_GetObjectItem
(
dbinfo
,
"precision"
);
if
(
precision
&&
precision
->
type
==
cJSON_String
&&
precision
->
valuestring
!=
NULL
)
{
tstrncpy
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
precision
->
valuestring
,
MAX_DB_NAME_SIZE
);
if
(
precision
&&
precision
->
type
==
cJSON_String
&&
precision
->
valuestring
!=
NULL
)
{
tstrncpy
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
precision
->
valuestring
,
MAX_DB_NAME_SIZE
);
}
else
if
(
!
precision
)
{
//tstrncpy(g_Dbs.db[i].dbCfg.precision, "ms", MAX_DB_NAME_SIZE);
memset
(
g_Dbs
.
db
[
i
].
dbCfg
.
precision
,
0
,
MAX_DB_NAME_SIZE
);
...
...
@@ -3330,13 +3337,13 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
}
else
if
(
!
childTblExists
)
{
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblExists
=
TBL_NO_EXISTS
;
}
else
{
printf
(
"ERROR: failed to read json, child_table_exists not found
\n
"
);
errorPrint
(
"%s() LN%d, failed to read json, child_table_exists not found
\n
"
,
__func__
,
__LINE__
);
goto
PARSE_OVER
;
}
cJSON
*
count
=
cJSON_GetObjectItem
(
stbInfo
,
"childtable_count"
);
if
(
!
count
||
count
->
type
!=
cJSON_Number
||
0
>=
count
->
valueint
)
{
printf
(
"ERROR: failed to read json, childtable_count not found
\n
"
);
errorPrint
(
"%s() LN%d, failed to read json, childtable_count not found
\n
"
,
__func__
,
__LINE__
);
goto
PARSE_OVER
;
}
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblCount
=
count
->
valueint
;
...
...
@@ -3349,7 +3356,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
}
else
if
(
!
dataSource
)
{
tstrncpy
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
dataSource
,
"rand"
,
MAX_DB_NAME_SIZE
);
}
else
{
printf
(
"ERROR: failed to read json, data_source not found
\n
"
);
errorPrint
(
"%s() LN%d, failed to read json, data_source not found
\n
"
,
__func__
,
__LINE__
);
goto
PARSE_OVER
;
}
...
...
@@ -3546,12 +3553,14 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
goto
PARSE_OVER
;
}
if
(
NO_CREATE_SUBTBL
==
g_Dbs
.
db
[
i
].
superTbls
[
j
].
autoCreateTable
/* CBD
if (NO_CREATE_SUBTBL == g_Dbs.db[i].superTbls[j].autoCreateTable
|| (TBL_ALREADY_EXISTS == g_Dbs.db[i].superTbls[j].childTblExists)) {
continue;
}
*/
int
retVal
=
getColumnAndTagTypeFromInsertJsonFile
(
stbInfo
,
&
g_Dbs
.
db
[
i
].
superTbls
[
j
]);
int
retVal
=
getColumnAndTagTypeFromInsertJsonFile
(
stbInfo
,
&
g_Dbs
.
db
[
i
].
superTbls
[
j
]);
if
(
false
==
retVal
)
{
goto
PARSE_OVER
;
}
...
...
@@ -4500,7 +4509,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
pstr
+=
headLen
;
int
dataLen
=
0
;
debug
Print
(
"[%d] %s() LN%d i=%d batchPerTblTimes=%d batchPerTbl = %d
\n
"
,
verbose
Print
(
"[%d] %s() LN%d i=%d batchPerTblTimes=%d batchPerTbl = %d
\n
"
,
pThreadInfo
->
threadID
,
__func__
,
__LINE__
,
i
,
batchPerTblTimes
,
batchPerTbl
);
generateDataTail
(
...
...
@@ -4512,7 +4521,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
pstr
+=
dataLen
;
recOfBatch
+=
batchPerTbl
;
pThreadInfo
->
totalInsertRows
+=
batchPerTbl
;
debug
Print
(
"[%d] %s() LN%d batchPerTbl=%d recOfBatch=%d
\n
"
,
verbose
Print
(
"[%d] %s() LN%d batchPerTbl=%d recOfBatch=%d
\n
"
,
pThreadInfo
->
threadID
,
__func__
,
__LINE__
,
batchPerTbl
,
recOfBatch
);
...
...
@@ -4535,7 +4544,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
if
((
remainRows
>
0
)
&&
(
batchPerTbl
>
remainRows
))
batchPerTbl
=
remainRows
;
debug
Print
(
"[%d] %s() LN%d generatedRecPerTbl=%d insertRows=%"
PRId64
"
\n
"
,
verbose
Print
(
"[%d] %s() LN%d generatedRecPerTbl=%d insertRows=%"
PRId64
"
\n
"
,
pThreadInfo
->
threadID
,
__func__
,
__LINE__
,
generatedRecPerTbl
,
insertRows
);
...
...
@@ -4543,7 +4552,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
break
;
}
debug
Print
(
"[%d] %s() LN%d recOfBatch=%d totalInsertRows=%"
PRId64
"
\n
"
,
verbose
Print
(
"[%d] %s() LN%d recOfBatch=%d totalInsertRows=%"
PRId64
"
\n
"
,
pThreadInfo
->
threadID
,
__func__
,
__LINE__
,
recOfBatch
,
pThreadInfo
->
totalInsertRows
);
verbosePrint
(
"[%d] %s() LN%d, buffer=%s
\n
"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录