Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
aa15788e
O
oceanbase
项目概览
Metz
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
aa15788e
编写于
8月 20, 2021
作者:
Y
yy0
提交者:
wangzelin.wzl
8月 20, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix logic of Maximum continuous replayed log_id
上级
047132a3
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
23 addition
and
45 deletion
+23
-45
src/storage/ob_i_partition_group.h
src/storage/ob_i_partition_group.h
+0
-1
src/storage/ob_partition_group.cpp
src/storage/ob_partition_group.cpp
+8
-30
src/storage/ob_partition_group.h
src/storage/ob_partition_group.h
+0
-1
src/storage/ob_partition_loop_worker.cpp
src/storage/ob_partition_loop_worker.cpp
+9
-1
src/storage/ob_replay_status.cpp
src/storage/ob_replay_status.cpp
+6
-11
unittest/storage/mockcontainer/mock_ob_partition.h
unittest/storage/mockcontainer/mock_ob_partition.h
+0
-1
未找到文件。
src/storage/ob_i_partition_group.h
浏览文件 @
aa15788e
...
@@ -467,7 +467,6 @@ public:
...
@@ -467,7 +467,6 @@ public:
virtual
int
retire_warmup_store
(
const
bool
is_disk_full
)
=
0
;
virtual
int
retire_warmup_store
(
const
bool
is_disk_full
)
=
0
;
virtual
int
enable_write_log
(
const
bool
is_replay_old
)
=
0
;
virtual
int
enable_write_log
(
const
bool
is_replay_old
)
=
0
;
virtual
uint64_t
get_min_replayed_log_id
()
=
0
;
// Get the minimum log id that has been replayed continuously.
virtual
uint64_t
get_min_replayed_log_id
()
=
0
;
// Get the minimum log id that has been replayed continuously.
virtual
void
get_min_replayed_log
(
uint64_t
&
min_replay_log_id
,
int64_t
&
min_replay_log_ts
)
=
0
;
virtual
int
get_min_replayed_log_with_keepalive
(
uint64_t
&
min_replay_log_id
,
int64_t
&
min_replay_log_ts
)
=
0
;
virtual
int
get_min_replayed_log_with_keepalive
(
uint64_t
&
min_replay_log_id
,
int64_t
&
min_replay_log_ts
)
=
0
;
virtual
int
create_partition_group
(
const
ObCreatePGParam
&
param
)
=
0
;
virtual
int
create_partition_group
(
const
ObCreatePGParam
&
param
)
=
0
;
virtual
int
create_pg_partition
(
const
common
::
ObPartitionKey
&
pkey
,
const
int64_t
multi_version_start
,
virtual
int
create_pg_partition
(
const
common
::
ObPartitionKey
&
pkey
,
const
int64_t
multi_version_start
,
...
...
src/storage/ob_partition_group.cpp
浏览文件 @
aa15788e
...
@@ -5364,35 +5364,12 @@ uint64_t ObPartitionGroup::get_min_replayed_log_id()
...
@@ -5364,35 +5364,12 @@ uint64_t ObPartitionGroup::get_min_replayed_log_id()
uint64_t
min_replay_log_id
=
UINT64_MAX
;
uint64_t
min_replay_log_id
=
UINT64_MAX
;
int64_t
unused
=
0
;
int64_t
unused
=
0
;
get_min_replayed_log
(
min_replay_log_id
,
unused
);
get_min_replayed_log
_with_keepalive
(
min_replay_log_id
,
unused
);
return
min_replay_log_id
;
return
min_replay_log_id
;
}
}
void
ObPartitionGroup
::
get_min_replayed_log
(
uint64_t
&
min_replay_log_id
,
int64_t
&
min_replay_log_ts
)
int
ObPartitionGroup
::
get_min_replayed_log_with_keepalive
(
uint64_t
&
min_replay_log_id
,
int64_t
&
min_replay_log_ts
)
{
uint64_t
unreplay_log_id
=
UINT64_MAX
;
int64_t
unreplay_log_ts
=
0
;
uint64_t
last_replay_log_id
=
UINT64_MAX
;
int64_t
last_replay_log_ts
=
0
;
// 1. The left boundary of sliding window.
pls_
->
get_last_replay_log
(
last_replay_log_id
,
last_replay_log_ts
);
// 2. The minimum continuously replayed log of replay engine.
replay_status_
->
get_min_unreplay_log
(
unreplay_log_id
,
unreplay_log_ts
);
if
(
unreplay_log_id
<=
last_replay_log_id
)
{
min_replay_log_id
=
unreplay_log_id
-
1
;
min_replay_log_ts
=
unreplay_log_ts
-
1
;
}
else
{
min_replay_log_id
=
last_replay_log_id
;
min_replay_log_ts
=
last_replay_log_ts
;
}
STORAGE_LOG
(
INFO
,
"min replayed log"
,
K
(
pkey_
),
K
(
min_replay_log_ts
),
K
(
unreplay_log_ts
),
K
(
last_replay_log_ts
));
}
int
ObPartitionGroup
::
get_min_replayed_log_with_keepalive
(
uint64_t
&
min_replay_log_id
,
int64_t
&
min_replay_log_ts
)
{
{
int
ret
=
OB_SUCCESS
;
int
ret
=
OB_SUCCESS
;
uint64_t
unreplay_log_id
=
UINT64_MAX
;
uint64_t
unreplay_log_id
=
UINT64_MAX
;
...
@@ -5406,12 +5383,13 @@ int ObPartitionGroup::get_min_replayed_log_with_keepalive(uint64_t& min_replay_l
...
@@ -5406,12 +5383,13 @@ int ObPartitionGroup::get_min_replayed_log_with_keepalive(uint64_t& min_replay_l
}
else
{
}
else
{
// 2. The minimum continuously replayed log of replay engine.
// 2. The minimum continuously replayed log of replay engine.
replay_status_
->
get_min_unreplay_log
(
unreplay_log_id
,
unreplay_log_ts
);
replay_status_
->
get_min_unreplay_log
(
unreplay_log_id
,
unreplay_log_ts
);
if
(
unreplay_log_id
<=
next_replay_log_id
-
1
)
{
if
(
unreplay_log_id
==
next_replay_log_id
)
{
min_replay_log_id
=
unreplay_log_id
-
1
;
// cold partition, return next_replay_log_ts instead of unreplay_log_ts, unreplay_log_ts may be too small.
min_replay_log_ts
=
unreplay_log_ts
-
1
;
}
else
{
min_replay_log_id
=
next_replay_log_id
-
1
;
min_replay_log_id
=
next_replay_log_id
-
1
;
min_replay_log_ts
=
next_replay_log_ts
-
1
;
min_replay_log_ts
=
next_replay_log_ts
-
1
;
}
else
{
min_replay_log_id
=
unreplay_log_id
-
1
;
min_replay_log_ts
=
unreplay_log_ts
-
1
;
}
}
STORAGE_LOG
(
INFO
,
STORAGE_LOG
(
INFO
,
...
@@ -5856,7 +5834,7 @@ int ObPartitionGroup::get_merge_log_ts(int64_t& merge_ts)
...
@@ -5856,7 +5834,7 @@ int ObPartitionGroup::get_merge_log_ts(int64_t& merge_ts)
ObPartitionGroupLockGuard
guard
(
lock_
,
PGLOCKTRANS
|
PGLOCKREPLAY
|
PGLOCKCLOG
,
0
);
ObPartitionGroupLockGuard
guard
(
lock_
,
PGLOCKTRANS
|
PGLOCKREPLAY
|
PGLOCKCLOG
,
0
);
uint64_t
unused
=
0
;
uint64_t
unused
=
0
;
get_min_replayed_log
(
unused
,
merge_ts
);
get_min_replayed_log
_with_keepalive
(
unused
,
merge_ts
);
if
(
OB_ISNULL
(
txs_
))
{
if
(
OB_ISNULL
(
txs_
))
{
ret
=
OB_ERR_UNEXPECTED
;
ret
=
OB_ERR_UNEXPECTED
;
...
...
src/storage/ob_partition_group.h
浏览文件 @
aa15788e
...
@@ -343,7 +343,6 @@ public:
...
@@ -343,7 +343,6 @@ public:
int
has_active_memtable
(
bool
&
found
);
int
has_active_memtable
(
bool
&
found
);
virtual
int
enable_write_log
(
const
bool
is_replay_old
)
override
;
virtual
int
enable_write_log
(
const
bool
is_replay_old
)
override
;
virtual
uint64_t
get_min_replayed_log_id
()
override
;
virtual
uint64_t
get_min_replayed_log_id
()
override
;
virtual
void
get_min_replayed_log
(
uint64_t
&
min_replay_log_id
,
int64_t
&
min_replay_log_ts
)
override
;
virtual
int
get_min_replayed_log_with_keepalive
(
uint64_t
&
min_replay_log_id
,
int64_t
&
min_replay_log_ts
)
override
;
virtual
int
get_min_replayed_log_with_keepalive
(
uint64_t
&
min_replay_log_id
,
int64_t
&
min_replay_log_ts
)
override
;
virtual
int
check_dirty_txn
(
virtual
int
check_dirty_txn
(
const
int64_t
min_log_ts
,
const
int64_t
max_log_ts
,
int64_t
&
freeze_ts
,
bool
&
is_dirty
)
override
;
const
int64_t
min_log_ts
,
const
int64_t
max_log_ts
,
int64_t
&
freeze_ts
,
bool
&
is_dirty
)
override
;
...
...
src/storage/ob_partition_loop_worker.cpp
浏览文件 @
aa15788e
...
@@ -137,7 +137,15 @@ int ObPartitionLoopWorker::gen_readable_info_with_memtable_(ObPartitionReadableI
...
@@ -137,7 +137,15 @@ int ObPartitionLoopWorker::gen_readable_info_with_memtable_(ObPartitionReadableI
STORAGE_LOG
(
WARN
,
"get_next_replay_log_info error"
,
K
(
ret
),
K_
(
pkey
));
STORAGE_LOG
(
WARN
,
"get_next_replay_log_info error"
,
K
(
ret
),
K_
(
pkey
));
}
}
}
else
{
}
else
{
readable_info
.
min_replay_engine_ts_
=
replay_status_
->
get_min_unreplay_log_timestamp
();
uint64_t
min_unreplay_log_id
=
OB_INVALID_ID
;
int64_t
min_unreplay_log_ts
=
OB_INVALID_TIMESTAMP
;
replay_status_
->
get_min_unreplay_log
(
min_unreplay_log_id
,
min_unreplay_log_ts
);
if
(
min_unreplay_log_id
==
next_replay_log_id
)
{
// cold partition, min_unreplay_log_ts returned by replay engine may be too small
readable_info
.
min_replay_engine_ts_
=
readable_info
.
min_log_service_ts_
;
}
else
{
readable_info
.
min_replay_engine_ts_
=
min_unreplay_log_ts
;
}
if
(
OB_FAIL
(
txs_
->
get_min_uncommit_prepare_version
(
pkey_
,
readable_info
.
min_trans_service_ts_
)))
{
if
(
OB_FAIL
(
txs_
->
get_min_uncommit_prepare_version
(
pkey_
,
readable_info
.
min_trans_service_ts_
)))
{
if
(
OB_PARTITION_NOT_EXIST
==
ret
)
{
if
(
OB_PARTITION_NOT_EXIST
==
ret
)
{
if
(
REACH_TIME_INTERVAL
(
60
*
1000
*
1000
))
{
if
(
REACH_TIME_INTERVAL
(
60
*
1000
*
1000
))
{
...
...
src/storage/ob_replay_status.cpp
浏览文件 @
aa15788e
...
@@ -526,6 +526,8 @@ uint64_t ObReplayStatus::get_min_unreplay_log_id()
...
@@ -526,6 +526,8 @@ uint64_t ObReplayStatus::get_min_unreplay_log_id()
// the invoker needs to lock
// the invoker needs to lock
int64_t
ObReplayStatus
::
get_min_unreplay_log_timestamp
()
int64_t
ObReplayStatus
::
get_min_unreplay_log_timestamp
()
{
{
// for cold partition: timestamp returned may be small then expected, need to be double check with
// value returned by log service
uint64_t
unused
=
UINT64_MAX
;
uint64_t
unused
=
UINT64_MAX
;
int64_t
timestamp
=
INT64_MAX
;
int64_t
timestamp
=
INT64_MAX
;
get_min_unreplay_log
(
unused
,
timestamp
);
get_min_unreplay_log
(
unused
,
timestamp
);
...
@@ -534,19 +536,12 @@ int64_t ObReplayStatus::get_min_unreplay_log_timestamp()
...
@@ -534,19 +536,12 @@ int64_t ObReplayStatus::get_min_unreplay_log_timestamp()
void
ObReplayStatus
::
get_min_unreplay_log
(
uint64_t
&
unreplay_log_id
,
int64_t
&
timestamp
)
void
ObReplayStatus
::
get_min_unreplay_log
(
uint64_t
&
unreplay_log_id
,
int64_t
&
timestamp
)
{
{
unreplay_log_id
=
UINT64_MAX
;
// for cold partition: timestamp returned may be small then expected, need to be double check with
timestamp
=
INT64_MAX
;
// value returned by log service
{
{
RLockGuard
Rlock_guard
(
get_submit_log_info_rwlock
());
RLockGuard
Rlock_guard
(
get_submit_log_info_rwlock
());
uint64_t
next_submit_log_id
=
get_next_submit_log_id
();
unreplay_log_id
=
get_next_submit_log_id
();
int64_t
next_submit_log_ts
=
get_next_submit_log_ts
();
timestamp
=
get_next_submit_log_ts
();
uint64_t
last_slide_out_log_id
=
get_last_slide_out_log_id
();
int64_t
last_slide_out_log_ts
=
get_last_slide_out_log_ts
();
if
(
next_submit_log_ts
<=
last_slide_out_log_ts
)
{
unreplay_log_id
=
next_submit_log_id
;
timestamp
=
next_submit_log_ts
;
}
}
}
for
(
int64_t
i
=
0
;
i
<
REPLAY_TASK_QUEUE_SIZE
;
++
i
)
{
for
(
int64_t
i
=
0
;
i
<
REPLAY_TASK_QUEUE_SIZE
;
++
i
)
{
...
...
unittest/storage/mockcontainer/mock_ob_partition.h
浏览文件 @
aa15788e
...
@@ -302,7 +302,6 @@ public:
...
@@ -302,7 +302,6 @@ public:
return
common
::
OB_SUCCESS
;
return
common
::
OB_SUCCESS
;
}
}
MOCK_METHOD0
(
get_min_replayed_log_id
,
uint64_t
());
MOCK_METHOD0
(
get_min_replayed_log_id
,
uint64_t
());
MOCK_METHOD2
(
get_min_replayed_log
,
void
(
uint64_t
&
min_replay_log_id
,
int64_t
&
min_replay_log_ts
));
MOCK_METHOD2
(
get_min_replayed_log_with_keepalive
,
int
(
uint64_t
&
min_replay_log_id
,
int64_t
&
min_replay_log_ts
));
MOCK_METHOD2
(
get_min_replayed_log_with_keepalive
,
int
(
uint64_t
&
min_replay_log_id
,
int64_t
&
min_replay_log_ts
));
MOCK_CONST_METHOD1
(
get_table_store_cnt
,
int
(
int64_t
&
table_cnt
));
MOCK_CONST_METHOD1
(
get_table_store_cnt
,
int
(
int64_t
&
table_cnt
));
MOCK_METHOD4
(
MOCK_METHOD4
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录