restrict archive send task count for ls gc

This commit is contained in:
taoshuning
2023-08-15 09:14:34 +00:00
committed by ob-robot
parent 72161fdd87
commit eb7f5dea9e
2 changed files with 9 additions and 13 deletions

View File

@ -453,7 +453,6 @@ int ObArchiveFetcher::check_need_delay_(const ObArchiveLogFetchTask &task,
bool &need_delay) bool &need_delay)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
bool data_enough = false;
bool data_full = false; bool data_full = false;
const ObLSID &id = task.get_ls_id(); const ObLSID &id = task.get_ls_id();
const ArchiveWorkStation &station = task.get_station(); const ArchiveWorkStation &station = task.get_station();
@ -477,9 +476,6 @@ int ObArchiveFetcher::check_need_delay_(const ObArchiveLogFetchTask &task,
ARCHIVE_LOG(WARN, "get ls failed", K(id)); ARCHIVE_LOG(WARN, "get ls failed", K(id));
} else if (OB_FAIL(handle.get_ls()->get_offline_scn(offline_scn))) { } else if (OB_FAIL(handle.get_ls()->get_offline_scn(offline_scn))) {
ARCHIVE_LOG(WARN, "get offline_scn failed", K(id)); ARCHIVE_LOG(WARN, "get offline_scn failed", K(id));
} else if (OB_UNLIKELY(offline_scn.is_valid())) {
// if ls is offline, it should be archived as soon as possible
need_delay = false;
} else { } else {
GET_LS_TASK_CTX(ls_mgr_, id) { GET_LS_TASK_CTX(ls_mgr_, id) {
if (OB_FAIL(ls_archive_task->get_fetcher_progress(station, offset, fetch_scn, last_fetch_timestamp))) { if (OB_FAIL(ls_archive_task->get_fetcher_progress(station, offset, fetch_scn, last_fetch_timestamp))) {
@ -500,20 +496,22 @@ int ObArchiveFetcher::check_need_delay_(const ObArchiveLogFetchTask &task,
ARCHIVE_LOG(TRACE, "archive_sender_ task status count more than ls archive task count, just wait", ARCHIVE_LOG(TRACE, "archive_sender_ task status count more than ls archive task count, just wait",
K(ls_archive_task_count), K(send_task_status_count), K(need_delay)); K(ls_archive_task_count), K(send_task_status_count), K(need_delay));
} else { } else {
check_capacity_enough_(commit_lsn, cur_lsn, end_lsn, data_enough, data_full); check_capacity_enough_(commit_lsn, cur_lsn, end_lsn, data_full);
if (data_full) { if (data_full) {
// although data buffer not enough, but data reaches the end of the block, do archive // although data buffer not enough, but data reaches the end of the block, do archive
ARCHIVE_LOG(TRACE, "data buffer reach clog block end, do archive", ARCHIVE_LOG(TRACE, "data buffer reach clog block end, do archive",
K(id), K(station), K(end_lsn), K(commit_lsn)); K(id), K(station), K(end_lsn), K(commit_lsn));
} else if (OB_UNLIKELY(offline_scn.is_valid())) {
if (fetch_scn.is_valid() && fetch_scn >= offline_scn) {
// if ls is offline and does not archive all, it should be archived as soon as possible
need_delay = true;
} else {
need_delay = false;
}
} else if (! check_scn_enough_(id, new_block, cur_lsn, max_no_limit_lsn, base_scn, fetch_scn, last_fetch_timestamp)) { } else if (! check_scn_enough_(id, new_block, cur_lsn, max_no_limit_lsn, base_scn, fetch_scn, last_fetch_timestamp)) {
need_delay = true; need_delay = true;
ARCHIVE_LOG(TRACE, "scn not enough, need delay", K(id), K(station), K(new_block), K(cur_lsn), ARCHIVE_LOG(TRACE, "scn not enough, need delay", K(id), K(station), K(new_block), K(cur_lsn),
K(max_no_limit_lsn), K(base_scn), K(fetch_scn)); K(max_no_limit_lsn), K(base_scn), K(fetch_scn));
} else if (! data_enough) {
// data not enough to fill unit, just wait
need_delay = true;
ARCHIVE_LOG(TRACE, "data not enough, need delay", K(id), K(station), K(commit_lsn),
K(cur_lsn), K(end_lsn), K(data_enough));
} }
} }
} }
@ -525,12 +523,10 @@ int ObArchiveFetcher::check_need_delay_(const ObArchiveLogFetchTask &task,
void ObArchiveFetcher::check_capacity_enough_(const LSN &commit_lsn, void ObArchiveFetcher::check_capacity_enough_(const LSN &commit_lsn,
const LSN &cur_lsn, const LSN &cur_lsn,
const LSN &end_lsn, const LSN &end_lsn,
bool &data_enough,
bool &data_full) bool &data_full)
{ {
// 已有足够大用以压缩加密单元或者到达归档文件尾(也是ob日志文件尾) // 已有足够大用以压缩加密单元或者到达归档文件尾(也是ob日志文件尾)
data_full = end_lsn <= commit_lsn; data_full = end_lsn <= commit_lsn;
data_enough = data_full || commit_lsn >= cur_lsn + unit_size_;
} }
bool ObArchiveFetcher::check_scn_enough_(const share::ObLSID &id, bool ObArchiveFetcher::check_scn_enough_(const share::ObLSID &id,

View File

@ -139,7 +139,7 @@ private:
// 1.1.1 检查ob日志是否有产生满足处理单元大小的数据 // 1.1.1 检查ob日志是否有产生满足处理单元大小的数据
void check_capacity_enough_(const LSN &commit_lsn, const LSN &cur_lsn, void check_capacity_enough_(const LSN &commit_lsn, const LSN &cur_lsn,
const LSN &end_offset, bool &data_enough, bool &data_full); const LSN &end_offset, bool &data_full);
// 1.1.2 检查日志流落后程度是否需要触发归档 // 1.1.2 检查日志流落后程度是否需要触发归档
bool check_scn_enough_(const share::ObLSID &id, const bool new_block, const palf::LSN &lsn, bool check_scn_enough_(const share::ObLSID &id, const bool new_block, const palf::LSN &lsn,