Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f19d64e0
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f19d64e0
编写于
2月 04, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
opt drop index
上级
db61fbb6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
81 addition
and
6 deletion
+81
-6
include/common/tmsg.h
include/common/tmsg.h
+11
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+38
-0
source/dnode/mnode/impl/src/mndIndex.c
source/dnode/mnode/impl/src/mndIndex.c
+32
-6
未找到文件。
include/common/tmsg.h
浏览文件 @
f19d64e0
...
...
@@ -1249,6 +1249,17 @@ typedef struct {
int32_t
tSerializeSDropVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropVnodeReq
*
pReq
);
int32_t
tDeserializeSDropVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropVnodeReq
*
pReq
);
typedef
struct
{
char
colName
[
TSDB_COL_NAME_LEN
];
char
stb
[
TSDB_TABLE_FNAME_LEN
];
int64_t
stbUid
;
int64_t
dbUid
;
int64_t
reserved
[
8
];
}
SDropIndexReq
;
int32_t
tSerializeSDropIdxReq
(
void
*
buf
,
int32_t
bufLen
,
SDropIndexReq
*
pReq
);
int32_t
tDeserializeSDropIdxReq
(
void
*
buf
,
int32_t
bufLen
,
SDropIndexReq
*
pReq
);
typedef
struct
{
int64_t
dbUid
;
char
db
[
TSDB_DB_FNAME_LEN
];
...
...
source/common/src/tmsg.c
浏览文件 @
f19d64e0
...
...
@@ -4042,6 +4042,44 @@ int32_t tDeserializeSDropVnodeReq(void *buf, int32_t bufLen, SDropVnodeReq *pReq
tDecoderClear
(
&
decoder
);
return
0
;
}
int32_t
tSerializeSDropIdxReq
(
void
*
buf
,
int32_t
bufLen
,
SDropIndexReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
colName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
stb
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
stbUid
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
dbUid
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
8
;
++
i
)
{
if
(
tEncodeI64
(
&
encoder
,
pReq
->
reserved
[
i
])
<
0
)
return
-
1
;
}
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tEncoderClear
(
&
encoder
);
return
tlen
;
// TODO
return
0
;
}
int32_t
tDeserializeSDropIdxReq
(
void
*
buf
,
int32_t
bufLen
,
SDropIndexReq
*
pReq
)
{
SDecoder
decoder
=
{
0
};
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
colName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
stb
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
stbUid
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
dbUid
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
8
;
++
i
)
{
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
reserved
[
i
])
<
0
)
return
-
1
;
}
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
// TODO
return
0
;
}
int32_t
tSerializeSCompactVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactVnodeReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
...
...
source/dnode/mnode/impl/src/mndIndex.c
浏览文件 @
f19d64e0
...
...
@@ -122,6 +122,30 @@ int mndSetCreateIdxRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStb
return
0
;
}
static
void
*
mndBuildDropIdxReq
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SStbObj
*
pStbObj
,
SIdxObj
*
pIdx
,
int32_t
*
contLen
)
{
// TODO
SDropIndexReq
req
=
{
0
};
memcpy
(
req
.
colName
,
pIdx
->
colName
,
sizeof
(
pIdx
->
colName
));
memcpy
(
req
.
stb
,
pIdx
->
stb
,
sizeof
(
pIdx
->
stb
));
req
.
dbUid
=
pIdx
->
dbUid
;
req
.
stbUid
=
pIdx
->
stbUid
;
mInfo
(
"idx: %s start to build drop index req"
,
pIdx
->
name
);
int32_t
len
=
tSerializeSDropIdxReq
(
NULL
,
0
,
&
req
);
if
(
len
<
0
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
}
void
*
pCont
=
taosMemoryCalloc
(
1
,
len
);
if
(
pCont
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
}
tSerializeSDropIdxReq
(
pCont
,
len
,
&
req
);
*
contLen
=
len
;
return
pCont
;
}
int
mndSetDropIdxRedoActions
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SStbObj
*
pStb
,
SIdxObj
*
pIdx
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SVgObj
*
pVgroup
=
NULL
;
...
...
@@ -136,7 +160,8 @@ int mndSetDropIdxRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbOb
continue
;
}
void
*
pReq
=
mndBuildVCreateStbReq
(
pMnode
,
pVgroup
,
pStb
,
&
contLen
,
NULL
,
0
);
int32_t
len
;
void
*
pReq
=
mndBuildDropIdxReq
(
pMnode
,
pVgroup
,
pStb
,
pIdx
,
&
len
);
if
(
pReq
==
NULL
)
{
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pVgroup
);
...
...
@@ -145,7 +170,7 @@ int mndSetDropIdxRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbOb
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetVgroupEpset
(
pMnode
,
pVgroup
);
action
.
pCont
=
pReq
;
action
.
contLen
=
contL
en
;
action
.
contLen
=
l
en
;
action
.
msgType
=
TDMT_VND_DROP_INDEX
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
taosMemoryFree
(
pReq
);
...
...
@@ -802,21 +827,21 @@ static int32_t mndDropIdx(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SIdxObj *p
if
(
mndSetDropIdxCommitLogs
(
pMnode
,
pTrans
,
pIdx
)
!=
0
)
goto
_OVER
;
if
(
mndSetUpdateIdxStbCommitLogs
(
pMnode
,
pTrans
,
pStb
,
&
newObj
,
pIdx
->
colName
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropIdxRedoActions
(
pMnode
,
pTrans
,
p
St
b
,
&
newObj
,
pIdx
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropIdxRedoActions
(
pMnode
,
pTrans
,
p
D
b
,
&
newObj
,
pIdx
)
!=
0
)
goto
_OVER
;
_OVER:
mndTransDrop
(
pTrans
);
mndReleaseStb
(
pMnode
,
pStb
);
return
code
;
}
static
int32_t
mndProcessDropIdxReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SDbObj
*
pDb
=
NULL
;
SIdxObj
*
pIdx
=
NULL
;
SDropTagIndexReq
req
=
{
0
};
if
(
tDeserializeSDropTagIdxReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropR
eq
)
!=
0
)
{
if
(
tDeserializeSDropTagIdxReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
r
eq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
...
...
@@ -834,7 +859,7 @@ static int32_t mndProcessDropIdxReq(SRpcMsg *pReq) {
}
}
pDb
=
mndAcquireDbByIdx
(
pMnode
,
dropR
eq
.
name
);
pDb
=
mndAcquireDbByIdx
(
pMnode
,
r
eq
.
name
);
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_SELECTED
;
goto
_OVER
;
...
...
@@ -852,6 +877,7 @@ _OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_ACTION_IN_PROGRESS
)
{
mError
(
"idx:%s, failed to drop since %s"
,
req
.
name
,
terrstr
());
}
return
code
;
}
static
int32_t
mndProcessGetIdxReq
(
SRpcMsg
*
pReq
)
{
// do nothing
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录