Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
101e0bb1
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看板
提交
101e0bb1
编写于
11月 11, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1949
上级
6ea61b49
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
102 addition
and
15 deletion
+102
-15
src/inc/twal.h
src/inc/twal.h
+1
-0
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+1
-0
src/wal/src/walMgmt.c
src/wal/src/walMgmt.c
+1
-1
src/wal/src/walWrite.c
src/wal/src/walWrite.c
+22
-14
tests/script/general/wal/kill.sim
tests/script/general/wal/kill.sim
+77
-0
tests/script/general/wal/sync.sim
tests/script/general/wal/sync.sim
+0
-0
未找到文件。
src/inc/twal.h
浏览文件 @
101e0bb1
...
...
@@ -59,6 +59,7 @@ 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
);
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
101e0bb1
...
...
@@ -583,6 +583,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
);
walRemoveOldFiles
(
pVnode
->
wal
);
return
vnodeSaveVersion
(
pVnode
);
}
...
...
src/wal/src/walMgmt.c
浏览文件 @
101e0bb1
...
...
@@ -135,7 +135,7 @@ void walClose(void *handle) {
if
(
remove
(
pWal
->
name
)
<
0
)
{
wError
(
"vgId:%d, wal:%p file:%s, failed to remove"
,
pWal
->
vgId
,
pWal
,
pWal
->
name
);
}
else
{
w
Debug
(
"vgId:%d, wal:%p file:%s, it is removed"
,
pWal
->
vgId
,
pWal
,
pWal
->
name
);
w
Info
(
"vgId:%d, wal:%p file:%s, it is removed"
,
pWal
->
vgId
,
pWal
,
pWal
->
name
);
}
}
}
else
{
...
...
src/wal/src/walWrite.c
浏览文件 @
101e0bb1
...
...
@@ -58,24 +58,32 @@ int32_t walRenew(void *handle) {
wDebug
(
"vgId:%d, file:%s, it is created"
,
pWal
->
vgId
,
pWal
->
name
);
}
if
(
pWal
->
keep
!=
TAOS_WAL_KEEP
)
{
// remove the oldest wal file
int64_t
oldFileId
=
-
1
;
if
(
walGetOldFile
(
pWal
,
pWal
->
fileId
,
WAL_FILE_NUM
,
&
oldFileId
)
==
0
)
{
char
walName
[
WAL_FILE_LEN
]
=
{
0
};
snprintf
(
walName
,
sizeof
(
walName
),
"%s/%s%"
PRId64
,
pWal
->
path
,
WAL_PREFIX
,
oldFileId
);
if
(
remove
(
walName
)
<
0
)
{
wError
(
"vgId:%d, file:%s, failed to remove since %s"
,
pWal
->
vgId
,
walName
,
strerror
(
errno
));
}
else
{
wDebug
(
"vgId:%d, file:%s, it is removed"
,
pWal
->
vgId
,
walName
);
}
pthread_mutex_unlock
(
&
pWal
->
mutex
);
return
code
;
}
void
walRemoveOldFiles
(
void
*
handle
)
{
SWal
*
pWal
=
handle
;
if
(
pWal
==
NULL
)
return
;
if
(
pWal
->
keep
==
TAOS_WAL_KEEP
)
return
;
pthread_mutex_lock
(
&
pWal
->
mutex
);
// remove the oldest wal file
int64_t
oldFileId
=
-
1
;
if
(
walGetOldFile
(
pWal
,
pWal
->
fileId
,
WAL_FILE_NUM
,
&
oldFileId
)
==
0
)
{
char
walName
[
WAL_FILE_LEN
]
=
{
0
};
snprintf
(
walName
,
sizeof
(
walName
),
"%s/%s%"
PRId64
,
pWal
->
path
,
WAL_PREFIX
,
oldFileId
);
if
(
remove
(
walName
)
<
0
)
{
wError
(
"vgId:%d, file:%s, failed to remove since %s"
,
pWal
->
vgId
,
walName
,
strerror
(
errno
));
}
else
{
wInfo
(
"vgId:%d, file:%s, it is removed"
,
pWal
->
vgId
,
walName
);
}
}
pthread_mutex_unlock
(
&
pWal
->
mutex
);
return
code
;
}
int32_t
walWrite
(
void
*
handle
,
SWalHead
*
pHead
)
{
...
...
tests/script/general/wal/kill.sim
0 → 100644
浏览文件 @
101e0bb1
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
print ============== deploy
system sh/exec.sh -n dnode1 -s start
sleep 3001
sql connect
sql create database d1
sql use d1
sql create table t1 (ts timestamp, i int)
sql insert into t1 values(now, 1);
print =============== step3
sleep 3000
sql select * from t1;
print rows: $rows
if $rows != 1 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGKILL
sleep 3000
print =============== step4
system sh/exec.sh -n dnode1 -s start -x SIGKILL
sleep 3000
sql select * from t1;
print rows: $rows
if $rows != 1 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGKILL
sleep 3000
print =============== step5
system sh/exec.sh -n dnode1 -s start -x SIGKILL
sleep 3000
sql select * from t1;
print rows: $rows
if $rows != 1 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGKILL
sleep 3000
print =============== step6
system sh/exec.sh -n dnode1 -s start -x SIGKILL
sleep 3000
sql select * from t1;
print rows: $rows
if $rows != 1 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGKILL
sleep 3000
print =============== step7
system sh/exec.sh -n dnode1 -s start -x SIGKILL
sleep 3000
sql select * from t1;
print rows: $rows
if $rows != 1 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGKILL
sleep 3000
print =============== step8
system sh/exec.sh -n dnode1 -s start -x SIGKILL
sleep 3000
sql select * from t1;
print rows: $rows
if $rows != 1 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGKILL
tests/script/general/
http
/sync.sim
→
tests/script/general/
wal
/sync.sim
浏览文件 @
101e0bb1
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录