Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
59008ec6
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
59008ec6
编写于
4月 18, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
4月 18, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11603 from taosdata/feature/check
fix(cluster): crash while create rollup sma
上级
c1d5d3cd
6f2dbd41
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
137 addition
and
132 deletion
+137
-132
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+11
-10
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+4
-0
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+122
-122
未找到文件。
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
59008ec6
...
...
@@ -275,16 +275,17 @@ typedef struct {
}
SDbCfg
;
typedef
struct
{
char
name
[
TSDB_DB_FNAME_LEN
];
char
acct
[
TSDB_USER_LEN
];
char
createUser
[
TSDB_USER_LEN
];
int64_t
createdTime
;
int64_t
updateTime
;
int64_t
uid
;
int32_t
cfgVersion
;
int32_t
vgVersion
;
int8_t
hashMethod
;
// default is 1
SDbCfg
cfg
;
char
name
[
TSDB_DB_FNAME_LEN
];
char
acct
[
TSDB_USER_LEN
];
char
createUser
[
TSDB_USER_LEN
];
int64_t
createdTime
;
int64_t
updateTime
;
int64_t
uid
;
int32_t
cfgVersion
;
int32_t
vgVersion
;
int8_t
hashMethod
;
// default is 1
SDbCfg
cfg
;
SRWLatch
lock
;
}
SDbObj
;
typedef
struct
{
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
59008ec6
...
...
@@ -219,10 +219,14 @@ static int32_t mndDbActionDelete(SSdb *pSdb, SDbObj *pDb) {
static
int32_t
mndDbActionUpdate
(
SSdb
*
pSdb
,
SDbObj
*
pOld
,
SDbObj
*
pNew
)
{
mTrace
(
"db:%s, perform update action, old row:%p new row:%p"
,
pOld
->
name
,
pOld
,
pNew
);
taosWLockLatch
(
&
pOld
->
lock
);
SArray
*
pOldRetensions
=
pOld
->
cfg
.
pRetensions
;
pOld
->
updateTime
=
pNew
->
updateTime
;
pOld
->
cfgVersion
=
pNew
->
cfgVersion
;
pOld
->
vgVersion
=
pNew
->
vgVersion
;
memcpy
(
&
pOld
->
cfg
,
&
pNew
->
cfg
,
sizeof
(
SDbCfg
));
pNew
->
cfg
.
pRetensions
=
pOldRetensions
;
taosWUnLockLatch
(
&
pOld
->
lock
);
return
0
;
}
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
59008ec6
...
...
@@ -74,59 +74,59 @@ SSdbRaw *mndStbActionEncode(SStbObj *pStb) {
int32_t
size
=
sizeof
(
SStbObj
)
+
(
pStb
->
numOfColumns
+
pStb
->
numOfTags
+
pStb
->
numOfSmas
)
*
sizeof
(
SSchema
)
+
TSDB_STB_RESERVE_SIZE
;
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_STB
,
TSDB_STB_VER_NUMBER
,
size
);
if
(
pRaw
==
NULL
)
goto
STB_ENCODE
_OVER
;
if
(
pRaw
==
NULL
)
goto
_OVER
;
int32_t
dataPos
=
0
;
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pStb
->
name
,
TSDB_TABLE_FNAME_LEN
,
STB_ENCODE
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pStb
->
db
,
TSDB_DB_FNAME_LEN
,
STB_ENCODE
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pStb
->
createdTime
,
STB_ENCODE
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pStb
->
updateTime
,
STB_ENCODE
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pStb
->
uid
,
STB_ENCODE
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pStb
->
dbUid
,
STB_ENCODE
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
version
,
STB_ENCODE
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
nextColId
,
STB_ENCODE
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
(
int32_t
)(
pStb
->
xFilesFactor
*
10000
),
STB_ENCODE
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
aggregationMethod
,
STB_ENCODE
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
delay
,
STB_ENCODE
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
ttl
,
STB_ENCODE
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
numOfColumns
,
STB_ENCODE
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
numOfTags
,
STB_ENCODE
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
numOfSmas
,
STB_ENCODE
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
commentLen
,
STB_ENCODE
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pStb
->
name
,
TSDB_TABLE_FNAME_LEN
,
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pStb
->
db
,
TSDB_DB_FNAME_LEN
,
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pStb
->
createdTime
,
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pStb
->
updateTime
,
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pStb
->
uid
,
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pStb
->
dbUid
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
version
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
nextColId
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
(
int32_t
)(
pStb
->
xFilesFactor
*
10000
),
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
aggregationMethod
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
delay
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
ttl
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
numOfColumns
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
numOfTags
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
numOfSmas
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
commentLen
,
_OVER
)
for
(
int32_t
i
=
0
;
i
<
pStb
->
numOfColumns
;
++
i
)
{
SSchema
*
pSchema
=
&
pStb
->
pColumns
[
i
];
SDB_SET_INT8
(
pRaw
,
dataPos
,
pSchema
->
type
,
STB_ENCODE
_OVER
)
SDB_SET_INT16
(
pRaw
,
dataPos
,
pSchema
->
colId
,
STB_ENCODE
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pSchema
->
bytes
,
STB_ENCODE
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pSchema
->
name
,
TSDB_COL_NAME_LEN
,
STB_ENCODE
_OVER
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pSchema
->
type
,
_OVER
)
SDB_SET_INT16
(
pRaw
,
dataPos
,
pSchema
->
colId
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pSchema
->
bytes
,
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pSchema
->
name
,
TSDB_COL_NAME_LEN
,
_OVER
)
}
for
(
int32_t
i
=
0
;
i
<
pStb
->
numOfTags
;
++
i
)
{
SSchema
*
pSchema
=
&
pStb
->
pTags
[
i
];
SDB_SET_INT8
(
pRaw
,
dataPos
,
pSchema
->
type
,
STB_ENCODE
_OVER
)
SDB_SET_INT16
(
pRaw
,
dataPos
,
pSchema
->
colId
,
STB_ENCODE
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pSchema
->
bytes
,
STB_ENCODE
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pSchema
->
name
,
TSDB_COL_NAME_LEN
,
STB_ENCODE
_OVER
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pSchema
->
type
,
_OVER
)
SDB_SET_INT16
(
pRaw
,
dataPos
,
pSchema
->
colId
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pSchema
->
bytes
,
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pSchema
->
name
,
TSDB_COL_NAME_LEN
,
_OVER
)
}
for
(
int32_t
i
=
0
;
i
<
pStb
->
numOfSmas
;
++
i
)
{
SSchema
*
pSchema
=
&
pStb
->
pSmas
[
i
];
SDB_SET_INT8
(
pRaw
,
dataPos
,
pSchema
->
type
,
STB_ENCODE
_OVER
)
SDB_SET_INT16
(
pRaw
,
dataPos
,
pSchema
->
colId
,
STB_ENCODE
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pSchema
->
bytes
,
STB_ENCODE
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pSchema
->
name
,
TSDB_COL_NAME_LEN
,
STB_ENCODE
_OVER
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pSchema
->
type
,
_OVER
)
SDB_SET_INT16
(
pRaw
,
dataPos
,
pSchema
->
colId
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pSchema
->
bytes
,
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pSchema
->
name
,
TSDB_COL_NAME_LEN
,
_OVER
)
}
if
(
pStb
->
commentLen
>
0
)
{
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pStb
->
comment
,
pStb
->
commentLen
,
STB_ENCODE
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pStb
->
comment
,
pStb
->
commentLen
,
_OVER
)
}
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
TSDB_STB_RESERVE_SIZE
,
STB_ENCODE
_OVER
)
SDB_SET_DATALEN
(
pRaw
,
dataPos
,
STB_ENCODE
_OVER
)
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
TSDB_STB_RESERVE_SIZE
,
_OVER
)
SDB_SET_DATALEN
(
pRaw
,
dataPos
,
_OVER
)
terrno
=
0
;
STB_ENCODE
_OVER:
_OVER:
if
(
terrno
!=
0
)
{
mError
(
"stb:%s, failed to encode to raw:%p since %s"
,
pStb
->
name
,
pRaw
,
terrstr
());
sdbFreeRaw
(
pRaw
);
...
...
@@ -141,80 +141,80 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) {
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
int8_t
sver
=
0
;
if
(
sdbGetRawSoftVer
(
pRaw
,
&
sver
)
!=
0
)
goto
STB_DECODE
_OVER
;
if
(
sdbGetRawSoftVer
(
pRaw
,
&
sver
)
!=
0
)
goto
_OVER
;
if
(
sver
!=
TSDB_STB_VER_NUMBER
)
{
terrno
=
TSDB_CODE_SDB_INVALID_DATA_VER
;
goto
STB_DECODE
_OVER
;
goto
_OVER
;
}
SSdbRow
*
pRow
=
sdbAllocRow
(
sizeof
(
SStbObj
));
if
(
pRow
==
NULL
)
goto
STB_DECODE
_OVER
;
if
(
pRow
==
NULL
)
goto
_OVER
;
SStbObj
*
pStb
=
sdbGetRowObj
(
pRow
);
if
(
pStb
==
NULL
)
goto
STB_DECODE
_OVER
;
if
(
pStb
==
NULL
)
goto
_OVER
;
int32_t
dataPos
=
0
;
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pStb
->
name
,
TSDB_TABLE_FNAME_LEN
,
STB_DECODE
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pStb
->
db
,
TSDB_DB_FNAME_LEN
,
STB_DECODE
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pStb
->
createdTime
,
STB_DECODE
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pStb
->
updateTime
,
STB_DECODE
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pStb
->
uid
,
STB_DECODE
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pStb
->
dbUid
,
STB_DECODE
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
version
,
STB_DECODE
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
nextColId
,
STB_DECODE
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pStb
->
name
,
TSDB_TABLE_FNAME_LEN
,
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pStb
->
db
,
TSDB_DB_FNAME_LEN
,
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pStb
->
createdTime
,
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pStb
->
updateTime
,
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pStb
->
uid
,
_OVER
)
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pStb
->
dbUid
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
version
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
nextColId
,
_OVER
)
int32_t
xFilesFactor
=
0
;
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
xFilesFactor
,
STB_DECODE
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
xFilesFactor
,
_OVER
)
pStb
->
xFilesFactor
=
xFilesFactor
/
10000
.
0
f
;
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
aggregationMethod
,
STB_DECODE
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
delay
,
STB_DECODE
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
ttl
,
STB_DECODE
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
numOfColumns
,
STB_DECODE
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
numOfTags
,
STB_DECODE
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
numOfSmas
,
STB_DECODE
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
commentLen
,
STB_DECODE
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
aggregationMethod
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
delay
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
ttl
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
numOfColumns
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
numOfTags
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
numOfSmas
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
commentLen
,
_OVER
)
pStb
->
pColumns
=
taosMemoryCalloc
(
pStb
->
numOfColumns
,
sizeof
(
SSchema
));
pStb
->
pTags
=
taosMemoryCalloc
(
pStb
->
numOfTags
,
sizeof
(
SSchema
));
pStb
->
pSmas
=
taosMemoryCalloc
(
pStb
->
numOfSmas
,
sizeof
(
SSchema
));
if
(
pStb
->
pColumns
==
NULL
||
pStb
->
pTags
==
NULL
||
pStb
->
pSmas
==
NULL
)
{
goto
STB_DECODE
_OVER
;
goto
_OVER
;
}
for
(
int32_t
i
=
0
;
i
<
pStb
->
numOfColumns
;
++
i
)
{
SSchema
*
pSchema
=
&
pStb
->
pColumns
[
i
];
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pSchema
->
type
,
STB_DECODE
_OVER
)
SDB_GET_INT16
(
pRaw
,
dataPos
,
&
pSchema
->
colId
,
STB_DECODE
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pSchema
->
bytes
,
STB_DECODE
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pSchema
->
name
,
TSDB_COL_NAME_LEN
,
STB_DECODE
_OVER
)
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pSchema
->
type
,
_OVER
)
SDB_GET_INT16
(
pRaw
,
dataPos
,
&
pSchema
->
colId
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pSchema
->
bytes
,
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pSchema
->
name
,
TSDB_COL_NAME_LEN
,
_OVER
)
}
for
(
int32_t
i
=
0
;
i
<
pStb
->
numOfTags
;
++
i
)
{
SSchema
*
pSchema
=
&
pStb
->
pTags
[
i
];
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pSchema
->
type
,
STB_DECODE
_OVER
)
SDB_GET_INT16
(
pRaw
,
dataPos
,
&
pSchema
->
colId
,
STB_DECODE
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pSchema
->
bytes
,
STB_DECODE
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pSchema
->
name
,
TSDB_COL_NAME_LEN
,
STB_DECODE
_OVER
)
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pSchema
->
type
,
_OVER
)
SDB_GET_INT16
(
pRaw
,
dataPos
,
&
pSchema
->
colId
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pSchema
->
bytes
,
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pSchema
->
name
,
TSDB_COL_NAME_LEN
,
_OVER
)
}
for
(
int32_t
i
=
0
;
i
<
pStb
->
numOfSmas
;
++
i
)
{
SSchema
*
pSchema
=
&
pStb
->
pSmas
[
i
];
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pSchema
->
type
,
STB_DECODE
_OVER
)
SDB_GET_INT16
(
pRaw
,
dataPos
,
&
pSchema
->
colId
,
STB_DECODE
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pSchema
->
bytes
,
STB_DECODE
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pSchema
->
name
,
TSDB_COL_NAME_LEN
,
STB_DECODE
_OVER
)
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pSchema
->
type
,
_OVER
)
SDB_GET_INT16
(
pRaw
,
dataPos
,
&
pSchema
->
colId
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pSchema
->
bytes
,
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pSchema
->
name
,
TSDB_COL_NAME_LEN
,
_OVER
)
}
if
(
pStb
->
commentLen
>
0
)
{
pStb
->
comment
=
taosMemoryCalloc
(
pStb
->
commentLen
,
1
);
if
(
pStb
->
comment
==
NULL
)
goto
STB_DECODE
_OVER
;
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pStb
->
comment
,
pStb
->
commentLen
,
STB_DECODE
_OVER
)
if
(
pStb
->
comment
==
NULL
)
goto
_OVER
;
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pStb
->
comment
,
pStb
->
commentLen
,
_OVER
)
}
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
TSDB_STB_RESERVE_SIZE
,
STB_DECODE
_OVER
)
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
TSDB_STB_RESERVE_SIZE
,
_OVER
)
terrno
=
0
;
STB_DECODE
_OVER:
_OVER:
if
(
terrno
!=
0
)
{
mError
(
"stb:%s, failed to decode from raw:%p since %s"
,
pStb
->
name
,
pRaw
,
terrstr
());
taosMemoryFreeClear
(
pStb
->
pColumns
);
...
...
@@ -724,21 +724,21 @@ static int32_t mndCreateStb(SMnode *pMnode, SNodeMsg *pReq, SMCreateStbReq *pCre
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_STB
,
&
pReq
->
rpcMsg
);
if
(
pTrans
==
NULL
)
goto
CREATE_STB
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create stb:%s"
,
pTrans
->
id
,
pCreate
->
name
);
mndTransSetDbInfo
(
pTrans
,
pDb
);
if
(
mndSetCreateStbRedoLogs
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
CREATE_STB
_OVER
;
if
(
mndSetCreateStbUndoLogs
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
CREATE_STB
_OVER
;
if
(
mndSetCreateStbCommitLogs
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
CREATE_STB
_OVER
;
if
(
mndSetCreateStbRedoActions
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
CREATE_STB
_OVER
;
if
(
mndSetCreateStbUndoActions
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
CREATE_STB
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
CREATE_STB
_OVER
;
if
(
mndSetCreateStbRedoLogs
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateStbUndoLogs
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateStbCommitLogs
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateStbRedoActions
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateStbUndoActions
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
code
=
0
;
CREATE_STB
_OVER:
_OVER:
mndTransDrop
(
pTrans
);
return
code
;
}
...
...
@@ -754,13 +754,13 @@ static int32_t mndProcessMCreateStbReq(SNodeMsg *pReq) {
if
(
tDeserializeSMCreateStbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_STB
_OVER
;
goto
_OVER
;
}
mDebug
(
"stb:%s, start to create"
,
createReq
.
name
);
if
(
mndCheckCreateStbReq
(
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
CREATE_STB
_OVER
;
goto
_OVER
;
}
pStb
=
mndAcquireStb
(
pMnode
,
createReq
.
name
);
...
...
@@ -768,40 +768,40 @@ static int32_t mndProcessMCreateStbReq(SNodeMsg *pReq) {
if
(
createReq
.
igExists
)
{
mDebug
(
"stb:%s, already exist, ignore exist is set"
,
createReq
.
name
);
code
=
0
;
goto
CREATE_STB
_OVER
;
goto
_OVER
;
}
else
{
terrno
=
TSDB_CODE_MND_STB_ALREADY_EXIST
;
goto
CREATE_STB
_OVER
;
goto
_OVER
;
}
}
else
if
(
terrno
!=
TSDB_CODE_MND_STB_NOT_EXIST
)
{
goto
CREATE_STB
_OVER
;
goto
_OVER
;
}
pTopicStb
=
mndAcquireStb
(
pMnode
,
createReq
.
name
);
if
(
pTopicStb
!=
NULL
)
{
terrno
=
TSDB_CODE_MND_NAME_CONFLICT_WITH_TOPIC
;
goto
CREATE_STB
_OVER
;
goto
_OVER
;
}
pDb
=
mndAcquireDbByStb
(
pMnode
,
createReq
.
name
);
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_SELECTED
;
goto
CREATE_STB
_OVER
;
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
goto
CREATE_STB
_OVER
;
goto
_OVER
;
}
if
(
mndCheckWriteAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
CREATE_STB
_OVER
;
goto
_OVER
;
}
code
=
mndCreateStb
(
pMnode
,
pReq
,
&
createReq
,
pDb
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
CREATE_STB
_OVER:
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"stb:%s, failed to create since %s"
,
createReq
.
name
,
terrstr
());
}
...
...
@@ -1211,23 +1211,23 @@ static int32_t mndAlterStb(SMnode *pMnode, SNodeMsg *pReq, const SMAltertbReq *p
break
;
}
if
(
code
!=
0
)
goto
ALTER_STB
_OVER
;
if
(
code
!=
0
)
goto
_OVER
;
code
=
-
1
;
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_ALTER_STB
,
&
pReq
->
rpcMsg
);
if
(
pTrans
==
NULL
)
goto
ALTER_STB
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to alter stb:%s"
,
pTrans
->
id
,
pAlter
->
name
);
mndTransSetDbInfo
(
pTrans
,
pDb
);
if
(
mndSetAlterStbRedoLogs
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
ALTER_STB
_OVER
;
if
(
mndSetAlterStbCommitLogs
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
ALTER_STB
_OVER
;
if
(
mndSetAlterStbRedoActions
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
ALTER_STB
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
ALTER_STB
_OVER
;
if
(
mndSetAlterStbRedoLogs
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetAlterStbCommitLogs
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetAlterStbRedoActions
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
code
=
0
;
ALTER_STB
_OVER:
_OVER:
mndTransDrop
(
pTrans
);
taosMemoryFreeClear
(
stbObj
.
pTags
);
taosMemoryFreeClear
(
stbObj
.
pColumns
);
...
...
@@ -1244,37 +1244,37 @@ static int32_t mndProcessMAlterStbReq(SNodeMsg *pReq) {
if
(
tDeserializeSMAlterStbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
alterReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
ALTER_STB
_OVER
;
goto
_OVER
;
}
mDebug
(
"stb:%s, start to alter"
,
alterReq
.
name
);
if
(
mndCheckAlterStbReq
(
&
alterReq
)
!=
0
)
goto
ALTER_STB
_OVER
;
if
(
mndCheckAlterStbReq
(
&
alterReq
)
!=
0
)
goto
_OVER
;
pDb
=
mndAcquireDbByStb
(
pMnode
,
alterReq
.
name
);
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB
;
goto
ALTER_STB
_OVER
;
goto
_OVER
;
}
pStb
=
mndAcquireStb
(
pMnode
,
alterReq
.
name
);
if
(
pStb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_STB_NOT_EXIST
;
goto
ALTER_STB
_OVER
;
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
goto
ALTER_STB
_OVER
;
goto
_OVER
;
}
if
(
mndCheckWriteAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
ALTER_STB
_OVER
;
goto
_OVER
;
}
code
=
mndAlterStb
(
pMnode
,
pReq
,
&
alterReq
,
pDb
,
pStb
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
ALTER_STB
_OVER:
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"stb:%s, failed to alter since %s"
,
alterReq
.
name
,
terrstr
());
}
...
...
@@ -1353,19 +1353,19 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
static
int32_t
mndDropStb
(
SMnode
*
pMnode
,
SNodeMsg
*
pReq
,
SDbObj
*
pDb
,
SStbObj
*
pStb
)
{
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_DROP_STB
,
&
pReq
->
rpcMsg
);
if
(
pTrans
==
NULL
)
goto
DROP_STB
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop stb:%s"
,
pTrans
->
id
,
pStb
->
name
);
mndTransSetDbInfo
(
pTrans
,
pDb
);
if
(
mndSetDropStbRedoLogs
(
pMnode
,
pTrans
,
pStb
)
!=
0
)
goto
DROP_STB
_OVER
;
if
(
mndSetDropStbCommitLogs
(
pMnode
,
pTrans
,
pStb
)
!=
0
)
goto
DROP_STB
_OVER
;
if
(
mndSetDropStbRedoActions
(
pMnode
,
pTrans
,
pDb
,
pStb
)
!=
0
)
goto
DROP_STB
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
DROP_STB
_OVER
;
if
(
mndSetDropStbRedoLogs
(
pMnode
,
pTrans
,
pStb
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropStbCommitLogs
(
pMnode
,
pTrans
,
pStb
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropStbRedoActions
(
pMnode
,
pTrans
,
pDb
,
pStb
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
code
=
0
;
DROP_STB
_OVER:
_OVER:
mndTransDrop
(
pTrans
);
return
code
;
}
...
...
@@ -1380,7 +1380,7 @@ static int32_t mndProcessMDropStbReq(SNodeMsg *pReq) {
if
(
tDeserializeSMDropStbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
DROP_STB
_OVER
;
goto
_OVER
;
}
mDebug
(
"stb:%s, start to drop"
,
dropReq
.
name
);
...
...
@@ -1390,32 +1390,32 @@ static int32_t mndProcessMDropStbReq(SNodeMsg *pReq) {
if
(
dropReq
.
igNotExists
)
{
mDebug
(
"stb:%s, not exist, ignore not exist is set"
,
dropReq
.
name
);
code
=
0
;
goto
DROP_STB
_OVER
;
goto
_OVER
;
}
else
{
terrno
=
TSDB_CODE_MND_STB_NOT_EXIST
;
goto
DROP_STB
_OVER
;
goto
_OVER
;
}
}
pDb
=
mndAcquireDbByStb
(
pMnode
,
dropReq
.
name
);
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_SELECTED
;
goto
DROP_STB
_OVER
;
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
if
(
pUser
==
NULL
)
{
goto
DROP_STB
_OVER
;
goto
_OVER
;
}
if
(
mndCheckWriteAuth
(
pUser
,
pDb
)
!=
0
)
{
goto
DROP_STB
_OVER
;
goto
_OVER
;
}
code
=
mndDropStb
(
pMnode
,
pReq
,
pDb
,
pStb
);
if
(
code
==
0
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
DROP_STB
_OVER:
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
mError
(
"stb:%s, failed to drop since %s"
,
dropReq
.
name
,
terrstr
());
}
...
...
@@ -1509,36 +1509,36 @@ static int32_t mndProcessTableMetaReq(SNodeMsg *pReq) {
if
(
tDeserializeSTableInfoReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
infoReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
RETRIEVE_META
_OVER
;
goto
_OVER
;
}
if
(
0
==
strcmp
(
infoReq
.
dbFName
,
TSDB_INFORMATION_SCHEMA_DB
))
{
mDebug
(
"information_schema table:%s.%s, start to retrieve meta"
,
infoReq
.
dbFName
,
infoReq
.
tbName
);
if
(
mndBuildInsTableSchema
(
pMnode
,
infoReq
.
dbFName
,
infoReq
.
tbName
,
&
metaRsp
)
!=
0
)
{
goto
RETRIEVE_META
_OVER
;
goto
_OVER
;
}
}
else
if
(
0
==
strcmp
(
infoReq
.
dbFName
,
TSDB_PERFORMANCE_SCHEMA_DB
))
{
mDebug
(
"performance_schema table:%s.%s, start to retrieve meta"
,
infoReq
.
dbFName
,
infoReq
.
tbName
);
if
(
mndBuildPerfsTableSchema
(
pMnode
,
infoReq
.
dbFName
,
infoReq
.
tbName
,
&
metaRsp
)
!=
0
)
{
goto
RETRIEVE_META
_OVER
;
goto
_OVER
;
}
}
else
{
mDebug
(
"stb:%s.%s, start to retrieve meta"
,
infoReq
.
dbFName
,
infoReq
.
tbName
);
if
(
mndBuildStbSchema
(
pMnode
,
infoReq
.
dbFName
,
infoReq
.
tbName
,
&
metaRsp
)
!=
0
)
{
goto
RETRIEVE_META
_OVER
;
goto
_OVER
;
}
}
int32_t
rspLen
=
tSerializeSTableMetaRsp
(
NULL
,
0
,
&
metaRsp
);
if
(
rspLen
<
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
RETRIEVE_META
_OVER
;
goto
_OVER
;
}
void
*
pRsp
=
rpcMallocCont
(
rspLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
RETRIEVE_META
_OVER
;
goto
_OVER
;
}
tSerializeSTableMetaRsp
(
pRsp
,
rspLen
,
&
metaRsp
);
...
...
@@ -1548,7 +1548,7 @@ static int32_t mndProcessTableMetaReq(SNodeMsg *pReq) {
mDebug
(
"stb:%s.%s, meta is retrieved"
,
infoReq
.
dbFName
,
infoReq
.
tbName
);
RETRIEVE_META
_OVER:
_OVER:
if
(
code
!=
0
)
{
mError
(
"stb:%s.%s, failed to retrieve meta since %s"
,
infoReq
.
dbFName
,
infoReq
.
tbName
,
terrstr
());
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录