Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
冷面1992
TDengine
提交
b23c4cd1
TDengine
项目概览
冷面1992
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
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
...
@@ -344,10 +344,10 @@ int32_t mgmtCreateNormalTable(SCMCreateTableMsg *pCreate, int32_t contLen, SVgOb
pTable
->
sid
=
sid
;
pTable
->
sid
=
sid
;
pTable
->
createdTime
=
taosGetTimestampMs
();
pTable
->
createdTime
=
taosGetTimestampMs
();
pTable
->
sversion
=
0
;
pTable
->
sversion
=
0
;
pTable
->
numOfColumns
=
pCreate
->
numOfColumns
;
pTable
->
numOfColumns
=
htons
(
pCreate
->
numOfColumns
)
;
pTable
->
sqlLen
=
pTable
->
sqlLen
;
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
);
int32_t
schemaSize
=
numOfCols
*
sizeof
(
SSchema
);
pTable
->
schema
=
(
SSchema
*
)
calloc
(
1
,
schemaSize
);
pTable
->
schema
=
(
SSchema
*
)
calloc
(
1
,
schemaSize
);
if
(
pTable
->
schema
==
NULL
)
{
if
(
pTable
->
schema
==
NULL
)
{
...
@@ -357,13 +357,12 @@ int32_t mgmtCreateNormalTable(SCMCreateTableMsg *pCreate, int32_t contLen, SVgOb
...
@@ -357,13 +357,12 @@ int32_t mgmtCreateNormalTable(SCMCreateTableMsg *pCreate, int32_t contLen, SVgOb
memcpy
(
pTable
->
schema
,
pCreate
->
schema
,
numOfCols
*
sizeof
(
SSchema
));
memcpy
(
pTable
->
schema
,
pCreate
->
schema
,
numOfCols
*
sizeof
(
SSchema
));
pTable
->
nextColId
=
0
;
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
;
SSchema
*
tschema
=
pTable
->
schema
;
tschema
[
col
].
colId
=
pTable
->
nextColId
++
;
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
)
{
if
(
pTable
->
sqlLen
!=
0
)
{
pTable
->
type
=
TSDB_STREAM_TABLE
;
pTable
->
type
=
TSDB_STREAM_TABLE
;
pTable
->
sql
=
calloc
(
1
,
pTable
->
sqlLen
);
pTable
->
sql
=
calloc
(
1
,
pTable
->
sqlLen
);
...
@@ -371,20 +370,20 @@ int32_t mgmtCreateNormalTable(SCMCreateTableMsg *pCreate, int32_t contLen, SVgOb
...
@@ -371,20 +370,20 @@ int32_t mgmtCreateNormalTable(SCMCreateTableMsg *pCreate, int32_t contLen, SVgOb
free
(
pTable
);
free
(
pTable
);
return
TSDB_CODE_SERV_OUT_OF_MEMORY
;
return
TSDB_CODE_SERV_OUT_OF_MEMORY
;
}
}
memcpy
(
pTable
->
sql
,
(
char
*
)
(
pCreate
->
schema
)
+
numOfCols
*
sizeof
(
SSchema
),
p
Creat
e
->
sqlLen
);
memcpy
(
pTable
->
sql
,
(
char
*
)
(
pCreate
->
schema
)
+
numOfCols
*
sizeof
(
SSchema
),
p
Tabl
e
->
sqlLen
);
pTable
->
sql
[
p
Creat
e
->
sqlLen
-
1
]
=
0
;
pTable
->
sql
[
p
Tabl
e
->
sqlLen
-
1
]
=
0
;
mTrace
(
"table:%s, stream sql len:%d sql:%s"
,
p
Create
->
tableId
,
pCreat
e
->
sqlLen
,
pTable
->
sql
);
mTrace
(
"table:%s, stream sql len:%d sql:%s"
,
p
Table
->
tableId
,
pTabl
e
->
sqlLen
,
pTable
->
sql
);
}
}
if
(
sdbInsertRow
(
tsNormalTableSdb
,
pTable
,
0
)
<
0
)
{
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
);
free
(
pTable
);
return
TSDB_CODE_SDB_ERROR
;
return
TSDB_CODE_SDB_ERROR
;
}
}
*
pDCreateOut
=
mgmtBuildCreateNormalTableMsg
(
pTable
,
pVgroup
);
*
pDCreateOut
=
mgmtBuildCreateNormalTableMsg
(
pTable
,
pVgroup
);
if
(
*
pDCreateOut
==
NULL
)
{
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
);
sdbDeleteRow
(
tsNormalTableSdb
,
pTable
);
return
TSDB_CODE_SERV_OUT_OF_MEMORY
;
return
TSDB_CODE_SERV_OUT_OF_MEMORY
;
}
}
...
...
src/mnode/src/mgmtSuperTable.c
浏览文件 @
b23c4cd1
...
@@ -242,11 +242,11 @@ int32_t mgmtCreateSuperTable(SDbObj *pDb, SCMCreateTableMsg *pCreate) {
...
@@ -242,11 +242,11 @@ int32_t mgmtCreateSuperTable(SDbObj *pDb, SCMCreateTableMsg *pCreate) {
}
}
if
(
sdbInsertRow
(
tsSuperTableSdb
,
pStable
,
0
)
<
0
)
{
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
;
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
;
return
TSDB_CODE_SUCCESS
;
}
}
...
...
src/mnode/src/mgmtTable.c
浏览文件 @
b23c4cd1
...
@@ -137,17 +137,6 @@ int32_t mgmtGetTableMeta(SDbObj *pDb, STableInfo *pTable, STableMeta *pMeta, boo
...
@@ -137,17 +137,6 @@ int32_t mgmtGetTableMeta(SDbObj *pDb, STableInfo *pTable, STableMeta *pMeta, boo
static
void
mgmtCreateTable
(
SVgObj
*
pVgroup
,
SQueuedMsg
*
pMsg
)
{
static
void
mgmtCreateTable
(
SVgObj
*
pVgroup
,
SQueuedMsg
*
pMsg
)
{
SCMCreateTableMsg
*
pCreate
=
pMsg
->
pCont
;
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
);
int32_t
sid
=
taosAllocateId
(
pVgroup
->
idPool
);
if
(
sid
<
0
)
{
if
(
sid
<
0
)
{
mTrace
(
"tables:%s, no enough sid in vgroup:%d"
,
pVgroup
->
vgId
);
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录