Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1d33a8d4
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
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看板
You need to sign in or sign up before continuing.
提交
1d33a8d4
编写于
8月 14, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rebuild index at tag0
上级
cf9f9ab4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
35 addition
and
8 deletion
+35
-8
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+35
-8
未找到文件。
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
1d33a8d4
...
...
@@ -18,6 +18,7 @@
#include "mndDb.h"
#include "mndDnode.h"
#include "mndIndex.h"
#include "mndIndexComm.h"
#include "mndInfoSchema.h"
#include "mndMnode.h"
#include "mndPerfSchema.h"
...
...
@@ -822,7 +823,7 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat
return
-
1
;
}
if
(
pDst
->
nextColId
<
0
||
pDst
->
nextColId
>=
0x7fff
-
pDst
->
numOfColumns
-
pDst
->
numOfTags
)
{
if
(
pDst
->
nextColId
<
0
||
pDst
->
nextColId
>=
0x7fff
-
pDst
->
numOfColumns
-
pDst
->
numOfTags
)
{
terrno
=
TSDB_CODE_MND_FIELD_VALUE_OVERFLOW
;
return
-
1
;
}
...
...
@@ -857,11 +858,36 @@ static int32_t mndCreateStb(SMnode *pMnode, SRpcMsg *pReq, SMCreateStbReq *pCrea
SStbObj
stbObj
=
{
0
};
int32_t
code
=
-
1
;
char
fullIdxName
[
TSDB_INDEX_FNAME_LEN
*
2
]
=
{
0
};
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_CONFLICT_DB_INSIDE
,
pReq
,
"create-stb"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
mInfo
(
"trans:%d, used to create stb:%s"
,
pTrans
->
id
,
pCreate
->
name
);
if
(
mndBuildStbFromReq
(
pMnode
,
&
stbObj
,
pCreate
,
pDb
)
!=
0
)
goto
_OVER
;
SSchema
*
pSchema
=
&
(
stbObj
.
pTags
[
0
]);
sprintf
(
fullIdxName
,
"%s.%s_default"
,
pDb
->
name
,
pSchema
->
name
);
SSIdx
idx
=
{
0
};
if
(
mndAcquireGlobalIdx
(
pMnode
,
fullIdxName
,
SDB_IDX
,
&
idx
)
==
0
)
{
terrno
=
TSDB_CODE_MND_TAG_INDEX_ALREADY_EXIST
;
mndReleaseIdx
(
pMnode
,
idx
.
pIdx
);
goto
_OVER
;
}
SIdxObj
idxObj
;
memcpy
(
idxObj
.
name
,
fullIdxName
,
TSDB_INDEX_FNAME_LEN
);
memcpy
(
idxObj
.
stb
,
stbObj
.
name
,
TSDB_TABLE_FNAME_LEN
);
memcpy
(
idxObj
.
db
,
stbObj
.
db
,
TSDB_DB_FNAME_LEN
);
memcpy
(
idxObj
.
colName
,
pSchema
->
name
,
TSDB_COL_NAME_LEN
);
idxObj
.
createdTime
=
taosGetTimestampMs
();
idxObj
.
uid
=
mndGenerateUid
(
fullIdxName
,
strlen
(
fullIdxName
));
idxObj
.
stbUid
=
stbObj
.
uid
;
idxObj
.
dbUid
=
stbObj
.
dbUid
;
if
(
mndSetCreateIdxCommitLogs
(
pMnode
,
pTrans
,
&
idxObj
)
<
0
)
goto
_OVER
;
if
(
mndAddStbToTrans
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
<
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
code
=
0
;
...
...
@@ -956,7 +982,7 @@ static int32_t mndBuildStbFromAlter(SStbObj *pStb, SStbObj *pDst, SMCreateStbReq
return
-
1
;
}
if
(
pDst
->
nextColId
<
0
||
pDst
->
nextColId
>=
0x7fff
-
pDst
->
numOfColumns
-
pDst
->
numOfTags
)
{
if
(
pDst
->
nextColId
<
0
||
pDst
->
nextColId
>=
0x7fff
-
pDst
->
numOfColumns
-
pDst
->
numOfTags
)
{
terrno
=
TSDB_CODE_MND_FIELD_VALUE_OVERFLOW
;
return
-
1
;
}
...
...
@@ -1188,7 +1214,7 @@ static int32_t mndAddSuperTableTag(const SStbObj *pOld, SStbObj *pNew, SArray *p
return
-
1
;
}
if
(
pNew
->
nextColId
<
0
||
pNew
->
nextColId
>=
0x7fff
-
ntags
)
{
if
(
pNew
->
nextColId
<
0
||
pNew
->
nextColId
>=
0x7fff
-
ntags
)
{
terrno
=
TSDB_CODE_MND_FIELD_VALUE_OVERFLOW
;
return
-
1
;
}
...
...
@@ -1478,7 +1504,8 @@ static int32_t mndAlterStbTagBytes(SMnode *pMnode, const SStbObj *pOld, SStbObj
SSchema
*
pTag
=
pNew
->
pTags
+
tag
;
if
(
!
(
pTag
->
type
==
TSDB_DATA_TYPE_BINARY
||
pTag
->
type
==
TSDB_DATA_TYPE_NCHAR
||
pTag
->
type
==
TSDB_DATA_TYPE_GEOMETRY
))
{
if
(
!
(
pTag
->
type
==
TSDB_DATA_TYPE_BINARY
||
pTag
->
type
==
TSDB_DATA_TYPE_NCHAR
||
pTag
->
type
==
TSDB_DATA_TYPE_GEOMETRY
))
{
terrno
=
TSDB_CODE_MND_INVALID_STB_OPTION
;
return
-
1
;
}
...
...
@@ -1506,7 +1533,7 @@ static int32_t mndAddSuperTableColumn(const SStbObj *pOld, SStbObj *pNew, SArray
return
-
1
;
}
if
(
pNew
->
nextColId
<
0
||
pNew
->
nextColId
>=
0x7fff
-
ncols
)
{
if
(
pNew
->
nextColId
<
0
||
pNew
->
nextColId
>=
0x7fff
-
ncols
)
{
terrno
=
TSDB_CODE_MND_FIELD_VALUE_OVERFLOW
;
return
-
1
;
}
...
...
@@ -1598,7 +1625,8 @@ static int32_t mndAlterStbColumnBytes(SMnode *pMnode, const SStbObj *pOld, SStbO
}
SSchema
*
pCol
=
pNew
->
pColumns
+
col
;
if
(
!
(
pCol
->
type
==
TSDB_DATA_TYPE_BINARY
||
pCol
->
type
==
TSDB_DATA_TYPE_NCHAR
||
pCol
->
type
==
TSDB_DATA_TYPE_GEOMETRY
))
{
if
(
!
(
pCol
->
type
==
TSDB_DATA_TYPE_BINARY
||
pCol
->
type
==
TSDB_DATA_TYPE_NCHAR
||
pCol
->
type
==
TSDB_DATA_TYPE_GEOMETRY
))
{
terrno
=
TSDB_CODE_MND_INVALID_STB_OPTION
;
return
-
1
;
}
...
...
@@ -3182,7 +3210,6 @@ static int32_t mndRetrieveStbCol(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SStbObj
*
pStb
=
NULL
;
int32_t
numOfRows
=
0
;
if
(
!
pShow
->
sysDbRsp
)
{
numOfRows
=
buildSysDbColsInfo
(
pBlock
,
pShow
->
db
,
pShow
->
filterTb
);
...
...
@@ -3206,7 +3233,7 @@ static int32_t mndRetrieveStbCol(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
if
(
pShow
->
pIter
==
NULL
)
break
;
}
else
{
fetch
=
true
;
void
*
pKey
=
taosHashGetKey
(
pShow
->
pIter
,
NULL
);
void
*
pKey
=
taosHashGetKey
(
pShow
->
pIter
,
NULL
);
pStb
=
sdbAcquire
(
pSdb
,
SDB_STB
,
pKey
);
if
(
!
pStb
)
continue
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录