Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d319d6fe
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d319d6fe
编写于
2月 28, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more compact to enterprise
上级
10531d40
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
13 addition
and
802 deletion
+13
-802
source/dnode/vnode/CMakeLists.txt
source/dnode/vnode/CMakeLists.txt
+6
-3
source/dnode/vnode/src/inc/vnd.h
source/dnode/vnode/src/inc/vnd.h
+0
-4
source/dnode/vnode/src/tsdb/tsdbCompact.c
source/dnode/vnode/src/tsdb/tsdbCompact.c
+0
-664
source/dnode/vnode/src/vnd/vnodeCompact.c
source/dnode/vnode/src/vnd/vnodeCompact.c
+0
-120
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+7
-11
未找到文件。
source/dnode/vnode/CMakeLists.txt
浏览文件 @
d319d6fe
...
...
@@ -14,7 +14,6 @@ target_sources(
"src/vnd/vnodeSvr.c"
"src/vnd/vnodeSync.c"
"src/vnd/vnodeSnapshot.c"
"src/vnd/vnodeCompact.c"
"src/vnd/vnodeRetention.c"
# meta
...
...
@@ -53,7 +52,6 @@ target_sources(
"src/tsdb/tsdbCacheRead.c"
"src/tsdb/tsdbRetention.c"
"src/tsdb/tsdbDiskData.c"
"src/tsdb/tsdbCompact.c"
"src/tsdb/tsdbMergeTree.c"
"src/tsdb/tsdbDataIter.c"
...
...
@@ -72,7 +70,7 @@ target_sources(
target_include_directories
(
vnode
PUBLIC
"inc"
P
RIVATE
"src/inc"
P
UBLIC
"src/inc"
PUBLIC
"
${
TD_SOURCE_DIR
}
/include/libs/scalar"
)
target_link_libraries
(
...
...
@@ -99,6 +97,11 @@ IF (TD_GRANT)
TARGET_LINK_LIBRARIES
(
vnode PUBLIC grant
)
ENDIF
()
IF
(
TD_VNODE_PLUGINS
)
TARGET_LINK_LIBRARIES
(
vnode PUBLIC vnode_plugin
)
ENDIF
()
target_compile_definitions
(
vnode PUBLIC -DMETA_REFACT
)
if
(
${
BUILD_WITH_INVERTEDINDEX
}
)
...
...
source/dnode/vnode/src/inc/vnd.h
浏览文件 @
d319d6fe
...
...
@@ -106,10 +106,6 @@ int32_t vnodeSyncCommit(SVnode* pVnode);
int32_t
vnodeAsyncCommit
(
SVnode
*
pVnode
);
bool
vnodeShouldRollback
(
SVnode
*
pVnode
);
// vnodeCompact.c
int32_t
vnodeAsyncCompact
(
SVnode
*
pVnode
);
int32_t
vnodeSyncCompact
(
SVnode
*
pVnode
);
// vnodeSync.c
int32_t
vnodeSyncOpen
(
SVnode
*
pVnode
,
char
*
path
);
int32_t
vnodeSyncStart
(
SVnode
*
pVnode
);
...
...
source/dnode/vnode/src/tsdb/tsdbCompact.c
已删除
100644 → 0
浏览文件 @
10531d40
此差异已折叠。
点击以展开。
source/dnode/vnode/src/vnd/vnodeCompact.c
已删除
100644 → 0
浏览文件 @
10531d40
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "vnd.h"
extern
int32_t
tsdbCommitCompact
(
STsdb
*
pTsdb
);
static
int32_t
vnodeCompactTask
(
void
*
param
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
SCompactInfo
*
pInfo
=
(
SCompactInfo
*
)
param
;
SVnode
*
pVnode
=
pInfo
->
pVnode
;
// do compact
code
=
tsdbCompact
(
pInfo
->
pVnode
->
pTsdb
,
pInfo
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
// end compact
char
dir
[
TSDB_FILENAME_LEN
]
=
{
0
};
if
(
pVnode
->
pTfs
)
{
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s%s%s"
,
tfsGetPrimaryPath
(
pVnode
->
pTfs
),
TD_DIRSEP
,
pVnode
->
path
);
}
else
{
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s"
,
pVnode
->
path
);
}
vnodeCommitInfo
(
dir
);
tsdbCommitCompact
(
pVnode
->
pTsdb
);
_exit:
tsem_post
(
&
pInfo
->
pVnode
->
canCommit
);
taosMemoryFree
(
pInfo
);
return
code
;
}
static
int32_t
vnodePrepareCompact
(
SVnode
*
pVnode
,
SCompactInfo
*
pInfo
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
tsem_wait
(
&
pVnode
->
canCommit
);
pInfo
->
pVnode
=
pVnode
;
pInfo
->
flag
=
0
;
pInfo
->
commitID
=
++
pVnode
->
state
.
commitID
;
char
dir
[
TSDB_FILENAME_LEN
]
=
{
0
};
SVnodeInfo
info
=
{
0
};
if
(
pVnode
->
pTfs
)
{
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s%s%s"
,
tfsGetPrimaryPath
(
pVnode
->
pTfs
),
TD_DIRSEP
,
pVnode
->
path
);
}
else
{
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s"
,
pVnode
->
path
);
}
if
(
vnodeLoadInfo
(
dir
,
&
info
)
<
0
)
{
code
=
terrno
;
goto
_exit
;
}
info
.
state
.
commitID
=
pInfo
->
commitID
;
if
(
vnodeSaveInfo
(
dir
,
&
info
)
<
0
)
{
code
=
terrno
;
goto
_exit
;
}
_exit:
if
(
code
)
{
vError
(
"vgId:%d %s failed at line %d since %s, commit ID:%"
PRId64
,
TD_VID
(
pVnode
),
__func__
,
lino
,
tstrerror
(
code
),
pVnode
->
state
.
commitID
);
}
else
{
vDebug
(
"vgId:%d %s done, commit ID:%"
PRId64
,
TD_VID
(
pVnode
),
__func__
,
pVnode
->
state
.
commitID
);
}
return
code
;
}
int32_t
vnodeAsyncCompact
(
SVnode
*
pVnode
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
SCompactInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
*
pInfo
));
if
(
pInfo
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
vnodeAsyncCommit
(
pVnode
);
code
=
vnodePrepareCompact
(
pVnode
,
pInfo
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
vnodeScheduleTask
(
vnodeCompactTask
,
pInfo
);
_exit:
if
(
code
)
{
vError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
if
(
pInfo
)
taosMemoryFree
(
pInfo
);
}
else
{
vInfo
(
"vgId:%d %s done"
,
TD_VID
(
pVnode
),
__func__
);
}
return
code
;
}
int32_t
vnodeSyncCompact
(
SVnode
*
pVnode
)
{
vnodeAsyncCompact
(
pVnode
);
tsem_wait
(
&
pVnode
->
canCommit
);
tsem_post
(
&
pVnode
->
canCommit
);
return
0
;
}
\ No newline at end of file
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
d319d6fe
...
...
@@ -1641,17 +1641,13 @@ static int32_t vnodeProcessDropIndexReq(SVnode *pVnode, int64_t version, void *p
return
TSDB_CODE_SUCCESS
;
}
extern
int32_t
vnodeProcessCompactVnodeReqImpl
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
);
static
int32_t
vnodeProcessCompactVnodeReq
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
)
{
SCompactVnodeReq
req
=
{
0
};
if
(
tDeserializeSCompactVnodeReq
(
pReq
,
len
,
&
req
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
TSDB_CODE_INVALID_MSG
;
}
vInfo
(
"vgId:%d, compact msg will be processed, db:%s dbUid:%"
PRId64
" compactStartTime:%"
PRId64
,
TD_VID
(
pVnode
),
req
.
db
,
req
.
dbUid
,
req
.
compactStartTime
);
return
vnodeProcessCompactVnodeReqImpl
(
pVnode
,
version
,
pReq
,
len
,
pRsp
);
}
vnodeAsyncCompact
(
pVnode
);
vnodeBegin
(
pVnode
);
return
0
;
}
#ifndef TD_ENTERPRISE
int32_t
vnodeProcessCompactVnodeReqImpl
(
SVnode
*
pVnode
,
int64_t
version
,
void
*
pReq
,
int32_t
len
,
SRpcMsg
*
pRsp
)
{
return
0
;
}
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录