Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
073745c8
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看板
提交
073745c8
编写于
5月 07, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: alter stb
上级
cdb7c37d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
25 addition
and
25 deletion
+25
-25
include/common/tmsg.h
include/common/tmsg.h
+4
-4
source/common/src/tmsg.c
source/common/src/tmsg.c
+3
-3
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+8
-8
source/dnode/mnode/impl/test/stb/stb.cpp
source/dnode/mnode/impl/test/stb/stb.cpp
+7
-7
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+3
-3
未找到文件。
include/common/tmsg.h
浏览文件 @
073745c8
...
...
@@ -326,11 +326,11 @@ typedef struct {
int8_t
alterType
;
int32_t
numOfFields
;
SArray
*
pFields
;
}
SMAltertbReq
;
}
SMAlter
S
tbReq
;
int32_t
tSerializeSMAlterStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMAltertbReq
*
pReq
);
int32_t
tDeserializeSMAlterStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMAltertbReq
*
pReq
);
void
tFreeSMAltertbReq
(
SMAltertbReq
*
pReq
);
int32_t
tSerializeSMAlterStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMAlter
S
tbReq
*
pReq
);
int32_t
tDeserializeSMAlterStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMAlter
S
tbReq
*
pReq
);
void
tFreeSMAltertbReq
(
SMAlter
S
tbReq
*
pReq
);
typedef
struct
SEpSet
{
int8_t
inUse
;
...
...
source/common/src/tmsg.c
浏览文件 @
073745c8
...
...
@@ -594,7 +594,7 @@ int32_t tDeserializeSMDropStbReq(void *buf, int32_t bufLen, SMDropStbReq *pReq)
return
0
;
}
int32_t
tSerializeSMAlterStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMAltertbReq
*
pReq
)
{
int32_t
tSerializeSMAlterStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMAlter
S
tbReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
...
...
@@ -615,7 +615,7 @@ int32_t tSerializeSMAlterStbReq(void *buf, int32_t bufLen, SMAltertbReq *pReq) {
return
tlen
;
}
int32_t
tDeserializeSMAlterStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMAltertbReq
*
pReq
)
{
int32_t
tDeserializeSMAlterStbReq
(
void
*
buf
,
int32_t
bufLen
,
SMAlter
S
tbReq
*
pReq
)
{
SCoder
decoder
=
{
0
};
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
...
...
@@ -645,7 +645,7 @@ int32_t tDeserializeSMAlterStbReq(void *buf, int32_t bufLen, SMAltertbReq *pReq)
return
0
;
}
void
tFreeSMAltertbReq
(
SMAltertbReq
*
pReq
)
{
void
tFreeSMAltertbReq
(
SMAlter
S
tbReq
*
pReq
)
{
taosArrayDestroy
(
pReq
->
pFields
);
pReq
->
pFields
=
NULL
;
}
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
073745c8
...
...
@@ -831,7 +831,7 @@ static int32_t mndProcessVCreateStbRsp(SNodeMsg *pRsp) {
return
0
;
}
static
int32_t
mndCheckAlterStbReq
(
SMAltertbReq
*
pAlter
)
{
static
int32_t
mndCheckAlterStbReq
(
SMAlter
S
tbReq
*
pAlter
)
{
if
(
pAlter
->
numOfFields
<
1
||
pAlter
->
numOfFields
!=
(
int32_t
)
taosArrayGetSize
(
pAlter
->
pFields
))
{
terrno
=
TSDB_CODE_MND_INVALID_STB_OPTION
;
return
-
1
;
...
...
@@ -1182,7 +1182,7 @@ static int32_t mndSetAlterStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
return
0
;
}
static
int32_t
mndAlterStb
(
SMnode
*
pMnode
,
SNodeMsg
*
pReq
,
const
SMAltertbReq
*
pAlter
,
SDbObj
*
pDb
,
SStbObj
*
pOld
)
{
static
int32_t
mndAlterStb
(
SMnode
*
pMnode
,
SNodeMsg
*
pReq
,
const
SMAlter
S
tbReq
*
pAlter
,
SDbObj
*
pDb
,
SStbObj
*
pOld
)
{
SStbObj
stbObj
=
{
0
};
taosRLockLatch
(
&
pOld
->
lock
);
memcpy
(
&
stbObj
,
pOld
,
sizeof
(
SStbObj
));
...
...
@@ -1246,12 +1246,12 @@ _OVER:
}
static
int32_t
mndProcessMAlterStbReq
(
SNodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pNode
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SStbObj
*
pStb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMAltertbReq
alterReq
=
{
0
};
SMnode
*
pMnode
=
pReq
->
pNode
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SStbObj
*
pStb
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SMAlter
S
tbReq
alterReq
=
{
0
};
if
(
tDeserializeSMAlterStbReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
alterReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
...
...
source/dnode/mnode/impl/test/stb/stb.cpp
浏览文件 @
073745c8
...
...
@@ -137,7 +137,7 @@ void* MndTestStb::BuildCreateStbReq(const char* stbname, int32_t* pContLen) {
}
void
*
MndTestStb
::
BuildAlterStbAddTagReq
(
const
char
*
stbname
,
const
char
*
tagname
,
int32_t
*
pContLen
)
{
SMAltertbReq
req
=
{
0
};
SMAlter
S
tbReq
req
=
{
0
};
strcpy
(
req
.
name
,
stbname
);
req
.
numOfFields
=
1
;
req
.
pFields
=
taosArrayInit
(
1
,
sizeof
(
SField
));
...
...
@@ -158,7 +158,7 @@ void* MndTestStb::BuildAlterStbAddTagReq(const char* stbname, const char* tagnam
}
void
*
MndTestStb
::
BuildAlterStbDropTagReq
(
const
char
*
stbname
,
const
char
*
tagname
,
int32_t
*
pContLen
)
{
SMAltertbReq
req
=
{
0
};
SMAlter
S
tbReq
req
=
{
0
};
strcpy
(
req
.
name
,
stbname
);
req
.
numOfFields
=
1
;
req
.
pFields
=
taosArrayInit
(
1
,
sizeof
(
SField
));
...
...
@@ -180,7 +180,7 @@ void* MndTestStb::BuildAlterStbDropTagReq(const char* stbname, const char* tagna
void
*
MndTestStb
::
BuildAlterStbUpdateTagNameReq
(
const
char
*
stbname
,
const
char
*
tagname
,
const
char
*
newtagname
,
int32_t
*
pContLen
)
{
SMAltertbReq
req
=
{
0
};
SMAlter
S
tbReq
req
=
{
0
};
strcpy
(
req
.
name
,
stbname
);
req
.
numOfFields
=
2
;
req
.
pFields
=
taosArrayInit
(
2
,
sizeof
(
SField
));
...
...
@@ -208,7 +208,7 @@ void* MndTestStb::BuildAlterStbUpdateTagNameReq(const char* stbname, const char*
void
*
MndTestStb
::
BuildAlterStbUpdateTagBytesReq
(
const
char
*
stbname
,
const
char
*
tagname
,
int32_t
bytes
,
int32_t
*
pContLen
)
{
SMAltertbReq
req
=
{
0
};
SMAlter
S
tbReq
req
=
{
0
};
strcpy
(
req
.
name
,
stbname
);
req
.
numOfFields
=
1
;
req
.
pFields
=
taosArrayInit
(
1
,
sizeof
(
SField
));
...
...
@@ -229,7 +229,7 @@ void* MndTestStb::BuildAlterStbUpdateTagBytesReq(const char* stbname, const char
}
void
*
MndTestStb
::
BuildAlterStbAddColumnReq
(
const
char
*
stbname
,
const
char
*
colname
,
int32_t
*
pContLen
)
{
SMAltertbReq
req
=
{
0
};
SMAlter
S
tbReq
req
=
{
0
};
strcpy
(
req
.
name
,
stbname
);
req
.
numOfFields
=
1
;
req
.
pFields
=
taosArrayInit
(
1
,
sizeof
(
SField
));
...
...
@@ -250,7 +250,7 @@ void* MndTestStb::BuildAlterStbAddColumnReq(const char* stbname, const char* col
}
void
*
MndTestStb
::
BuildAlterStbDropColumnReq
(
const
char
*
stbname
,
const
char
*
colname
,
int32_t
*
pContLen
)
{
SMAltertbReq
req
=
{
0
};
SMAlter
S
tbReq
req
=
{
0
};
strcpy
(
req
.
name
,
stbname
);
req
.
numOfFields
=
1
;
req
.
pFields
=
taosArrayInit
(
1
,
sizeof
(
SField
));
...
...
@@ -272,7 +272,7 @@ void* MndTestStb::BuildAlterStbDropColumnReq(const char* stbname, const char* co
void
*
MndTestStb
::
BuildAlterStbUpdateColumnBytesReq
(
const
char
*
stbname
,
const
char
*
colname
,
int32_t
bytes
,
int32_t
*
pContLen
)
{
SMAltertbReq
req
=
{
0
};
SMAlter
S
tbReq
req
=
{
0
};
strcpy
(
req
.
name
,
stbname
);
req
.
numOfFields
=
1
;
req
.
pFields
=
taosArrayInit
(
1
,
sizeof
(
SField
));
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
073745c8
...
...
@@ -2596,7 +2596,7 @@ static int32_t translateDropSuperTable(STranslateContext* pCxt, SDropSuperTableS
pStmt
->
ignoreNotExists
);
}
static
int32_t
setAlterTableField
(
SAlterTableStmt
*
pStmt
,
SMAltertbReq
*
pAlterReq
)
{
static
int32_t
setAlterTableField
(
SAlterTableStmt
*
pStmt
,
SMAlter
S
tbReq
*
pAlterReq
)
{
pAlterReq
->
pFields
=
taosArrayInit
(
2
,
sizeof
(
TAOS_FIELD
));
if
(
NULL
==
pAlterReq
->
pFields
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -2632,8 +2632,8 @@ static int32_t setAlterTableField(SAlterTableStmt* pStmt, SMAltertbReq* pAlterRe
}
static
int32_t
translateAlterTable
(
STranslateContext
*
pCxt
,
SAlterTableStmt
*
pStmt
)
{
SMAltertbReq
alterReq
=
{
0
};
SName
tableName
;
SMAlter
S
tbReq
alterReq
=
{
0
};
SName
tableName
;
tNameExtractFullName
(
toName
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
pStmt
->
tableName
,
&
tableName
),
alterReq
.
name
);
alterReq
.
alterType
=
pStmt
->
alterType
;
alterReq
.
numOfFields
=
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录