Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f4495328
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看板
提交
f4495328
编写于
2月 08, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into feature/tkv
上级
4a8f6098
ebb90515
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
424 addition
and
64 deletion
+424
-64
include/common/tmsg.h
include/common/tmsg.h
+8
-8
include/util/taoserror.h
include/util/taoserror.h
+1
-1
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+393
-33
source/dnode/mnode/impl/test/stb/stb.cpp
source/dnode/mnode/impl/test/stb/stb.cpp
+5
-5
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+6
-6
source/libs/parser/src/astGenerator.c
source/libs/parser/src/astGenerator.c
+1
-1
source/libs/parser/src/astToMsg.c
source/libs/parser/src/astToMsg.c
+1
-1
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+6
-6
source/util/src/terror.c
source/util/src/terror.c
+3
-3
未找到文件。
include/common/tmsg.h
浏览文件 @
f4495328
...
...
@@ -113,13 +113,13 @@ typedef enum _mgmt_table {
#define TSDB_ALTER_TABLE_ADD_TAG_COLUMN 1
#define TSDB_ALTER_TABLE_DROP_TAG_COLUMN 2
#define TSDB_ALTER_TABLE_
CHANGE_TAG_COLUMN
3
#define TSDB_ALTER_TABLE_
UPDATE_TAG_NAME
3
#define TSDB_ALTER_TABLE_UPDATE_TAG_VAL 4
#define TSDB_ALTER_TABLE_ADD_COLUMN 5
#define TSDB_ALTER_TABLE_DROP_COLUMN 6
#define TSDB_ALTER_TABLE_
CHANGE_COLUMN
7
#define TSDB_ALTER_TABLE_
MODIFY_TAG_COLUMN
8
#define TSDB_ALTER_TABLE_
UPDATE_COLUMN_BYTES
7
#define TSDB_ALTER_TABLE_
UPDATE_TAG_BYTES
8
#define TSDB_FILL_NONE 0
#define TSDB_FILL_NULL 1
...
...
@@ -254,7 +254,7 @@ typedef struct {
int8_t
igExists
;
int32_t
numOfTags
;
int32_t
numOfColumns
;
SSchema
pSchema
[];
SSchema
pSchema
s
[];
}
SMCreateStbReq
;
typedef
struct
{
...
...
@@ -264,10 +264,10 @@ typedef struct {
typedef
struct
{
char
name
[
TSDB_TABLE_FNAME_LEN
];
int8_t
alter
Type
;
int32_t
numOf
Column
s
;
SSchema
pSchema
[];
}
SM
Alter
StbReq
;
int8_t
update
Type
;
int32_t
numOf
Schema
s
;
SSchema
pSchema
s
[];
}
SM
Update
StbReq
;
typedef
struct
{
int32_t
pid
;
...
...
include/util/taoserror.h
浏览文件 @
f4495328
...
...
@@ -228,7 +228,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_TOO_MANY_COLUMNS TAOS_DEF_ERROR_CODE(0, 0x03A9)
#define TSDB_CODE_MND_COLUMN_ALREAY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03AA)
#define TSDB_CODE_MND_COLUMN_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03AB)
#define TSDB_CODE_MND_
EXCEED_MAX_ROW_BYTES
TAOS_DEF_ERROR_CODE(0, 0x03AC)
#define TSDB_CODE_MND_
INVALID_ROW_BYTES
TAOS_DEF_ERROR_CODE(0, 0x03AC)
#define TSDB_CODE_MND_NAME_CONFLICT_WITH_TOPIC TAOS_DEF_ERROR_CODE(0, 0x03AD)
// mnode-func
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
f4495328
...
...
@@ -33,10 +33,10 @@ static int32_t mndStbActionInsert(SSdb *pSdb, SStbObj *pStb);
static
int32_t
mndStbActionDelete
(
SSdb
*
pSdb
,
SStbObj
*
pStb
);
static
int32_t
mndStbActionUpdate
(
SSdb
*
pSdb
,
SStbObj
*
pOld
,
SStbObj
*
pNew
);
static
int32_t
mndProcessMCreateStbReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessM
Alter
StbReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessM
Update
StbReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessMDropStbReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessVCreateStbRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessV
Alter
StbRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessV
Update
StbRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessVDropStbRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessStbMetaReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndGetStbMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
...
...
@@ -53,10 +53,10 @@ int32_t mndInitStb(SMnode *pMnode) {
.
deleteFp
=
(
SdbDeleteFp
)
mndStbActionDelete
};
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_STB
,
mndProcessMCreateStbReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_ALTER_STB
,
mndProcessM
Alter
StbReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_ALTER_STB
,
mndProcessM
Update
StbReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_STB
,
mndProcessMDropStbReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_CREATE_STB_RSP
,
mndProcessVCreateStbRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_ALTER_STB_RSP
,
mndProcessV
Alter
StbRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_ALTER_STB_RSP
,
mndProcessV
Update
StbRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_DROP_STB_RSP
,
mndProcessVDropStbRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_STB_META
,
mndProcessStbMetaReq
);
...
...
@@ -325,7 +325,7 @@ static int32_t mndCheckCreateStbReq(SMCreateStbReq *pCreate) {
pCreate
->
numOfTags
=
htonl
(
pCreate
->
numOfTags
);
int32_t
totalCols
=
pCreate
->
numOfColumns
+
pCreate
->
numOfTags
;
for
(
int32_t
i
=
0
;
i
<
totalCols
;
++
i
)
{
SSchema
*
pSchema
=
&
pCreate
->
pSchema
[
i
];
SSchema
*
pSchema
=
&
pCreate
->
pSchema
s
[
i
];
pSchema
->
bytes
=
htonl
(
pSchema
->
bytes
);
}
...
...
@@ -346,7 +346,7 @@ static int32_t mndCheckCreateStbReq(SMCreateStbReq *pCreate) {
int32_t
maxColId
=
(
TSDB_MAX_COLUMNS
+
TSDB_MAX_TAGS
);
for
(
int32_t
i
=
0
;
i
<
totalCols
;
++
i
)
{
SSchema
*
pSchema
=
&
pCreate
->
pSchema
[
i
];
SSchema
*
pSchema
=
&
pCreate
->
pSchema
s
[
i
];
if
(
pSchema
->
type
<
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_STB_OPTION
;
return
-
1
;
...
...
@@ -465,8 +465,8 @@ static int32_t mndSetCreateStbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
static
int32_t
mndCreateStb
(
SMnode
*
pMnode
,
SMnodeMsg
*
pReq
,
SMCreateStbReq
*
pCreate
,
SDbObj
*
pDb
)
{
SStbObj
stbObj
=
{
0
};
tstrn
cpy
(
stbObj
.
name
,
pCreate
->
name
,
TSDB_TABLE_FNAME_LEN
);
tstrn
cpy
(
stbObj
.
db
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
mem
cpy
(
stbObj
.
name
,
pCreate
->
name
,
TSDB_TABLE_FNAME_LEN
);
mem
cpy
(
stbObj
.
db
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
stbObj
.
createdTime
=
taosGetTimestampMs
();
stbObj
.
updateTime
=
stbObj
.
createdTime
;
stbObj
.
uid
=
mndGenerateUid
(
pCreate
->
name
,
TSDB_TABLE_FNAME_LEN
);
...
...
@@ -477,18 +477,14 @@ static int32_t mndCreateStb(SMnode *pMnode, SMnodeMsg *pReq, SMCreateStbReq *pCr
stbObj
.
numOfTags
=
pCreate
->
numOfTags
;
stbObj
.
pColumns
=
malloc
(
stbObj
.
numOfColumns
*
sizeof
(
SSchema
));
if
(
stbObj
.
pColumns
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
memcpy
(
stbObj
.
pColumns
,
pCreate
->
pSchema
,
stbObj
.
numOfColumns
*
sizeof
(
SSchema
));
stbObj
.
pTags
=
malloc
(
stbObj
.
numOfTags
*
sizeof
(
SSchema
));
if
(
stbObj
.
pTags
==
NULL
)
{
if
(
stbObj
.
p
Columns
==
NULL
||
stbObj
.
p
Tags
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
memcpy
(
stbObj
.
pTags
,
pCreate
->
pSchema
+
stbObj
.
numOfColumns
,
stbObj
.
numOfTags
*
sizeof
(
SSchema
));
memcpy
(
stbObj
.
pColumns
,
pCreate
->
pSchemas
,
stbObj
.
numOfColumns
*
sizeof
(
SSchema
));
memcpy
(
stbObj
.
pTags
,
pCreate
->
pSchemas
+
stbObj
.
numOfColumns
,
stbObj
.
numOfTags
*
sizeof
(
SSchema
));
for
(
int32_t
i
=
0
;
i
<
stbObj
.
numOfColumns
;
++
i
)
{
stbObj
.
pColumns
[
i
].
colId
=
stbObj
.
nextColId
;
...
...
@@ -579,11 +575,11 @@ static int32_t mndProcessVCreateStbRsp(SMnodeMsg *pRsp) {
return
0
;
}
static
int32_t
mndCheck
AlterStbReq
(
SMAlterStbReq
*
pAlter
)
{
p
Alter
->
numOfColumns
=
htonl
(
pAlter
->
numOfColumn
s
);
static
int32_t
mndCheck
UpdateStbReq
(
SMUpdateStbReq
*
pUpdate
)
{
p
Update
->
numOfSchemas
=
htonl
(
pUpdate
->
numOfSchema
s
);
for
(
int32_t
i
=
0
;
i
<
p
Alter
->
numOfColumn
s
;
++
i
)
{
SSchema
*
pSchema
=
&
p
Alter
->
pSchema
[
i
];
for
(
int32_t
i
=
0
;
i
<
p
Update
->
numOfSchema
s
;
++
i
)
{
SSchema
*
pSchema
=
&
p
Update
->
pSchemas
[
i
];
pSchema
->
colId
=
htonl
(
pSchema
->
colId
);
pSchema
->
bytes
=
htonl
(
pSchema
->
bytes
);
...
...
@@ -608,41 +604,405 @@ static int32_t mndCheckAlterStbReq(SMAlterStbReq *pAlter) {
return
0
;
}
static
int32_t
mndUpdateStb
(
SMnode
*
pMnode
,
SMnodeMsg
*
pReq
,
SStbObj
*
pOld
,
SStbObj
*
pNew
)
{
return
0
;
}
static
int32_t
mndFindSuperTableTagIndex
(
const
SStbObj
*
pStb
,
const
char
*
tagName
)
{
for
(
int32_t
tag
=
0
;
tag
<
pStb
->
numOfTags
;
tag
++
)
{
if
(
strcasecmp
(
pStb
->
pTags
[
tag
].
name
,
tagName
)
==
0
)
{
return
tag
;
}
}
return
-
1
;
}
static
int32_t
mndFindSuperTableColumnIndex
(
const
SStbObj
*
pStb
,
const
char
*
colName
)
{
for
(
int32_t
col
=
0
;
col
<
pStb
->
numOfColumns
;
col
++
)
{
if
(
strcasecmp
(
pStb
->
pColumns
[
col
].
name
,
colName
)
==
0
)
{
return
col
;
}
}
return
-
1
;
}
static
int32_t
mndAllocStbSchemas
(
const
SStbObj
*
pOld
,
SStbObj
*
pNew
)
{
pNew
->
pTags
=
calloc
(
pNew
->
numOfTags
,
sizeof
(
SSchema
));
pNew
->
pColumns
=
calloc
(
pNew
->
numOfColumns
,
sizeof
(
SSchema
));
if
(
pNew
->
pTags
==
NULL
||
pNew
->
pColumns
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
memcpy
(
pNew
->
pColumns
,
pOld
->
pColumns
,
sizeof
(
SSchema
)
*
pOld
->
numOfColumns
);
memcpy
(
pNew
->
pTags
,
pOld
->
pTags
,
sizeof
(
SSchema
)
*
pOld
->
numOfTags
);
return
0
;
}
static
int32_t
mndAddSuperTableTag
(
const
SStbObj
*
pOld
,
SStbObj
*
pNew
,
const
SSchema
*
pSchemas
,
int32_t
ntags
)
{
if
(
pOld
->
numOfTags
+
ntags
>
TSDB_MAX_TAGS
)
{
terrno
=
TSDB_CODE_MND_TOO_MANY_TAGS
;
return
-
1
;
}
if
(
pOld
->
numOfColumns
+
ntags
+
pOld
->
numOfTags
>
TSDB_MAX_COLUMNS
)
{
terrno
=
TSDB_CODE_MND_TOO_MANY_COLUMNS
;
return
-
1
;
}
for
(
int32_t
i
=
0
;
i
<
ntags
;
i
++
)
{
if
(
mndFindSuperTableColumnIndex
(
pOld
,
pSchemas
[
i
].
name
)
>
0
)
{
terrno
=
TSDB_CODE_MND_TAG_ALREAY_EXIST
;
return
-
1
;
}
if
(
mndFindSuperTableTagIndex
(
pOld
,
pSchemas
[
i
].
name
)
>
0
)
{
terrno
=
TSDB_CODE_MND_COLUMN_ALREAY_EXIST
;
return
-
1
;
}
}
pNew
->
numOfTags
=
pNew
->
numOfTags
+
ntags
;
if
(
mndAllocStbSchemas
(
pOld
,
pNew
)
!=
0
)
{
return
-
1
;
}
memcpy
(
pNew
->
pTags
+
pOld
->
numOfTags
,
pSchemas
,
sizeof
(
SSchema
)
*
ntags
);
for
(
int32_t
i
=
pOld
->
numOfTags
;
i
<
pNew
->
numOfTags
;
i
++
)
{
SSchema
*
pSchema
=
&
pNew
->
pTags
[
i
];
pSchema
->
colId
=
pNew
->
nextColId
;
pNew
->
nextColId
++
;
}
pNew
->
version
++
;
mDebug
(
"stb:%s, start to add tag %s"
,
pNew
->
name
,
pSchemas
[
0
].
name
);
return
0
;
}
static
int32_t
mndDropSuperTableTag
(
const
SStbObj
*
pOld
,
SStbObj
*
pNew
,
const
char
*
tagName
)
{
int32_t
tag
=
mndFindSuperTableTagIndex
(
pOld
,
tagName
);
if
(
tag
<
0
)
{
terrno
=
TSDB_CODE_MND_TAG_NOT_EXIST
;
return
-
1
;
}
if
(
mndAllocStbSchemas
(
pOld
,
pNew
)
!=
0
)
{
return
-
1
;
}
memmove
(
pNew
->
pTags
+
tag
,
pNew
->
pTags
+
tag
+
1
,
sizeof
(
SSchema
)
*
(
pNew
->
numOfTags
-
tag
-
1
));
pNew
->
version
++
;
mDebug
(
"stb:%s, start to drop tag %s"
,
pNew
->
name
,
tagName
);
return
0
;
}
static
int32_t
mndUpdateStbTagName
(
const
SStbObj
*
pOld
,
SStbObj
*
pNew
,
const
char
*
oldTagName
,
const
char
*
newTagName
)
{
int32_t
tag
=
mndFindSuperTableTagIndex
(
pOld
,
oldTagName
);
if
(
tag
<
0
)
{
terrno
=
TSDB_CODE_MND_TAG_NOT_EXIST
;
return
-
1
;
}
if
(
mndFindSuperTableTagIndex
(
pOld
,
newTagName
)
>=
0
)
{
terrno
=
TSDB_CODE_MND_TAG_ALREAY_EXIST
;
return
-
1
;
}
int32_t
len
=
(
int32_t
)
strlen
(
newTagName
);
if
(
len
>=
TSDB_COL_NAME_LEN
)
{
terrno
=
TSDB_CODE_MND_INVALID_STB_OPTION
;
return
-
1
;
}
if
(
mndAllocStbSchemas
(
pOld
,
pNew
)
!=
0
)
{
return
-
1
;
}
SSchema
*
pSchema
=
(
SSchema
*
)(
pNew
->
pTags
+
tag
);
memcpy
(
pSchema
->
name
,
newTagName
,
TSDB_COL_NAME_LEN
);
pNew
->
version
++
;
mDebug
(
"stb:%s, start to modify tag %s to %s"
,
pNew
->
name
,
oldTagName
,
newTagName
);
return
0
;
}
static
int32_t
mndUpdateStbTagBytes
(
const
SStbObj
*
pOld
,
SStbObj
*
pNew
,
const
SSchema
*
pSchema
)
{
int32_t
tag
=
mndFindSuperTableTagIndex
(
pOld
,
pSchema
->
name
);
if
(
tag
<
0
)
{
terrno
=
TSDB_CODE_MND_TAG_NOT_EXIST
;
return
-
1
;
}
if
(
!
(
pSchema
->
type
==
TSDB_DATA_TYPE_BINARY
||
pSchema
->
type
==
TSDB_DATA_TYPE_NCHAR
))
{
terrno
=
TSDB_CODE_MND_INVALID_STB_OPTION
;
return
-
1
;
}
if
(
mndAllocStbSchemas
(
pOld
,
pNew
)
!=
0
)
{
return
-
1
;
}
SSchema
*
pTag
=
pNew
->
pTags
+
tag
;
if
(
pSchema
->
bytes
<=
pTag
->
bytes
)
{
terrno
=
TSDB_CODE_MND_INVALID_ROW_BYTES
;
return
-
1
;
}
pTag
->
bytes
=
pSchema
->
bytes
;
pNew
->
version
++
;
mDebug
(
"stb:%s, start to modify tag len %s to %d"
,
pNew
->
name
,
pSchema
->
name
,
pSchema
->
bytes
);
return
0
;
}
static
int32_t
mndAddSuperTableColumn
(
const
SStbObj
*
pOld
,
SStbObj
*
pNew
,
const
SSchema
*
pSchemas
,
int32_t
ncols
)
{
if
(
pOld
->
numOfColumns
+
ncols
+
pOld
->
numOfTags
>
TSDB_MAX_COLUMNS
)
{
terrno
=
TSDB_CODE_MND_TOO_MANY_COLUMNS
;
return
-
1
;
}
for
(
int32_t
i
=
0
;
i
<
ncols
;
i
++
)
{
if
(
mndFindSuperTableColumnIndex
(
pOld
,
pSchemas
[
i
].
name
)
>
0
)
{
terrno
=
TSDB_CODE_MND_TAG_ALREAY_EXIST
;
return
-
1
;
}
if
(
mndFindSuperTableTagIndex
(
pOld
,
pSchemas
[
i
].
name
)
>
0
)
{
terrno
=
TSDB_CODE_MND_COLUMN_ALREAY_EXIST
;
return
-
1
;
}
}
pNew
->
numOfColumns
=
pNew
->
numOfColumns
+
ncols
;
if
(
mndAllocStbSchemas
(
pOld
,
pNew
)
!=
0
)
{
return
-
1
;
}
memcpy
(
pNew
->
pColumns
+
pOld
->
numOfColumns
,
pSchemas
,
sizeof
(
SSchema
)
*
ncols
);
for
(
int32_t
i
=
pOld
->
numOfColumns
;
i
<
pNew
->
numOfColumns
;
i
++
)
{
SSchema
*
pSchema
=
&
pNew
->
pColumns
[
i
];
pSchema
->
colId
=
pNew
->
nextColId
;
pNew
->
nextColId
++
;
}
pNew
->
version
++
;
mDebug
(
"stb:%s, start to add column %s"
,
pNew
->
name
,
pSchemas
[
0
].
name
);
return
0
;
}
static
int32_t
mndDropSuperTableColumn
(
const
SStbObj
*
pOld
,
SStbObj
*
pNew
,
const
char
*
colName
)
{
int32_t
col
=
mndFindSuperTableColumnIndex
(
pOld
,
colName
);
if
(
col
<=
0
)
{
terrno
=
TSDB_CODE_MND_COLUMN_NOT_EXIST
;
return
-
1
;
}
if
(
mndAllocStbSchemas
(
pOld
,
pNew
)
!=
0
)
{
return
-
1
;
}
memmove
(
pNew
->
pColumns
+
col
,
pNew
->
pColumns
+
col
+
1
,
sizeof
(
SSchema
)
*
(
pNew
->
numOfColumns
-
col
-
1
));
pNew
->
version
++
;
mDebug
(
"stb:%s, start to drop col %s"
,
pNew
->
name
,
colName
);
return
0
;
}
static
int32_t
mndUpdateStbColumnBytes
(
const
SStbObj
*
pOld
,
SStbObj
*
pNew
,
const
SSchema
*
pSchema
)
{
int32_t
col
=
mndFindSuperTableColumnIndex
(
pOld
,
pSchema
->
name
);
if
(
col
<
0
)
{
terrno
=
TSDB_CODE_MND_COLUMN_NOT_EXIST
;
return
-
1
;
}
if
(
!
(
pSchema
->
type
==
TSDB_DATA_TYPE_BINARY
||
pSchema
->
type
==
TSDB_DATA_TYPE_NCHAR
))
{
terrno
=
TSDB_CODE_MND_INVALID_STB_OPTION
;
return
-
1
;
}
uint32_t
nLen
=
0
;
for
(
int32_t
i
=
0
;
i
<
pOld
->
numOfColumns
;
++
i
)
{
nLen
+=
(
pOld
->
pColumns
[
i
].
colId
==
col
)
?
pSchema
->
bytes
:
pOld
->
pColumns
[
i
].
bytes
;
}
if
(
nLen
>
TSDB_MAX_BYTES_PER_ROW
)
{
terrno
=
TSDB_CODE_MND_INVALID_ROW_BYTES
;
return
-
1
;
}
if
(
mndAllocStbSchemas
(
pOld
,
pNew
)
!=
0
)
{
return
-
1
;
}
SSchema
*
pCol
=
pNew
->
pColumns
+
col
;
if
(
pSchema
->
bytes
<=
pCol
->
bytes
)
{
terrno
=
TSDB_CODE_MND_INVALID_ROW_BYTES
;
return
-
1
;
}
pCol
->
bytes
=
pSchema
->
bytes
;
pNew
->
version
++
;
mDebug
(
"stb:%s, start to modify col len %s to %d"
,
pNew
->
name
,
pSchema
->
name
,
pSchema
->
bytes
);
return
0
;
}
static
int32_t
mndSetUpdateStbRedoLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SStbObj
*
pStb
)
{
SSdbRaw
*
pRedoRaw
=
mndStbActionEncode
(
pStb
);
if
(
pRedoRaw
==
NULL
)
return
-
1
;
if
(
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
)
!=
0
)
return
-
1
;
if
(
sdbSetRawStatus
(
pRedoRaw
,
SDB_STATUS_CREATING
)
!=
0
)
return
-
1
;
return
0
;
}
static
int32_t
mndSetUpdateStbCommitLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SStbObj
*
pStb
)
{
SSdbRaw
*
pCommitRaw
=
mndStbActionEncode
(
pStb
);
if
(
pCommitRaw
==
NULL
)
return
-
1
;
if
(
mndTransAppendCommitlog
(
pTrans
,
pCommitRaw
)
!=
0
)
return
-
1
;
if
(
sdbSetRawStatus
(
pCommitRaw
,
SDB_STATUS_READY
)
!=
0
)
return
-
1
;
return
0
;
}
static
int32_t
mndSetUpdateStbRedoActions
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SStbObj
*
pStb
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SVgObj
*
pVgroup
=
NULL
;
void
*
pIter
=
NULL
;
int32_t
contLen
;
while
(
1
)
{
pIter
=
sdbFetch
(
pSdb
,
SDB_VGROUP
,
pIter
,
(
void
**
)
&
pVgroup
);
if
(
pIter
==
NULL
)
break
;
if
(
pVgroup
->
dbUid
!=
pDb
->
uid
)
continue
;
void
*
pReq
=
mndBuildCreateStbReq
(
pMnode
,
pVgroup
,
pStb
,
&
contLen
);
if
(
pReq
==
NULL
)
{
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pVgroup
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetVgroupEpset
(
pMnode
,
pVgroup
);
action
.
pCont
=
pReq
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_VND_CREATE_STB
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
free
(
pReq
);
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pVgroup
);
return
-
1
;
}
sdbRelease
(
pSdb
,
pVgroup
);
}
return
0
;
}
static
int32_t
mndUpdateStb
(
SMnode
*
pMnode
,
SMnodeMsg
*
pReq
,
const
SMUpdateStbReq
*
pUpdate
,
SDbObj
*
pDb
,
SStbObj
*
pOld
)
{
SStbObj
stbObj
=
{
0
};
taosRLockLatch
(
&
pOld
->
lock
);
memcpy
(
&
stbObj
,
pOld
,
sizeof
(
SStbObj
));
stbObj
.
pColumns
=
NULL
;
stbObj
.
pTags
=
NULL
;
stbObj
.
updateTime
=
taosGetTimestampMs
();
taosRUnLockLatch
(
&
pOld
->
lock
);
int32_t
code
=
-
1
;
switch
(
pUpdate
->
updateType
)
{
case
TSDB_ALTER_TABLE_ADD_TAG_COLUMN
:
code
=
mndAddSuperTableTag
(
pOld
,
&
stbObj
,
pUpdate
->
pSchemas
,
1
);
break
;
case
TSDB_ALTER_TABLE_DROP_TAG_COLUMN
:
code
=
mndDropSuperTableTag
(
pOld
,
&
stbObj
,
pUpdate
->
pSchemas
[
0
].
name
);
break
;
case
TSDB_ALTER_TABLE_UPDATE_TAG_NAME
:
code
=
mndUpdateStbTagName
(
pOld
,
&
stbObj
,
pUpdate
->
pSchemas
[
0
].
name
,
pUpdate
->
pSchemas
[
1
].
name
);
break
;
case
TSDB_ALTER_TABLE_UPDATE_TAG_BYTES
:
code
=
mndUpdateStbTagBytes
(
pOld
,
&
stbObj
,
&
pUpdate
->
pSchemas
[
0
]);
break
;
case
TSDB_ALTER_TABLE_ADD_COLUMN
:
code
=
mndAddSuperTableColumn
(
pOld
,
&
stbObj
,
pUpdate
->
pSchemas
,
1
);
break
;
case
TSDB_ALTER_TABLE_DROP_COLUMN
:
code
=
mndDropSuperTableColumn
(
pOld
,
&
stbObj
,
pUpdate
->
pSchemas
[
0
].
name
);
break
;
case
TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES
:
code
=
mndUpdateStbColumnBytes
(
pOld
,
&
stbObj
,
&
pUpdate
->
pSchemas
[
0
]);
break
;
default:
terrno
=
TSDB_CODE_MND_INVALID_STB_OPTION
;
break
;
}
if
(
code
!=
0
)
goto
UPDATE_STB_OVER
;
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
&
pReq
->
rpcMsg
);
if
(
pTrans
==
NULL
)
goto
UPDATE_STB_OVER
;
mDebug
(
"trans:%d, used to update stb:%s"
,
pTrans
->
id
,
pUpdate
->
name
);
static
int32_t
mndProcessMAlterStbReq
(
SMnodeMsg
*
pReq
)
{
if
(
mndSetUpdateStbRedoLogs
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
UPDATE_STB_OVER
;
if
(
mndSetUpdateStbCommitLogs
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
UPDATE_STB_OVER
;
if
(
mndSetUpdateStbRedoActions
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
UPDATE_STB_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
UPDATE_STB_OVER
;
code
=
0
;
UPDATE_STB_OVER:
mndTransDrop
(
pTrans
);
tfree
(
stbObj
.
pTags
);
tfree
(
stbObj
.
pColumns
);
return
code
;
}
static
int32_t
mndProcessMUpdateStbReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SM
AlterStbReq
*
pAlter
=
pReq
->
rpcMsg
.
pCont
;
SM
UpdateStbReq
*
pUpdate
=
pReq
->
rpcMsg
.
pCont
;
mDebug
(
"stb:%s, start to
alter"
,
pAlter
->
name
);
mDebug
(
"stb:%s, start to
update"
,
pUpdate
->
name
);
if
(
mndCheck
AlterStbReq
(
pAlter
)
!=
0
)
{
mError
(
"stb:%s, failed to
alter since %s"
,
pAlter
->
name
,
terrstr
());
if
(
mndCheck
UpdateStbReq
(
pUpdate
)
!=
0
)
{
mError
(
"stb:%s, failed to
update since %s"
,
pUpdate
->
name
,
terrstr
());
return
-
1
;
}
SStbObj
*
pStb
=
mndAcquireStb
(
pMnode
,
p
Alter
->
name
);
SStbObj
*
pStb
=
mndAcquireStb
(
pMnode
,
p
Update
->
name
);
if
(
pStb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_STB_NOT_EXIST
;
mError
(
"stb:%s, failed to
alter since %s"
,
pAlter
->
name
,
terrstr
());
mError
(
"stb:%s, failed to
update since %s"
,
pUpdate
->
name
,
terrstr
());
return
-
1
;
}
SStbObj
stbObj
=
{
0
};
memcpy
(
&
stbObj
,
pStb
,
sizeof
(
SStbObj
));
SDbObj
*
pDb
=
mndAcquireDbByStb
(
pMnode
,
pUpdate
->
name
);
if
(
pDb
==
NULL
)
{
mndReleaseStb
(
pMnode
,
pStb
);
terrno
=
TSDB_CODE_MND_DB_NOT_SELECTED
;
mError
(
"stb:%s, failed to update since %s"
,
pUpdate
->
name
,
terrstr
());
return
-
1
;
}
int32_t
code
=
mndUpdateStb
(
pMnode
,
pReq
,
p
Stb
,
&
stbObj
);
int32_t
code
=
mndUpdateStb
(
pMnode
,
pReq
,
p
Update
,
pDb
,
pStb
);
mndReleaseStb
(
pMnode
,
pStb
);
if
(
code
!=
0
)
{
mError
(
"stb:%s, failed to
alter since %s"
,
pAlter
->
name
,
tstrerror
(
code
));
mError
(
"stb:%s, failed to
update since %s"
,
pUpdate
->
name
,
tstrerror
(
code
));
return
code
;
}
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
static
int32_t
mndProcessV
Alter
StbRsp
(
SMnodeMsg
*
pRsp
)
{
static
int32_t
mndProcessV
Update
StbRsp
(
SMnodeMsg
*
pRsp
)
{
mndTransProcessRsp
(
pRsp
);
return
0
;
}
...
...
source/dnode/mnode/impl/test/stb/stb.cpp
浏览文件 @
f4495328
...
...
@@ -67,35 +67,35 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) {
pReq
->
numOfColumns
=
htonl
(
cols
);
{
SSchema
*
pSchema
=
&
pReq
->
pSchema
[
0
];
SSchema
*
pSchema
=
&
pReq
->
pSchema
s
[
0
];
pSchema
->
bytes
=
htonl
(
8
);
pSchema
->
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
->
name
,
"ts"
);
}
{
SSchema
*
pSchema
=
&
pReq
->
pSchema
[
1
];
SSchema
*
pSchema
=
&
pReq
->
pSchema
s
[
1
];
pSchema
->
bytes
=
htonl
(
4
);
pSchema
->
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
->
name
,
"col1"
);
}
{
SSchema
*
pSchema
=
&
pReq
->
pSchema
[
2
];
SSchema
*
pSchema
=
&
pReq
->
pSchema
s
[
2
];
pSchema
->
bytes
=
htonl
(
2
);
pSchema
->
type
=
TSDB_DATA_TYPE_TINYINT
;
strcpy
(
pSchema
->
name
,
"tag1"
);
}
{
SSchema
*
pSchema
=
&
pReq
->
pSchema
[
3
];
SSchema
*
pSchema
=
&
pReq
->
pSchema
s
[
3
];
pSchema
->
bytes
=
htonl
(
8
);
pSchema
->
type
=
TSDB_DATA_TYPE_BIGINT
;
strcpy
(
pSchema
->
name
,
"tag2"
);
}
{
SSchema
*
pSchema
=
&
pReq
->
pSchema
[
4
];
SSchema
*
pSchema
=
&
pReq
->
pSchema
s
[
4
];
pSchema
->
bytes
=
htonl
(
16
);
pSchema
->
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
->
name
,
"tag3"
);
...
...
source/libs/parser/inc/sql.y
浏览文件 @
f4495328
...
...
@@ -813,7 +813,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) DROP COLUMN ids(A). {
cmd ::= ALTER TABLE ids(X) cpxName(F) MODIFY COLUMN columnlist(A). {
X.n += F.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_
CHANGE_COLUMN
, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_
UPDATE_COLUMN_BYTES
, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
...
...
@@ -842,7 +842,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). {
toTSDBType(Z.type);
A = tListItemAppendToken(A, &Z, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_
CHANGE_TAG_COLUMN
, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_
UPDATE_TAG_NAME
, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
...
...
@@ -859,7 +859,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). {
cmd ::= ALTER TABLE ids(X) cpxName(F) MODIFY TAG columnlist(A). {
X.n += F.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_
MODIFY_TAG_COLUMN
, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_
UPDATE_TAG_BYTES
, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
...
...
@@ -882,7 +882,7 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) DROP COLUMN ids(A). {
cmd ::= ALTER STABLE ids(X) cpxName(F) MODIFY COLUMN columnlist(A). {
X.n += F.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_
CHANGE_COLUMN
, TSDB_SUPER_TABLE);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_
UPDATE_COLUMN_BYTES
, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
...
...
@@ -911,7 +911,7 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). {
toTSDBType(Z.type);
A = tListItemAppendToken(A, &Z, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_
CHANGE_TAG_COLUMN
, TSDB_SUPER_TABLE);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, NULL, A, TSDB_ALTER_TABLE_
UPDATE_TAG_NAME
, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
...
...
@@ -928,7 +928,7 @@ cmd ::= ALTER STABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). {
cmd ::= ALTER STABLE ids(X) cpxName(F) MODIFY TAG columnlist(A). {
X.n += F.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_
MODIFY_TAG_COLUMN
, TSDB_SUPER_TABLE);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&X, A, NULL, TSDB_ALTER_TABLE_
UPDATE_TAG_BYTES
, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
...
...
source/libs/parser/src/astGenerator.c
浏览文件 @
f4495328
...
...
@@ -610,7 +610,7 @@ SAlterTableInfo *tSetAlterTableInfo(SToken *pTableName, SArray *pCols, SArray *p
pAlterTable
->
type
=
type
;
pAlterTable
->
tableType
=
tableType
;
if
(
type
==
TSDB_ALTER_TABLE_ADD_COLUMN
||
type
==
TSDB_ALTER_TABLE_ADD_TAG_COLUMN
||
type
==
TSDB_ALTER_TABLE_
CHANGE_COLUMN
||
type
==
TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN
)
{
if
(
type
==
TSDB_ALTER_TABLE_ADD_COLUMN
||
type
==
TSDB_ALTER_TABLE_ADD_TAG_COLUMN
||
type
==
TSDB_ALTER_TABLE_
UPDATE_COLUMN_BYTES
||
type
==
TSDB_ALTER_TABLE_UPDATE_TAG_BYTES
)
{
pAlterTable
->
pAddColumns
=
pCols
;
assert
(
pVals
==
NULL
);
}
else
{
...
...
source/libs/parser/src/astToMsg.c
浏览文件 @
f4495328
...
...
@@ -310,7 +310,7 @@ SMCreateStbReq* buildCreateStbMsg(SCreateTableSql* pCreateTableSql, int32_t* len
pCreateStbMsg
->
numOfColumns
=
htonl
(
numOfCols
);
pCreateStbMsg
->
numOfTags
=
htonl
(
numOfTags
);
pSchema
=
(
SSchema
*
)
pCreateStbMsg
->
pSchema
;
pSchema
=
(
SSchema
*
)
pCreateStbMsg
->
pSchema
s
;
for
(
int
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SField
*
pField
=
taosArrayGet
(
pCreateTableSql
->
colInfo
.
pColumns
,
i
);
pSchema
->
type
=
pField
->
type
;
...
...
source/libs/parser/src/sql.c
浏览文件 @
f4495328
...
...
@@ -3199,7 +3199,7 @@ static void yy_reduce(
case
285
:
/* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
{
yymsp
[
-
4
].
minor
.
yy0
.
n
+=
yymsp
[
-
3
].
minor
.
yy0
.
n
;
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
4
].
minor
.
yy0
,
yymsp
[
0
].
minor
.
yy165
,
NULL
,
TSDB_ALTER_TABLE_
CHANGE_COLUMN
,
-
1
);
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
4
].
minor
.
yy0
,
yymsp
[
0
].
minor
.
yy165
,
NULL
,
TSDB_ALTER_TABLE_
UPDATE_COLUMN_BYTES
,
-
1
);
setSqlInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
}
break
;
...
...
@@ -3231,7 +3231,7 @@ static void yy_reduce(
toTSDBType
(
yymsp
[
0
].
minor
.
yy0
.
type
);
A
=
tListItemAppendToken
(
A
,
&
yymsp
[
0
].
minor
.
yy0
,
-
1
);
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
5
].
minor
.
yy0
,
NULL
,
A
,
TSDB_ALTER_TABLE_
CHANGE_TAG_COLUMN
,
-
1
);
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
5
].
minor
.
yy0
,
NULL
,
A
,
TSDB_ALTER_TABLE_
UPDATE_TAG_NAME
,
-
1
);
setSqlInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
}
break
;
...
...
@@ -3250,7 +3250,7 @@ static void yy_reduce(
case
290
:
/* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
{
yymsp
[
-
4
].
minor
.
yy0
.
n
+=
yymsp
[
-
3
].
minor
.
yy0
.
n
;
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
4
].
minor
.
yy0
,
yymsp
[
0
].
minor
.
yy165
,
NULL
,
TSDB_ALTER_TABLE_
MODIFY_TAG_COLUMN
,
-
1
);
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
4
].
minor
.
yy0
,
yymsp
[
0
].
minor
.
yy165
,
NULL
,
TSDB_ALTER_TABLE_
UPDATE_TAG_BYTES
,
-
1
);
setSqlInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
}
break
;
...
...
@@ -3275,7 +3275,7 @@ static void yy_reduce(
case
293
:
/* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
{
yymsp
[
-
4
].
minor
.
yy0
.
n
+=
yymsp
[
-
3
].
minor
.
yy0
.
n
;
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
4
].
minor
.
yy0
,
yymsp
[
0
].
minor
.
yy165
,
NULL
,
TSDB_ALTER_TABLE_
CHANGE_COLUMN
,
TSDB_SUPER_TABLE
);
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
4
].
minor
.
yy0
,
yymsp
[
0
].
minor
.
yy165
,
NULL
,
TSDB_ALTER_TABLE_
UPDATE_COLUMN_BYTES
,
TSDB_SUPER_TABLE
);
setSqlInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
}
break
;
...
...
@@ -3307,7 +3307,7 @@ static void yy_reduce(
toTSDBType
(
yymsp
[
0
].
minor
.
yy0
.
type
);
A
=
tListItemAppendToken
(
A
,
&
yymsp
[
0
].
minor
.
yy0
,
-
1
);
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
5
].
minor
.
yy0
,
NULL
,
A
,
TSDB_ALTER_TABLE_
CHANGE_TAG_COLUMN
,
TSDB_SUPER_TABLE
);
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
5
].
minor
.
yy0
,
NULL
,
A
,
TSDB_ALTER_TABLE_
UPDATE_TAG_NAME
,
TSDB_SUPER_TABLE
);
setSqlInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
}
break
;
...
...
@@ -3326,7 +3326,7 @@ static void yy_reduce(
case
298
:
/* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
{
yymsp
[
-
4
].
minor
.
yy0
.
n
+=
yymsp
[
-
3
].
minor
.
yy0
.
n
;
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
4
].
minor
.
yy0
,
yymsp
[
0
].
minor
.
yy165
,
NULL
,
TSDB_ALTER_TABLE_
MODIFY_TAG_COLUMN
,
TSDB_SUPER_TABLE
);
SAlterTableInfo
*
pAlterTable
=
tSetAlterTableInfo
(
&
yymsp
[
-
4
].
minor
.
yy0
,
yymsp
[
0
].
minor
.
yy165
,
NULL
,
TSDB_ALTER_TABLE_
UPDATE_TAG_BYTES
,
TSDB_SUPER_TABLE
);
setSqlInfo
(
pInfo
,
pAlterTable
,
NULL
,
TSDB_SQL_ALTER_TABLE
);
}
break
;
...
...
source/util/src/terror.c
浏览文件 @
f4495328
...
...
@@ -236,9 +236,9 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_TAGS, "Too many tags")
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TAG_ALREAY_EXIST
,
"Tag already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TAG_NOT_EXIST
,
"Tag does not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_COLUMNS
,
"Too many columns"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_COLUMN_ALREAY_EXIST
,
"Column already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_COLUMN_NOT_EXIST
,
"Column does not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_
EXCEED_MAX_ROW_BYTES
,
"Exceed max
row bytes"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_COLUMN_ALREAY_EXIST
,
"Column already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_COLUMN_NOT_EXIST
,
"Column does not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_
INVALID_ROW_BYTES
,
"Invalid
row bytes"
)
// mnode-func
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_FUNC_ALREADY_EXIST
,
"Func already exists"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录