Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b23c4cd1
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
b23c4cd1
编写于
3月 15, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-10] fix error while parse schema
上级
d7e96770
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
24 deletion
+12
-24
src/mnode/src/mgmtNormalTable.c
src/mnode/src/mgmtNormalTable.c
+10
-11
src/mnode/src/mgmtSuperTable.c
src/mnode/src/mgmtSuperTable.c
+2
-2
src/mnode/src/mgmtTable.c
src/mnode/src/mgmtTable.c
+0
-11
未找到文件。
src/mnode/src/mgmtNormalTable.c
浏览文件 @
b23c4cd1
...
...
@@ -344,10 +344,10 @@ int32_t mgmtCreateNormalTable(SCMCreateTableMsg *pCreate, int32_t contLen, SVgOb
pTable
->
sid
=
sid
;
pTable
->
createdTime
=
taosGetTimestampMs
();
pTable
->
sversion
=
0
;
pTable
->
numOfColumns
=
pCreate
->
numOfColumns
;
pTable
->
sqlLen
=
pTable
->
sqlLen
;
pTable
->
numOfColumns
=
htons
(
pCreate
->
numOfColumns
)
;
pTable
->
sqlLen
=
htons
(
pCreate
->
sqlLen
)
;
int32_t
numOfCols
=
p
Creat
e
->
numOfColumns
;
int32_t
numOfCols
=
p
Tabl
e
->
numOfColumns
;
int32_t
schemaSize
=
numOfCols
*
sizeof
(
SSchema
);
pTable
->
schema
=
(
SSchema
*
)
calloc
(
1
,
schemaSize
);
if
(
pTable
->
schema
==
NULL
)
{
...
...
@@ -357,13 +357,12 @@ int32_t mgmtCreateNormalTable(SCMCreateTableMsg *pCreate, int32_t contLen, SVgOb
memcpy
(
pTable
->
schema
,
pCreate
->
schema
,
numOfCols
*
sizeof
(
SSchema
));
pTable
->
nextColId
=
0
;
for
(
int32_t
col
=
0
;
col
<
pCreate
->
numOfColumn
s
;
col
++
)
{
for
(
int32_t
col
=
0
;
col
<
numOfCol
s
;
col
++
)
{
SSchema
*
tschema
=
pTable
->
schema
;
tschema
[
col
].
colId
=
pTable
->
nextColId
++
;
tschema
[
col
].
bytes
=
pTable
->
schema
[
col
].
bytes
;
tschema
[
col
].
bytes
=
htons
(
tschema
[
col
].
bytes
)
;
}
pTable
->
sqlLen
=
pCreate
->
sqlLen
;
if
(
pTable
->
sqlLen
!=
0
)
{
pTable
->
type
=
TSDB_STREAM_TABLE
;
pTable
->
sql
=
calloc
(
1
,
pTable
->
sqlLen
);
...
...
@@ -371,20 +370,20 @@ int32_t mgmtCreateNormalTable(SCMCreateTableMsg *pCreate, int32_t contLen, SVgOb
free
(
pTable
);
return
TSDB_CODE_SERV_OUT_OF_MEMORY
;
}
memcpy
(
pTable
->
sql
,
(
char
*
)
(
pCreate
->
schema
)
+
numOfCols
*
sizeof
(
SSchema
),
p
Creat
e
->
sqlLen
);
pTable
->
sql
[
p
Creat
e
->
sqlLen
-
1
]
=
0
;
mTrace
(
"table:%s, stream sql len:%d sql:%s"
,
p
Create
->
tableId
,
pCreat
e
->
sqlLen
,
pTable
->
sql
);
memcpy
(
pTable
->
sql
,
(
char
*
)
(
pCreate
->
schema
)
+
numOfCols
*
sizeof
(
SSchema
),
p
Tabl
e
->
sqlLen
);
pTable
->
sql
[
p
Tabl
e
->
sqlLen
-
1
]
=
0
;
mTrace
(
"table:%s, stream sql len:%d sql:%s"
,
p
Table
->
tableId
,
pTabl
e
->
sqlLen
,
pTable
->
sql
);
}
if
(
sdbInsertRow
(
tsNormalTableSdb
,
pTable
,
0
)
<
0
)
{
mError
(
"table:%s, update sdb error"
,
p
Creat
e
->
tableId
);
mError
(
"table:%s, update sdb error"
,
p
Tabl
e
->
tableId
);
free
(
pTable
);
return
TSDB_CODE_SDB_ERROR
;
}
*
pDCreateOut
=
mgmtBuildCreateNormalTableMsg
(
pTable
,
pVgroup
);
if
(
*
pDCreateOut
==
NULL
)
{
mError
(
"table:%s, failed to build create table message"
,
p
Creat
e
->
tableId
);
mError
(
"table:%s, failed to build create table message"
,
p
Tabl
e
->
tableId
);
sdbDeleteRow
(
tsNormalTableSdb
,
pTable
);
return
TSDB_CODE_SERV_OUT_OF_MEMORY
;
}
...
...
src/mnode/src/mgmtSuperTable.c
浏览文件 @
b23c4cd1
...
...
@@ -242,11 +242,11 @@ int32_t mgmtCreateSuperTable(SDbObj *pDb, SCMCreateTableMsg *pCreate) {
}
if
(
sdbInsertRow
(
tsSuperTableSdb
,
pStable
,
0
)
<
0
)
{
mError
(
"stable:%s, update sdb error"
,
p
Creat
e
->
tableId
);
mError
(
"stable:%s, update sdb error"
,
p
Stabl
e
->
tableId
);
return
TSDB_CODE_SDB_ERROR
;
}
mPrint
(
"stable:%s, is created, tags:%d cols:%d"
,
p
Creat
e
->
tableId
,
pStable
->
numOfTags
,
pStable
->
numOfColumns
);
mPrint
(
"stable:%s, is created, tags:%d cols:%d"
,
p
Stabl
e
->
tableId
,
pStable
->
numOfTags
,
pStable
->
numOfColumns
);
return
TSDB_CODE_SUCCESS
;
}
...
...
src/mnode/src/mgmtTable.c
浏览文件 @
b23c4cd1
...
...
@@ -137,17 +137,6 @@ int32_t mgmtGetTableMeta(SDbObj *pDb, STableInfo *pTable, STableMeta *pMeta, boo
static
void
mgmtCreateTable
(
SVgObj
*
pVgroup
,
SQueuedMsg
*
pMsg
)
{
SCMCreateTableMsg
*
pCreate
=
pMsg
->
pCont
;
pCreate
->
numOfColumns
=
htons
(
pCreate
->
numOfColumns
);
pCreate
->
numOfTags
=
htons
(
pCreate
->
numOfTags
);
pCreate
->
sqlLen
=
htons
(
pCreate
->
sqlLen
);
SSchema
*
pSchema
=
(
SSchema
*
)
pCreate
->
schema
;
for
(
int32_t
i
=
0
;
i
<
pCreate
->
numOfColumns
+
pCreate
->
numOfTags
;
++
i
)
{
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
pSchema
->
colId
=
i
;
pSchema
++
;
}
int32_t
sid
=
taosAllocateId
(
pVgroup
->
idPool
);
if
(
sid
<
0
)
{
mTrace
(
"tables:%s, no enough sid in vgroup:%d"
,
pVgroup
->
vgId
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录