Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
40728d1b
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看板
提交
40728d1b
编写于
11月 11, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1949
上级
59b25a96
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
31 addition
and
22 deletion
+31
-22
src/inc/twal.h
src/inc/twal.h
+11
-10
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+2
-1
src/wal/src/walMgmt.c
src/wal/src/walMgmt.c
+1
-10
src/wal/src/walWrite.c
src/wal/src/walWrite.c
+17
-1
未找到文件。
src/inc/twal.h
浏览文件 @
40728d1b
...
...
@@ -54,16 +54,17 @@ typedef int32_t FWalWrite(void *ahandle, void *pHead, int32_t qtype, void *pMsg)
int32_t
walInit
();
void
walCleanUp
();
twalh
walOpen
(
char
*
path
,
SWalCfg
*
pCfg
);
int32_t
walAlter
(
twalh
pWal
,
SWalCfg
*
pCfg
);
void
walStop
(
twalh
);
void
walClose
(
twalh
);
int32_t
walRenew
(
twalh
);
void
walRemoveOldFiles
(
twalh
);
int32_t
walWrite
(
twalh
,
SWalHead
*
);
void
walFsync
(
twalh
,
bool
forceFsync
);
int32_t
walRestore
(
twalh
,
void
*
pVnode
,
FWalWrite
writeFp
);
int32_t
walGetWalFile
(
twalh
,
char
*
fileName
,
int64_t
*
fileId
);
twalh
walOpen
(
char
*
path
,
SWalCfg
*
pCfg
);
int32_t
walAlter
(
twalh
pWal
,
SWalCfg
*
pCfg
);
void
walStop
(
twalh
);
void
walClose
(
twalh
);
int32_t
walRenew
(
twalh
);
void
walRemoveOneOldFile
(
twalh
);
void
walRemoveAllOldFiles
(
twalh
);
int32_t
walWrite
(
twalh
,
SWalHead
*
);
void
walFsync
(
twalh
,
bool
forceFsync
);
int32_t
walRestore
(
twalh
,
void
*
pVnode
,
FWalWrite
writeFp
);
int32_t
walGetWalFile
(
twalh
,
char
*
fileName
,
int64_t
*
fileId
);
uint64_t
walGetVersion
(
twalh
);
#ifdef __cplusplus
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
40728d1b
...
...
@@ -318,6 +318,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) {
}
tsdbSyncCommit
(
pVnode
->
tsdb
);
walRemoveAllOldFiles
(
pVnode
->
tsdb
);
walRenew
(
pVnode
->
wal
);
SSyncInfo
syncInfo
;
...
...
@@ -593,7 +594,7 @@ static int vnodeProcessTsdbStatus(void *arg, int status) {
if
(
status
==
TSDB_STATUS_COMMIT_OVER
)
{
vDebug
(
"vgId:%d, commit over, fver:%"
PRIu64
" vver:%"
PRIu64
,
pVnode
->
vgId
,
pVnode
->
fversion
,
pVnode
->
version
);
walRemoveO
ldFiles
(
pVnode
->
wal
);
walRemoveO
neOldFile
(
pVnode
->
wal
);
return
vnodeSaveVersion
(
pVnode
);
}
...
...
src/wal/src/walMgmt.c
浏览文件 @
40728d1b
...
...
@@ -128,16 +128,7 @@ void walClose(void *handle) {
taosClose
(
pWal
->
fd
);
if
(
pWal
->
keep
!=
TAOS_WAL_KEEP
)
{
int64_t
fileId
=
-
1
;
while
(
walGetNextFile
(
pWal
,
&
fileId
)
>=
0
)
{
snprintf
(
pWal
->
name
,
sizeof
(
pWal
->
name
),
"%s/%s%"
PRId64
,
pWal
->
path
,
WAL_PREFIX
,
fileId
);
if
(
remove
(
pWal
->
name
)
<
0
)
{
wError
(
"vgId:%d, wal:%p file:%s, failed to remove"
,
pWal
->
vgId
,
pWal
,
pWal
->
name
);
}
else
{
wInfo
(
"vgId:%d, wal:%p file:%s, it is removed"
,
pWal
->
vgId
,
pWal
,
pWal
->
name
);
}
}
walRemoveAllOldFiles
(
pWal
);
}
else
{
wDebug
(
"vgId:%d, wal:%p file:%s, it is closed and kept"
,
pWal
->
vgId
,
pWal
,
pWal
->
name
);
}
...
...
src/wal/src/walWrite.c
浏览文件 @
40728d1b
...
...
@@ -63,7 +63,7 @@ int32_t walRenew(void *handle) {
return
code
;
}
void
walRemoveO
ldFiles
(
void
*
handle
)
{
void
walRemoveO
neOldFile
(
void
*
handle
)
{
SWal
*
pWal
=
handle
;
if
(
pWal
==
NULL
)
return
;
if
(
pWal
->
keep
==
TAOS_WAL_KEEP
)
return
;
...
...
@@ -86,6 +86,22 @@ void walRemoveOldFiles(void *handle) {
pthread_mutex_unlock
(
&
pWal
->
mutex
);
}
void
walRemoveAllOldFiles
(
void
*
handle
)
{
if
(
handle
==
NULL
)
return
;
SWal
*
pWal
=
handle
;
int64_t
fileId
=
-
1
;
while
(
walGetNextFile
(
pWal
,
&
fileId
)
>=
0
)
{
snprintf
(
pWal
->
name
,
sizeof
(
pWal
->
name
),
"%s/%s%"
PRId64
,
pWal
->
path
,
WAL_PREFIX
,
fileId
);
if
(
remove
(
pWal
->
name
)
<
0
)
{
wError
(
"vgId:%d, wal:%p file:%s, failed to remove"
,
pWal
->
vgId
,
pWal
,
pWal
->
name
);
}
else
{
wInfo
(
"vgId:%d, wal:%p file:%s, it is removed"
,
pWal
->
vgId
,
pWal
,
pWal
->
name
);
}
}
}
int32_t
walWrite
(
void
*
handle
,
SWalHead
*
pHead
)
{
if
(
handle
==
NULL
)
return
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录