Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
oceanbase
oceanbase
提交
cd8fb2e1
O
oceanbase
项目概览
oceanbase
/
oceanbase
大约 1 年 前同步成功
通知
261
Star
6084
Fork
1301
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
cd8fb2e1
编写于
6月 30, 2023
作者:
K
KyrielightWei
提交者:
ob-robot
6月 30, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rewrite dup_tablet_set for a special op to avoid executing sp_op failed
上级
e35dc626
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
314 addition
and
199 deletion
+314
-199
src/storage/tx/ob_dup_table_base.cpp
src/storage/tx/ob_dup_table_base.cpp
+32
-6
src/storage/tx/ob_dup_table_base.h
src/storage/tx/ob_dup_table_base.h
+15
-28
src/storage/tx/ob_dup_table_lease.cpp
src/storage/tx/ob_dup_table_lease.cpp
+1
-36
src/storage/tx/ob_dup_table_tablets.cpp
src/storage/tx/ob_dup_table_tablets.cpp
+248
-121
src/storage/tx/ob_dup_table_tablets.h
src/storage/tx/ob_dup_table_tablets.h
+15
-5
src/storage/tx/ob_dup_table_util.cpp
src/storage/tx/ob_dup_table_util.cpp
+3
-3
未找到文件。
src/storage/tx/ob_dup_table_base.cpp
浏览文件 @
cd8fb2e1
...
...
@@ -25,9 +25,10 @@ using namespace storage;
namespace
transaction
{
const
uint64_t
DupTableDiagStd
::
DUP_DIAG_INFO_LOG_BUF_LEN
[
3
]
=
{
const
uint64_t
DupTableDiagStd
::
DUP_DIAG_INFO_LOG_BUF_LEN
[
DupTableDiagStd
::
TypeIndex
::
MAX_INDEX
]
=
{
1
<<
12
,
// 4K
1
<<
16
,
// 64k
1
<<
20
,
// 1M
1
<<
17
,
// 128K
1
<<
12
,
// 4k
};
const
char
*
DupTableDiagStd
::
DUP_DIAG_INDENT_SPACE
=
" "
;
// 4
...
...
@@ -35,7 +36,8 @@ const char *DupTableDiagStd::DUP_DIAG_COMMON_PREFIX = "DUP_TABLE_DIAG: ";
const
int64_t
DupTableDiagStd
::
DUP_DIAG_PRINT_INTERVAL
[
DupTableDiagStd
::
TypeIndex
::
MAX_INDEX
]
=
{
ObDupTableLSLeaseMgr
::
DEFAULT_LEASE_INTERVAL
,
30
*
1000
*
1000
,
// 10s , tablet_print_interval
3
*
60
*
1000
*
1000
// 3min , ts_sync_print_interval
30
*
1000
*
1000
,
// 10s , tablet_print_interval
5
*
60
*
1000
*
1000
// 3min , ts_sync_print_interval
};
...
...
@@ -217,7 +219,23 @@ OB_SERIALIZE_MEMBER(DupTableLeaseLogHeader, addr_, lease_log_code_);
/*******************************************************
* Dup_Table Tablets
*******************************************************/
// nothing
bool
DupTabletSetCommonHeader
::
operator
==
(
const
DupTabletSetCommonHeader
&
dup_common_header
)
const
{
bool
compare_res
=
false
;
if
(
unique_id_
==
dup_common_header
.
unique_id_
&&
tablet_set_type_
==
dup_common_header
.
tablet_set_type_
&&
sp_op_type_
==
dup_common_header
.
sp_op_type_
)
{
compare_res
=
true
;
}
return
compare_res
;
}
bool
DupTabletSetCommonHeader
::
operator
!=
(
const
DupTabletSetCommonHeader
&
dup_common_header
)
const
{
return
!
((
*
this
)
==
dup_common_header
);
}
/*******************************************************
* Dup_Table Checkpoint
...
...
@@ -963,6 +981,7 @@ int ObDupTableLogOperator::deserialize_log_entry_()
int
ObDupTableLogOperator
::
retry_submit_log_block_
()
{
int
ret
=
OB_SUCCESS
;
int
tmp_ret
=
OB_SUCCESS
;
int64_t
block_buf_pos
=
0
;
if
(
OB_ISNULL
(
block_buf_
))
{
...
...
@@ -977,6 +996,13 @@ int ObDupTableLogOperator::retry_submit_log_block_()
logservice
::
ObLogBaseHeader
base_header
(
logservice
::
ObLogBaseType
::
DUP_TABLE_LOG_BASE_TYPE
,
logservice
::
ObReplayBarrierType
::
NO_NEED_BARRIER
,
ls_id_
.
hash
());
share
::
SCN
gts_base_scn
=
share
::
SCN
::
min_scn
();
if
(
OB_TMP_FAIL
(
OB_TS_MGR
.
get_gts
(
MTL_ID
(),
nullptr
,
gts_base_scn
)))
{
DUP_TABLE_LOG
(
WARN
,
"get gts cache for base scn failed"
,
K
(
ret
),
K
(
tmp_ret
),
K
(
gts_base_scn
));
gts_base_scn
=
share
::
SCN
::
min_scn
();
}
bool
unused
=
false
;
if
(
!
big_segment_buf_
.
is_active
())
{
ret
=
OB_ERR_UNEXPECTED
;
...
...
@@ -993,8 +1019,8 @@ int ObDupTableLogOperator::retry_submit_log_block_()
ret
=
OB_LOG_TOO_LARGE
;
DUP_TABLE_LOG
(
WARN
,
"Too large dup table log. We can not submit it"
,
K
(
ret
),
K
(
big_segment_buf_
.
is_completed
()),
KPC
(
this
));
}
else
if
(
OB_FAIL
(
log_handler_
->
append
(
block_buf_
,
block_buf_pos
,
share
::
SCN
::
min_scn
(),
false
,
this
,
logging_lsn_
,
logging_scn_
)))
{
}
else
if
(
OB_FAIL
(
log_handler_
->
append
(
block_buf_
,
block_buf_pos
,
gts_base_scn
,
false
,
this
,
logging_lsn_
,
logging_scn_
)))
{
DUP_TABLE_LOG
(
WARN
,
"append block failed"
,
K
(
ret
),
K
(
ls_id_
));
}
}
...
...
src/storage/tx/ob_dup_table_base.h
浏览文件 @
cd8fb2e1
...
...
@@ -53,7 +53,8 @@ public:
enum
TypeIndex
{
LEASE_INDEX
=
0
,
TABLET_INDEX
,
TBALET_MEMBER_INDEX
,
TABLET_SET_INDEX
,
TS_SYNC_INDEX
,
MAX_INDEX
,
};
...
...
@@ -673,12 +674,11 @@ private:
// static const uint64_t SPECIAL_OP_BIT_COUNT = 8;
// static const uint64_t UNIQUE_ID_BIT = static_cast<uint64_t>(0xFFFFFFFFULL);
// static const uint64_t TABLET_SET_BIT = static_cast<uint64_t>(0xFULL) << UNIQUE_ID_BIT_COUNT;
// static const uint64_t SPECIAL_OP_BIT = static_cast<uint64_t>(0xFFULL) << (UNIQUE_ID_BIT_COUNT + TABLET_SET_BIT_COUNT);
// static const uint64_t SPECIAL_OP_BIT = static_cast<uint64_t>(0xFFULL) << (UNIQUE_ID_BIT_COUNT +
// TABLET_SET_BIT_COUNT);
public:
TO_STRING_KV
(
K
(
unique_id_
),
K
(
tablet_set_type_
),
K
(
sp_op_type_
));
TO_STRING_KV
(
K
(
unique_id_
),
K
(
tablet_set_type_
),
K
(
sp_op_type_
));
DupTabletSetCommonHeader
(
const
uint64_t
id
)
:
unique_id_
(
id
)
{
...
...
@@ -689,9 +689,7 @@ public:
DupTabletSetCommonHeader
()
{
reset
();
}
~
DupTabletSetCommonHeader
()
{
reset
();
}
bool
is_valid
()
const
{
return
unique_id_is_valid
()
&&
tablet_set_type_is_valid
();
}
bool
is_valid
()
const
{
return
unique_id_is_valid
()
&&
tablet_set_type_is_valid
();
}
void
reset
()
{
set_invalid_unique_id
();
...
...
@@ -739,14 +737,8 @@ public:
{
return
DUP_SPECIAL_OP_CLEAN_DATA_CONFIRMING_SET
==
sp_op_type_
;
}
void
set_op_of_block_confirming
()
{
set_special_op_
(
DUP_SPECIAL_OP_BLOCK_CONFIRMING
);
}
bool
need_block_confirming
()
const
{
return
DUP_SPECIAL_OP_BLOCK_CONFIRMING
==
sp_op_type_
;
}
void
set_op_of_block_confirming
()
{
set_special_op_
(
DUP_SPECIAL_OP_BLOCK_CONFIRMING
);
}
bool
need_block_confirming
()
const
{
return
DUP_SPECIAL_OP_BLOCK_CONFIRMING
==
sp_op_type_
;
}
// bool contain_special_op(uint64_t special_op) const { return get_special_op_() == special_op; }
bool
no_specail_op
()
const
{
return
INVALID_SPECIAL_OP
==
sp_op_type_
;
}
void
copy_tablet_set_type
(
const
DupTabletSetCommonHeader
&
src_common_header
)
...
...
@@ -756,6 +748,10 @@ public:
change_tablet_set_type_
(
src_common_header
.
get_tablet_set_type
());
}
public:
bool
operator
==
(
const
DupTabletSetCommonHeader
&
dup_common_header
)
const
;
bool
operator
!=
(
const
DupTabletSetCommonHeader
&
dup_common_header
)
const
;
private:
void
set_unique_id_
(
const
uint64_t
id
)
{
...
...
@@ -767,19 +763,10 @@ private:
}
unique_id_
=
id
;
}
void
change_tablet_set_type_
(
const
int64_t
set_type
)
{
tablet_set_type_
=
set_type
;
}
int64_t
get_tablet_set_type_
()
const
{
return
tablet_set_type_
;
}
void
change_tablet_set_type_
(
const
int64_t
set_type
)
{
tablet_set_type_
=
set_type
;
}
int64_t
get_tablet_set_type_
()
const
{
return
tablet_set_type_
;
}
void
set_special_op_
(
const
int64_t
special_op_type
)
{
sp_op_type_
=
special_op_type
;
}
void
set_special_op_
(
const
int64_t
special_op_type
)
{
sp_op_type_
=
special_op_type
;
}
int64_t
get_special_op_
()
const
{
// return (common_code_ & SPECIAL_OP_BIT) >> (UNIQUE_ID_BIT_COUNT + TABLET_SET_BIT_COUNT);
...
...
src/storage/tx/ob_dup_table_lease.cpp
浏览文件 @
cd8fb2e1
...
...
@@ -410,41 +410,6 @@ int ObDupTableLSLeaseMgr::handle_lease_req_cache_(int64_t loop_start_time,
return
ret
;
}
// int ObDupTableLSLeaseMgr::leader_handle(bool &need_log)
// {
// int ret = OB_SUCCESS;
//
// SpinWLockGuard guard(lease_lock_);
//
// common::ObAddr tmp_addr;
// int64_t loop_start_time = ObTimeUtility::current_time();
// DupTableTsInfo local_ts_info;
// need_log = false;
//
// if (need_retry_lease_operation_(loop_start_time, last_lease_req_cache_handle_time_)) {
// if (OB_FAIL(dup_ls_handle_ptr_->get_local_ts_info(local_ts_info))) {
// need_log = false;
// DUP_TABLE_LOG(WARN, "get local ts info failed", K(ret), K(ls_id_), K(local_ts_info));
// } else {
// LeaseReqCacheHandler req_handler(this, loop_start_time, local_ts_info.max_replayed_scn_);
// if (OB_FAIL(hash_for_each_remove(tmp_addr, leader_lease_map_, req_handler))) {
// DUP_TABLE_LOG(WARN, "handle lease requests failed", K(ret));
// }
//
// last_lease_req_cache_handle_time_ = loop_start_time;
// if (req_handler.get_lease_changed()) {
// need_log = true;
// } else {
// need_log = false;
// }
// }
// } else {
// need_log = false;
// }
// DUP_TABLE_LOG(DEBUG, "leader handler", K(loop_start_time), K(need_log));
// return ret;
// }
//
int
ObDupTableLSLeaseMgr
::
follower_handle
()
{
int
ret
=
OB_SUCCESS
;
...
...
@@ -452,7 +417,7 @@ int ObDupTableLSLeaseMgr::follower_handle()
if
(
ATOMIC_LOAD
(
&
is_stopped_
))
{
ret
=
OB_NOT_INIT
;
DUP_TABLE_LOG
(
WARN
,
"dup table lease mgr is not inited"
,
K
(
ret
));
}
else
if
(
dup_ls_handle_ptr_
->
get_local_ts_info
(
local_ts_info
))
{
}
else
if
(
OB_FAIL
(
dup_ls_handle_ptr_
->
get_local_ts_info
(
local_ts_info
)
))
{
DUP_TABLE_LOG
(
WARN
,
"get local ts info failed"
,
K
(
ret
));
}
else
{
SpinWLockGuard
guard
(
lease_lock_
);
...
...
src/storage/tx/ob_dup_table_tablets.cpp
浏览文件 @
cd8fb2e1
此差异已折叠。
点击以展开。
src/storage/tx/ob_dup_table_tablets.h
浏览文件 @
cd8fb2e1
...
...
@@ -339,6 +339,11 @@ public:
{
return
dup_set_attr_
.
change_status_
.
need_reserve
(
scn
);
}
share
::
SCN
get_tablet_change_scn
()
{
return
dup_set_attr_
.
change_status_
.
tablet_change_scn_
;
}
const
DupTabletSetChangeStatus
&
get_RO_change_status
()
const
{
return
dup_set_attr_
.
change_status_
;
}
bool
is_logging
()
const
{
return
dup_set_attr_
.
change_status_
.
check_logging
();
}
void
set_logging
()
{
dup_set_attr_
.
change_status_
.
set_logging
();
}
...
...
@@ -492,7 +497,7 @@ class ObLSDupTabletsMgr
{
public:
ObLSDupTabletsMgr
()
:
changing_new_set_
(
nullptr
),
removing_old_set_
(
nullptr
),
tablet_diag_info_log_buf_
(
nullptr
)
:
changing_new_set_
(
nullptr
),
removing_old_set_
(
nullptr
),
tablet_
set_diag_info_log_buf_
(
nullptr
),
tablet_id_
diag_info_log_buf_
(
nullptr
)
{
reset
();
}
...
...
@@ -678,10 +683,10 @@ private:
int
get_target_tablet_set_
(
const
DupTabletSetCommonHeader
&
target_common_header
,
DupTabletChangeMap
*&
target_set
,
const
bool
construct_target_set
=
false
,
const
bool
need_changing_new
_set
=
false
);
const
bool
force_search_target
_set
=
false
);
int
check_and_recycle_empty_readable_set
(
DupTabletChangeMap
*
need_free_set
,
bool
&
need_remove
);
int
return_tablet_set
(
DupTabletChangeMap
*
need_free_set
);
int
check_and_recycle_empty_readable_set
_
(
DupTabletChangeMap
*
need_free_set
,
bool
&
need_remove
);
int
return_tablet_set
_
(
DupTabletChangeMap
*
need_free_set
);
int
clean_readable_tablets_
(
const
share
::
SCN
&
min_reserve_tablet_scn
);
int
clean_durable_confirming_tablets_
(
const
share
::
SCN
&
min_reserve_tablet_scn
);
...
...
@@ -703,6 +708,10 @@ private:
int
merge_into_readable_tablets_
(
DupTabletChangeMap
*
change_map_ptr
,
const
bool
for_replay
);
int
validate_replay_dup_tablet_set
(
const
DupTabletSetCommonHeader
&
target_common_header
,
const
DupTabletSetChangeStatus
&
target_change_status
,
DupTabletChangeMap
*
replay_target_set
);
private:
//
static
int64_t
GC_DUP_TABLETS_TIME_INTERVAL
;
// 5 min
...
...
@@ -745,7 +754,8 @@ private:
int64_t
last_no_free_set_time_
;
int64_t
extra_free_set_alloc_count_
;
char
*
tablet_diag_info_log_buf_
;
char
*
tablet_set_diag_info_log_buf_
;
char
*
tablet_id_diag_info_log_buf_
;
};
class
ObLSDupTablets
...
...
src/storage/tx/ob_dup_table_util.cpp
浏览文件 @
cd8fb2e1
...
...
@@ -726,10 +726,10 @@ int ObDupTableLSHandler::ls_loop_handle()
last_diag_info_print_us_
[
DupTableDiagStd
::
TypeIndex
::
LEASE_INDEX
]
=
fast_cur_time
;
}
if
(
fast_cur_time
-
last_diag_info_print_us_
[
DupTableDiagStd
::
TypeIndex
::
TABLET_INDEX
]
>=
DupTableDiagStd
::
DUP_DIAG_PRINT_INTERVAL
[
DupTableDiagStd
::
TypeIndex
::
TABLET_INDEX
])
{
if
(
fast_cur_time
-
last_diag_info_print_us_
[
DupTableDiagStd
::
TypeIndex
::
TABLET_
SET_
INDEX
]
>=
DupTableDiagStd
::
DUP_DIAG_PRINT_INTERVAL
[
DupTableDiagStd
::
TypeIndex
::
TABLET_
SET_
INDEX
])
{
tablets_mgr_ptr_
->
print_tablet_diag_info_log
(
is_leader
);
last_diag_info_print_us_
[
DupTableDiagStd
::
TypeIndex
::
TABLET_INDEX
]
=
fast_cur_time
;
last_diag_info_print_us_
[
DupTableDiagStd
::
TypeIndex
::
TABLET_
SET_
INDEX
]
=
fast_cur_time
;
}
if
(
fast_cur_time
-
last_diag_info_print_us_
[
DupTableDiagStd
::
TypeIndex
::
TS_SYNC_INDEX
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录