Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
908a9dee
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看板
提交
908a9dee
编写于
7月 16, 2021
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix error that pointer to array is invalid after array reallocation
上级
df201ac9
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
11 addition
and
8 deletion
+11
-8
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+11
-8
未找到文件。
src/client/src/tscParseLineProtocol.c
浏览文件 @
908a9dee
...
...
@@ -236,11 +236,12 @@ static int32_t buildDataPointSchemas(TAOS_SML_DATA_POINT* points, int numPoint,
return
0
;
}
static
int32_t
generateSchemaAction
(
SSchema
*
pointColField
,
SHashObj
*
dbAttrHash
,
bool
isTag
,
char
sTableName
[],
static
int32_t
generateSchemaAction
(
SSchema
*
pointColField
,
SHashObj
*
dbAttrHash
,
SArray
*
dbAttrArray
,
bool
isTag
,
char
sTableName
[],
SSchemaAction
*
action
,
bool
*
actionNeeded
)
{
SSchema
**
ppDbAttr
=
taosHashGet
(
dbAttrHash
,
pointColField
->
name
,
strlen
(
pointColField
->
name
));
if
(
ppDbAttr
)
{
SSchema
*
dbAttr
=
*
ppDbAttr
;
size_t
*
pDbIndex
=
taosHashGet
(
dbAttrHash
,
pointColField
->
name
,
strlen
(
pointColField
->
name
));
if
(
pDbIndex
)
{
SSchema
*
dbAttr
=
taosArrayGet
(
dbAttrArray
,
*
pDbIndex
);
assert
(
strcasecmp
(
dbAttr
->
name
,
pointColField
->
name
)
==
0
);
if
(
pointColField
->
type
!=
dbAttr
->
type
)
{
tscError
(
"point type and db type mismatch. key: %s. point type: %d, db type: %d"
,
pointColField
->
name
,
pointColField
->
type
,
dbAttr
->
type
);
...
...
@@ -453,7 +454,8 @@ int32_t loadTableMeta(TAOS* taos, char* tableName, SSmlSTableSchema* schema) {
field
.
type
=
tableMeta
->
schema
[
i
].
type
;
field
.
bytes
=
tableMeta
->
schema
[
i
].
bytes
;
SSchema
*
pField
=
taosArrayPush
(
schema
->
fields
,
&
field
);
taosHashPut
(
schema
->
fieldHash
,
field
.
name
,
strlen
(
field
.
name
),
&
pField
,
POINTER_BYTES
);
size_t
fieldIndex
=
taosArrayGetSize
(
schema
->
fields
)
-
1
;
taosHashPut
(
schema
->
fieldHash
,
field
.
name
,
strlen
(
field
.
name
),
&
fieldIndex
,
sizeof
(
fieldIndex
));
}
for
(
int
i
=
0
;
i
<
tableMeta
->
tableInfo
.
numOfTags
;
++
i
)
{
...
...
@@ -463,7 +465,8 @@ int32_t loadTableMeta(TAOS* taos, char* tableName, SSmlSTableSchema* schema) {
field
.
type
=
tableMeta
->
schema
[
j
].
type
;
field
.
bytes
=
tableMeta
->
schema
[
j
].
bytes
;
SSchema
*
pField
=
taosArrayPush
(
schema
->
tags
,
&
field
);
taosHashPut
(
schema
->
tagHash
,
field
.
name
,
strlen
(
field
.
name
),
&
pField
,
POINTER_BYTES
);
size_t
tagIndex
=
taosArrayGetSize
(
schema
->
tags
)
-
1
;
taosHashPut
(
schema
->
tagHash
,
field
.
name
,
strlen
(
field
.
name
),
&
tagIndex
,
sizeof
(
tagIndex
));
}
tscDebug
(
"load table meta succeed. %s, columns number: %d, tag number: %d, precision: %d"
,
tableName
,
tableMeta
->
tableInfo
.
numOfColumns
,
tableMeta
->
tableInfo
.
numOfTags
,
schema
->
precision
);
...
...
@@ -506,7 +509,7 @@ static int32_t reconcileDBSchemas(TAOS* taos, SArray* stableSchemas) {
SSchema
*
pointTag
=
taosArrayGet
(
pointSchema
->
tags
,
j
);
SSchemaAction
schemaAction
=
{
0
};
bool
actionNeeded
=
false
;
generateSchemaAction
(
pointTag
,
dbTagHash
,
true
,
pointSchema
->
sTableName
,
&
schemaAction
,
&
actionNeeded
);
generateSchemaAction
(
pointTag
,
dbTagHash
,
dbSchema
.
tags
,
true
,
pointSchema
->
sTableName
,
&
schemaAction
,
&
actionNeeded
);
if
(
actionNeeded
)
{
applySchemaAction
(
taos
,
&
schemaAction
);
}
...
...
@@ -520,7 +523,7 @@ static int32_t reconcileDBSchemas(TAOS* taos, SArray* stableSchemas) {
SSchema
*
pointCol
=
taosArrayGet
(
pointSchema
->
fields
,
j
);
SSchemaAction
schemaAction
=
{
0
};
bool
actionNeeded
=
false
;
generateSchemaAction
(
pointCol
,
dbFieldHash
,
false
,
pointSchema
->
sTableName
,
&
schemaAction
,
&
actionNeeded
);
generateSchemaAction
(
pointCol
,
dbFieldHash
,
dbSchema
.
fields
,
false
,
pointSchema
->
sTableName
,
&
schemaAction
,
&
actionNeeded
);
if
(
actionNeeded
)
{
applySchemaAction
(
taos
,
&
schemaAction
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录