Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
不争之德
oceanbase
提交
e5081695
O
oceanbase
项目概览
不争之德
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
e5081695
编写于
10月 03, 2022
作者:
O
obdev
提交者:
wangzelin.wzl
10月 03, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CP] fix losing slog problem
上级
053d54bc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
5 deletion
+16
-5
src/storage/blocksstable/slog/ob_storage_log_writer.cpp
src/storage/blocksstable/slog/ob_storage_log_writer.cpp
+11
-2
src/storage/blocksstable/slog/ob_storage_log_writer.h
src/storage/blocksstable/slog/ob_storage_log_writer.h
+5
-3
未找到文件。
src/storage/blocksstable/slog/ob_storage_log_writer.cpp
浏览文件 @
e5081695
...
...
@@ -256,7 +256,8 @@ ObStorageLogWriter::ObStorageLogWriter()
file_store_
(
nullptr
),
batch_write_buf_
(
nullptr
),
batch_write_len_
(
0
),
batch_limit_size_
(
0
)
batch_limit_size_
(
0
),
flush_seq_
(
0
)
{}
ObStorageLogWriter
::~
ObStorageLogWriter
()
...
...
@@ -346,6 +347,7 @@ void ObStorageLogWriter::destroy()
batch_write_buf_
=
nullptr
;
}
batch_write_len_
=
0
;
flush_seq_
=
0
;
is_started_
=
false
;
is_inited_
=
false
;
}
...
...
@@ -365,6 +367,7 @@ int ObStorageLogWriter::start_log(const ObLogCursor& start_cursor)
build_cursor_
=
start_cursor
;
write_cursor_
=
start_cursor
;
flush_cursor_
=
start_cursor
;
flush_seq_
=
start_cursor
.
log_id_
;
is_started_
=
true
;
LOG_INFO
(
"start log"
,
K
(
start_cursor
));
}
...
...
@@ -388,7 +391,7 @@ int ObStorageLogWriter::flush_log(
ObMutexGuard
guard
(
build_log_mutex_
);
if
(
OB_FAIL
(
get_log_item
(
cmd
,
log_buffer
,
log_item
)))
{
LOG_WARN
(
"get_log_item failed"
,
K
(
ret
),
K
(
cmd
),
K
(
log_buffer
));
}
else
if
(
OB_FAIL
(
append_log
(
*
log_item
)))
{
}
else
if
(
OB_FAIL
(
append_log
(
*
log_item
,
MAX_APPEND_WAIT_TIME_US
)))
{
LOG_WARN
(
"append_log failed"
,
K
(
ret
));
}
}
...
...
@@ -964,6 +967,12 @@ int ObStorageLogWriter::sync_log(common::ObIBaseLogItem** items, int64_t& sync_i
DEBUG_SYNC
(
BEFORE_SLOG_UPDATE_FLUSH_CURSOR
);
flush_cursor_
=
log_item
->
end_cursor_
;
}
if
(
OB_UNLIKELY
(
flush_seq_
!=
log_item
->
start_cursor_
.
log_id_
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_ERROR
(
"flush_seq_ doesn't match"
,
K
(
ret
),
K
(
flush_seq_
),
K
(
log_item
->
start_cursor_
));
}
else
{
flush_seq_
=
log_item
->
end_cursor_
.
log_id_
;
}
log_item
->
finish_flush
(
OB_SUCCESS
);
}
const
int64_t
duration
=
ObTimeUtility
::
fast_current_time
()
-
start_ts
;
...
...
src/storage/blocksstable/slog/ob_storage_log_writer.h
浏览文件 @
e5081695
...
...
@@ -75,9 +75,10 @@ private:
class
ObStorageLogWriter
:
public
common
::
ObBaseLogWriter
{
public:
static
const
int64_t
LOG_FILE_ALIGN_SIZE
=
4
*
1024
;
// 4KB
static
const
int64_t
LOG_BUF_RESERVED_SIZE
=
3
*
LOG_FILE_ALIGN_SIZE
;
// NOP + switch_log
static
const
int64_t
LOG_ITEM_MAX_LENGTH
=
32
<<
20
;
// 32MB
static
const
int64_t
LOG_FILE_ALIGN_SIZE
=
4
*
1024
;
// 4KB
static
const
int64_t
LOG_BUF_RESERVED_SIZE
=
3
*
LOG_FILE_ALIGN_SIZE
;
// NOP + switch_log
static
const
int64_t
LOG_ITEM_MAX_LENGTH
=
32
<<
20
;
// 32MB
static
const
int64_t
MAX_APPEND_WAIT_TIME_US
=
365
*
24
*
3600
*
1000000L
;
// 1year
ObStorageLogWriter
();
virtual
~
ObStorageLogWriter
();
...
...
@@ -223,6 +224,7 @@ private:
char
*
batch_write_buf_
;
int64_t
batch_write_len_
;
int64_t
batch_limit_size_
;
int64_t
flush_seq_
;
};
template
<
typename
T
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录