Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7e720269
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看板
提交
7e720269
编写于
1月 06, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update add/del tag index
上级
b1241e5e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
78 addition
and
2 deletion
+78
-2
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+42
-0
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+4
-0
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+8
-0
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+24
-2
未找到文件。
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
7e720269
...
...
@@ -1611,6 +1611,43 @@ static int32_t mndSetAlterStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
return
0
;
}
static
int32_t
mndSetAlterStbRedoActions2
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SStbObj
*
pStb
,
void
*
alterOriData
,
int32_t
alterOriDataLen
)
{
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
(
!
mndVgroupInDb
(
pVgroup
,
pDb
->
uid
))
{
sdbRelease
(
pSdb
,
pVgroup
);
continue
;
}
void
*
pReq
=
mndBuildVCreateStbReq
(
pMnode
,
pVgroup
,
pStb
,
&
contLen
,
alterOriData
,
alterOriDataLen
);
if
(
pReq
==
NULL
)
{
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pVgroup
);
return
-
1
;
}
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetVgroupEpset
(
pMnode
,
pVgroup
);
action
.
pCont
=
pReq
;
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_VND_CREATE_INDEX
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
taosMemoryFree
(
pReq
);
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pVgroup
);
return
-
1
;
}
sdbRelease
(
pSdb
,
pVgroup
);
}
return
0
;
}
static
int32_t
mndBuildStbSchemaImp
(
SDbObj
*
pDb
,
SStbObj
*
pStb
,
const
char
*
tbName
,
STableMetaRsp
*
pRsp
)
{
taosRLockLatch
(
&
pStb
->
lock
);
...
...
@@ -2639,6 +2676,11 @@ int32_t mndAddIndexImpl(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pSt
mndTransSetDbName
(
pTrans
,
pDb
->
name
,
pStb
->
name
);
if
(
mndTrancCheckConflict
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
if
(
mndSetAlterStbRedoLogs
(
pMnode
,
pTrans
,
pDb
,
pStb
)
!=
0
)
goto
_OVER
;
if
(
mndSetAlterStbCommitLogs
(
pMnode
,
pTrans
,
pDb
,
pStb
)
!=
0
)
goto
_OVER
;
if
(
mndSetAlterStbRedoActions2
(
pMnode
,
pTrans
,
pDb
,
pStb
,
alterOriData
,
alterOriDataLen
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
return
code
;
_OVER:
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
7e720269
...
...
@@ -128,6 +128,10 @@ int32_t metaGetTbTSchemaEx(SMeta* pMeta, tb_uid_t suid, tb_uid_t uid, in
int
metaGetTableEntryByName
(
SMetaReader
*
pReader
,
const
char
*
name
);
int
metaAlterCache
(
SMeta
*
pMeta
,
int32_t
nPage
);
int
metaAddIndexToSTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateStbReq
*
pReq
);
}
int
metaDropIndexFromSTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateStbReq
*
pReq
);
int64_t
metaGetTimeSeriesNum
(
SMeta
*
pMeta
);
SMCtbCursor
*
metaOpenCtbCursor
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int
lock
);
void
metaCloseCtbCursor
(
SMCtbCursor
*
pCtbCur
,
int
lock
);
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
7e720269
...
...
@@ -389,6 +389,14 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
tdbTbcClose
(
pUidIdxc
);
return
0
;
}
int
metaAddIndexToSTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateStbReq
*
pReq
)
{
// impl later
return
TSDB_CODE_SUCCESS
;
}
int
metaDropIndexFromSTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateStbReq
*
pReq
)
{
// impl later
return
TSDB_CODE_SUCCESS
;
}
int
metaCreateTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateTbReq
*
pReq
,
STableMetaRsp
**
pMetaRsp
)
{
SMetaEntry
me
=
{
0
};
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
7e720269
...
...
@@ -1427,8 +1427,30 @@ _err:
return
code
;
}
static
int32_t
vnodeProcessCreateIndexReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
)
{
// impl later
return
TSDB_CODE_SUCCESS
;
SVCreateStbReq
req
=
{
0
};
SDecoder
dc
=
{
0
};
pRsp
->
msgType
=
TDMT_VND_CREATE_INDEX_RSP
;
pRsp
->
code
=
TSDB_CODE_SUCCESS
;
pRsp
->
pCont
=
NULL
;
pRsp
->
contLen
=
0
;
tDecoderInit
(
&
dc
,
pReq
,
len
);
// decode req
if
(
tDecodeSVCreateStbReq
(
&
dc
,
&
req
)
<
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
tDecoderClear
(
&
dc
);
return
-
1
;
}
if
(
metaAddIndexToSTable
(
pVnode
->
pMeta
,
version
,
&
req
)
<
0
)
{
pRsp
->
code
=
terrno
;
goto
_err
;
}
tDecoderClear
(
&
dc
);
return
0
;
_err:
tDecoderClear
(
&
dc
);
return
-
1
;
}
static
int32_t
vnodeProcessDropIndexReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
)
{
// impl later
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录