Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
45039b1c
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
45039b1c
编写于
11月 14, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
11月 14, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4220 from taosdata/feature/wal
TD-2087
上级
bbe468f7
4c56bf4e
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
17 addition
and
10 deletion
+17
-10
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+13
-2
src/wal/src/walMgmt.c
src/wal/src/walMgmt.c
+0
-8
src/wal/src/walWrite.c
src/wal/src/walWrite.c
+4
-0
未找到文件。
src/vnode/src/vnodeMain.c
浏览文件 @
45039b1c
...
@@ -315,7 +315,13 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) {
...
@@ -315,7 +315,13 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) {
pVnode
->
version
=
walGetVersion
(
pVnode
->
wal
);
pVnode
->
version
=
walGetVersion
(
pVnode
->
wal
);
}
}
tsdbSyncCommit
(
pVnode
->
tsdb
);
code
=
tsdbSyncCommit
(
pVnode
->
tsdb
);
if
(
code
!=
0
)
{
vError
(
"vgId:%d, failed to commit after restore from wal since %s"
,
pVnode
->
vgId
,
tstrerror
(
code
));
vnodeCleanUp
(
pVnode
);
return
code
;
}
walRemoveAllOldFiles
(
pVnode
->
wal
);
walRemoveAllOldFiles
(
pVnode
->
wal
);
walRenew
(
pVnode
->
wal
);
walRenew
(
pVnode
->
wal
);
...
@@ -412,6 +418,7 @@ void vnodeRelease(void *pVnodeRaw) {
...
@@ -412,6 +418,7 @@ void vnodeRelease(void *pVnodeRaw) {
}
}
if
(
pVnode
->
wal
)
{
if
(
pVnode
->
wal
)
{
walRemoveAllOldFiles
(
pVnode
->
wal
);
walClose
(
pVnode
->
wal
);
walClose
(
pVnode
->
wal
);
pVnode
->
wal
=
NULL
;
pVnode
->
wal
=
NULL
;
}
}
...
@@ -589,8 +596,12 @@ static int vnodeProcessTsdbStatus(void *arg, int status) {
...
@@ -589,8 +596,12 @@ static int vnodeProcessTsdbStatus(void *arg, int status) {
if
(
status
==
TSDB_STATUS_COMMIT_START
)
{
if
(
status
==
TSDB_STATUS_COMMIT_START
)
{
pVnode
->
fversion
=
pVnode
->
version
;
pVnode
->
fversion
=
pVnode
->
version
;
vDebug
(
"vgId:%d, start commit, fver:%"
PRIu64
" vver:%"
PRIu64
,
pVnode
->
vgId
,
pVnode
->
fversion
,
pVnode
->
version
);
vDebug
(
"vgId:%d, start commit, fver:%"
PRIu64
" vver:%"
PRIu64
,
pVnode
->
vgId
,
pVnode
->
fversion
,
pVnode
->
version
);
if
(
pVnode
->
status
==
TAOS_VN_STATUS_INIT
)
{
return
0
;
}
else
{
return
walRenew
(
pVnode
->
wal
);
return
walRenew
(
pVnode
->
wal
);
}
}
}
if
(
status
==
TSDB_STATUS_COMMIT_OVER
)
{
if
(
status
==
TSDB_STATUS_COMMIT_OVER
)
{
vDebug
(
"vgId:%d, commit over, fver:%"
PRIu64
" vver:%"
PRIu64
,
pVnode
->
vgId
,
pVnode
->
fversion
,
pVnode
->
version
);
vDebug
(
"vgId:%d, commit over, fver:%"
PRIu64
" vver:%"
PRIu64
,
pVnode
->
vgId
,
pVnode
->
fversion
,
pVnode
->
version
);
...
...
src/wal/src/walMgmt.c
浏览文件 @
45039b1c
...
@@ -124,15 +124,7 @@ void walClose(void *handle) {
...
@@ -124,15 +124,7 @@ void walClose(void *handle) {
SWal
*
pWal
=
handle
;
SWal
*
pWal
=
handle
;
pthread_mutex_lock
(
&
pWal
->
mutex
);
pthread_mutex_lock
(
&
pWal
->
mutex
);
taosClose
(
pWal
->
fd
);
taosClose
(
pWal
->
fd
);
if
(
pWal
->
keep
!=
TAOS_WAL_KEEP
)
{
walRemoveAllOldFiles
(
pWal
);
}
else
{
wDebug
(
"vgId:%d, wal:%p file:%s, it is closed and kept"
,
pWal
->
vgId
,
pWal
,
pWal
->
name
);
}
pthread_mutex_unlock
(
&
pWal
->
mutex
);
pthread_mutex_unlock
(
&
pWal
->
mutex
);
taosRemoveRef
(
tsWal
.
refId
,
pWal
->
rid
);
taosRemoveRef
(
tsWal
.
refId
,
pWal
->
rid
);
}
}
...
...
src/wal/src/walWrite.c
浏览文件 @
45039b1c
...
@@ -67,6 +67,7 @@ void walRemoveOneOldFile(void *handle) {
...
@@ -67,6 +67,7 @@ void walRemoveOneOldFile(void *handle) {
SWal
*
pWal
=
handle
;
SWal
*
pWal
=
handle
;
if
(
pWal
==
NULL
)
return
;
if
(
pWal
==
NULL
)
return
;
if
(
pWal
->
keep
==
TAOS_WAL_KEEP
)
return
;
if
(
pWal
->
keep
==
TAOS_WAL_KEEP
)
return
;
if
(
pWal
->
fd
<=
0
)
return
;
pthread_mutex_lock
(
&
pWal
->
mutex
);
pthread_mutex_lock
(
&
pWal
->
mutex
);
...
@@ -91,6 +92,8 @@ void walRemoveAllOldFiles(void *handle) {
...
@@ -91,6 +92,8 @@ void walRemoveAllOldFiles(void *handle) {
SWal
*
pWal
=
handle
;
SWal
*
pWal
=
handle
;
int64_t
fileId
=
-
1
;
int64_t
fileId
=
-
1
;
pthread_mutex_lock
(
&
pWal
->
mutex
);
while
(
walGetNextFile
(
pWal
,
&
fileId
)
>=
0
)
{
while
(
walGetNextFile
(
pWal
,
&
fileId
)
>=
0
)
{
snprintf
(
pWal
->
name
,
sizeof
(
pWal
->
name
),
"%s/%s%"
PRId64
,
pWal
->
path
,
WAL_PREFIX
,
fileId
);
snprintf
(
pWal
->
name
,
sizeof
(
pWal
->
name
),
"%s/%s%"
PRId64
,
pWal
->
path
,
WAL_PREFIX
,
fileId
);
...
@@ -100,6 +103,7 @@ void walRemoveAllOldFiles(void *handle) {
...
@@ -100,6 +103,7 @@ void walRemoveAllOldFiles(void *handle) {
wInfo
(
"vgId:%d, wal:%p file:%s, it is removed"
,
pWal
->
vgId
,
pWal
,
pWal
->
name
);
wInfo
(
"vgId:%d, wal:%p file:%s, it is removed"
,
pWal
->
vgId
,
pWal
,
pWal
->
name
);
}
}
}
}
pthread_mutex_unlock
(
&
pWal
->
mutex
);
}
}
int32_t
walWrite
(
void
*
handle
,
SWalHead
*
pHead
)
{
int32_t
walWrite
(
void
*
handle
,
SWalHead
*
pHead
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录