Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
510b5fce
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看板
提交
510b5fce
编写于
5月 26, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: use tagver and colver insteadof sversion
上级
b911b5ba
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
14 addition
and
22 deletion
+14
-22
include/common/tmsg.h
include/common/tmsg.h
+2
-1
source/common/src/tmsg.c
source/common/src/tmsg.c
+4
-2
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+0
-1
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+6
-16
source/dnode/mnode/impl/test/stb/stb.cpp
source/dnode/mnode/impl/test/stb/stb.cpp
+2
-1
tests/test/c/sdbDump.c
tests/test/c/sdbDump.c
+0
-1
未找到文件。
include/common/tmsg.h
浏览文件 @
510b5fce
...
...
@@ -455,7 +455,8 @@ int32_t tDeserializeSMDropStbReq(void* buf, int32_t bufLen, SMDropStbReq* pReq);
typedef
struct
{
char
name
[
TSDB_TABLE_FNAME_LEN
];
int8_t
alterType
;
int32_t
verInBlock
;
int32_t
tagVer
;
int32_t
colVer
;
int32_t
numOfFields
;
SArray
*
pFields
;
int32_t
ttl
;
...
...
source/common/src/tmsg.c
浏览文件 @
510b5fce
...
...
@@ -600,7 +600,8 @@ int32_t tSerializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq)
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
alterType
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
verInBlock
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
tagVer
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
colVer
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
numOfFields
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
pReq
->
numOfFields
;
++
i
)
{
SField
*
pField
=
taosArrayGet
(
pReq
->
pFields
,
i
);
...
...
@@ -627,7 +628,8 @@ int32_t tDeserializeSMAlterStbReq(void *buf, int32_t bufLen, SMAlterStbReq *pReq
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
alterType
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
verInBlock
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
tagVer
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
colVer
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
numOfFields
)
<
0
)
return
-
1
;
pReq
->
pFields
=
taosArrayInit
(
pReq
->
numOfFields
,
sizeof
(
SField
));
if
(
pReq
->
pFields
==
NULL
)
{
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
510b5fce
...
...
@@ -366,7 +366,6 @@ typedef struct {
int64_t
updateTime
;
int64_t
uid
;
int64_t
dbUid
;
int32_t
version
;
int32_t
tagVer
;
int32_t
colVer
;
int32_t
nextColId
;
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
510b5fce
...
...
@@ -87,7 +87,6 @@ SSdbRaw *mndStbActionEncode(SStbObj *pStb) {
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
->
tagVer
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
colVer
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pStb
->
nextColId
,
_OVER
)
...
...
@@ -167,7 +166,6 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) {
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
->
tagVer
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
colVer
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pStb
->
nextColId
,
_OVER
)
...
...
@@ -320,7 +318,6 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) {
}
pOld
->
updateTime
=
pNew
->
updateTime
;
pOld
->
version
=
pNew
->
version
;
pOld
->
tagVer
=
pNew
->
tagVer
;
pOld
->
colVer
=
pNew
->
colVer
;
pOld
->
nextColId
=
pNew
->
nextColId
;
...
...
@@ -390,7 +387,7 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt
req
.
rollup
=
pStb
->
ast1Len
>
0
?
1
:
0
;
// todo
req
.
schemaRow
.
nCols
=
pStb
->
numOfColumns
;
req
.
schemaRow
.
version
=
pStb
->
version
;
req
.
schemaRow
.
version
=
pStb
->
colVer
;
req
.
schemaRow
.
pSchema
=
pStb
->
pColumns
;
req
.
schemaTag
.
nCols
=
pStb
->
numOfTags
;
req
.
schemaTag
.
version
=
pStb
->
tagVer
;
...
...
@@ -665,7 +662,6 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat
pDst
->
updateTime
=
pDst
->
createdTime
;
pDst
->
uid
=
mndGenerateUid
(
pCreate
->
name
,
TSDB_TABLE_FNAME_LEN
);
pDst
->
dbUid
=
pDb
->
uid
;
pDst
->
version
=
1
;
pDst
->
tagVer
=
1
;
pDst
->
colVer
=
1
;
pDst
->
nextColId
=
1
;
...
...
@@ -957,7 +953,6 @@ static int32_t mndAddSuperTableTag(const SStbObj *pOld, SStbObj *pNew, SArray *p
mDebug
(
"stb:%s, start to add tag %s"
,
pNew
->
name
,
pSchema
->
name
);
}
pNew
->
version
++
;
pNew
->
tagVer
++
;
return
0
;
}
...
...
@@ -976,7 +971,6 @@ static int32_t mndDropSuperTableTag(const SStbObj *pOld, SStbObj *pNew, const ch
memmove
(
pNew
->
pTags
+
tag
,
pNew
->
pTags
+
tag
+
1
,
sizeof
(
SSchema
)
*
(
pNew
->
numOfTags
-
tag
-
1
));
pNew
->
numOfTags
--
;
pNew
->
version
++
;
pNew
->
tagVer
++
;
mDebug
(
"stb:%s, start to drop tag %s"
,
pNew
->
name
,
tagName
);
return
0
;
...
...
@@ -1017,7 +1011,6 @@ static int32_t mndAlterStbTagName(const SStbObj *pOld, SStbObj *pNew, SArray *pF
SSchema
*
pSchema
=
(
SSchema
*
)(
pNew
->
pTags
+
tag
);
memcpy
(
pSchema
->
name
,
newTagName
,
TSDB_COL_NAME_LEN
);
pNew
->
version
++
;
pNew
->
tagVer
++
;
mDebug
(
"stb:%s, start to modify tag %s to %s"
,
pNew
->
name
,
oldTagName
,
newTagName
);
return
0
;
...
...
@@ -1047,7 +1040,6 @@ static int32_t mndAlterStbTagBytes(const SStbObj *pOld, SStbObj *pNew, const SFi
}
pTag
->
bytes
=
pField
->
bytes
;
pNew
->
version
++
;
pNew
->
tagVer
++
;
mDebug
(
"stb:%s, start to modify tag len %s to %d"
,
pNew
->
name
,
pField
->
name
,
pField
->
bytes
);
...
...
@@ -1087,7 +1079,6 @@ static int32_t mndAddSuperTableColumn(const SStbObj *pOld, SStbObj *pNew, SArray
mDebug
(
"stb:%s, start to add column %s"
,
pNew
->
name
,
pSchema
->
name
);
}
pNew
->
version
++
;
pNew
->
colVer
++
;
return
0
;
}
...
...
@@ -1116,7 +1107,6 @@ static int32_t mndDropSuperTableColumn(const SStbObj *pOld, SStbObj *pNew, const
memmove
(
pNew
->
pColumns
+
col
,
pNew
->
pColumns
+
col
+
1
,
sizeof
(
SSchema
)
*
(
pNew
->
numOfColumns
-
col
-
1
));
pNew
->
numOfColumns
--
;
pNew
->
version
++
;
pNew
->
colVer
++
;
mDebug
(
"stb:%s, start to drop col %s"
,
pNew
->
name
,
colName
);
return
0
;
...
...
@@ -1155,7 +1145,6 @@ static int32_t mndAlterStbColumnBytes(const SStbObj *pOld, SStbObj *pNew, const
}
pCol
->
bytes
=
pField
->
bytes
;
pNew
->
version
++
;
pNew
->
colVer
++
;
mDebug
(
"stb:%s, start to modify col len %s to %d"
,
pNew
->
name
,
pField
->
name
,
pField
->
bytes
);
...
...
@@ -1316,9 +1305,10 @@ static int32_t mndProcessMAlterStbReq(SRpcMsg *pReq) {
goto
_OVER
;
}
if
(
alterReq
.
verInBlock
>
0
&&
alterReq
.
verInBlock
<=
pStb
->
version
)
{
mDebug
(
"stb:%s, already exist, verInBlock:%d smaller than verInStb:%d, alter success"
,
alterReq
.
name
,
alterReq
.
verInBlock
,
pStb
->
version
);
if
((
alterReq
.
tagVer
>
0
&&
alterReq
.
colVer
>
0
)
&&
(
alterReq
.
tagVer
<=
pStb
->
tagVer
||
alterReq
.
colVer
<=
pStb
->
colVer
))
{
mDebug
(
"stb:%s, already exist, tagVer:%d colVer:%d smaller than in mnode, tagVer:%d colVer:%d, alter success"
,
alterReq
.
name
,
alterReq
.
tagVer
,
alterReq
.
colVer
,
pStb
->
tagVer
,
pStb
->
colVer
);
code
=
0
;
goto
_OVER
;
}
...
...
@@ -1512,7 +1502,7 @@ static int32_t mndBuildStbSchemaImp(SDbObj *pDb, SStbObj *pStb, const char *tbNa
pRsp
->
numOfColumns
=
pStb
->
numOfColumns
;
pRsp
->
precision
=
pDb
->
cfg
.
precision
;
pRsp
->
tableType
=
TSDB_SUPER_TABLE
;
pRsp
->
sversion
=
pStb
->
version
;
pRsp
->
sversion
=
pStb
->
colVer
;
pRsp
->
suid
=
pStb
->
uid
;
pRsp
->
tuid
=
pStb
->
uid
;
...
...
source/dnode/mnode/impl/test/stb/stb.cpp
浏览文件 @
510b5fce
...
...
@@ -277,7 +277,8 @@ void* MndTestStb::BuildAlterStbUpdateColumnBytesReq(const char* stbname, const c
req
.
numOfFields
=
1
;
req
.
pFields
=
taosArrayInit
(
1
,
sizeof
(
SField
));
req
.
alterType
=
TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES
;
req
.
verInBlock
=
verInBlock
;
req
.
tagVer
=
verInBlock
;
req
.
colVer
=
verInBlock
;
SField
field
=
{
0
};
field
.
bytes
=
bytes
;
...
...
tests/test/c/sdbDump.c
浏览文件 @
510b5fce
...
...
@@ -110,7 +110,6 @@ void dumpStb(SSdb *pSdb, SJson *json) {
tjsonAddStringToObject
(
item
,
"updateTime"
,
i642str
(
pObj
->
updateTime
));
tjsonAddStringToObject
(
item
,
"uid"
,
i642str
(
pObj
->
uid
));
tjsonAddStringToObject
(
item
,
"dbUid"
,
i642str
(
pObj
->
dbUid
));
tjsonAddIntegerToObject
(
item
,
"version"
,
pObj
->
version
);
tjsonAddIntegerToObject
(
item
,
"tagVer"
,
pObj
->
tagVer
);
tjsonAddIntegerToObject
(
item
,
"colVer"
,
pObj
->
colVer
);
tjsonAddIntegerToObject
(
item
,
"nextColId"
,
pObj
->
nextColId
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录