fix stanby tenant schedule & consider snapshot_gc when schedule

This commit is contained in:
obdev
2023-02-20 04:47:00 +00:00
committed by ob-robot
parent 0aa17c1e8e
commit f8d871eaf5
3 changed files with 8 additions and 7 deletions

View File

@ -332,9 +332,10 @@ int ObMediumCompactionScheduleFunc::decide_medium_snapshot(
if (medium_info.medium_snapshot_ == tablet_.get_snapshot_version() // no uncommitted sstable if (medium_info.medium_snapshot_ == tablet_.get_snapshot_version() // no uncommitted sstable
&& weak_read_ts.get_val_for_tx() <= max_reserved_snapshot && weak_read_ts.get_val_for_tx() <= max_reserved_snapshot
&& weak_read_ts.get_val_for_tx() + DEFAULT_SCHEDULE_MEDIUM_INTERVAL < ObTimeUtility::current_time_ns()) { && weak_read_ts.get_val_for_tx() + DEFAULT_SCHEDULE_MEDIUM_INTERVAL < ObTimeUtility::current_time_ns()) {
medium_info.medium_snapshot_ = MAX(max_reserved_snapshot, weak_read_ts.get_val_for_tx()); const int64_t snapshot_gc_ts = MTL(ObTenantFreezeInfoMgr*)->get_snapshot_gc_ts();
medium_info.medium_snapshot_ = MAX(max_reserved_snapshot, MIN(weak_read_ts.get_val_for_tx(), snapshot_gc_ts));
LOG_INFO("use weak_read_ts to schedule medium", K(ret), KPC(this), LOG_INFO("use weak_read_ts to schedule medium", K(ret), KPC(this),
K(medium_info), K(max_reserved_snapshot), K(weak_read_ts)); K(medium_info), K(max_reserved_snapshot), K(weak_read_ts), K(snapshot_gc_ts));
} else { } else {
ret = OB_NO_NEED_MERGE; ret = OB_NO_NEED_MERGE;
} }
@ -839,7 +840,6 @@ int ObMediumCompactionScheduleFunc::schedule_tablet_medium_merge(
LOG_WARN("failed to get status from inner tablet", K(ret), K(ls_id), K(tablet_id)); LOG_WARN("failed to get status from inner tablet", K(ret), K(ls_id), K(tablet_id));
} else if (ret_info.could_schedule_next_round(last_major->get_snapshot_version())) { } else if (ret_info.could_schedule_next_round(last_major->get_snapshot_version())) {
LOG_INFO("success to check RS major checksum validation finished", K(ret), K(ls_id), K(tablet_id)); LOG_INFO("success to check RS major checksum validation finished", K(ret), K(ls_id), K(tablet_id));
} else {
schedule_flag = true; schedule_flag = true;
} }
} else { } else {

View File

@ -164,7 +164,7 @@ int ObTabletMediumCompactionInfoRecorder::inner_replay_clog(
ObMediumCompactionInfo replay_medium_info; ObMediumCompactionInfo replay_medium_info;
ObTabletHandle tmp_tablet_handle; ObTabletHandle tmp_tablet_handle;
if (OB_FAIL(replay_get_tablet_handle(ls_id_, tablet_id_, scn, tmp_tablet_handle))) { if (OB_FAIL(replay_get_tablet_handle(ls_id_, tablet_id_, scn, tmp_tablet_handle))) {
LOG_WARN("failed to get tablet handle", K(ret), K_(tablet_id), K(scn)); LOG_WARN("failed to get tablet handle", K(ret), K_(ls_id), K_(tablet_id), K(scn));
} else if (OB_FAIL(replay_medium_info.deserialize(tmp_allocator, buf, size, pos))) { } else if (OB_FAIL(replay_medium_info.deserialize(tmp_allocator, buf, size, pos))) {
LOG_WARN("failed to deserialize medium compaction info", K(ret)); LOG_WARN("failed to deserialize medium compaction info", K(ret));
} else if (!replay_medium_info.from_cur_cluster() } else if (!replay_medium_info.from_cur_cluster()
@ -176,7 +176,7 @@ int ObTabletMediumCompactionInfoRecorder::inner_replay_clog(
LOG_WARN("failed to save medium info", K(ret), K_(tablet_id), K(replay_medium_info)); LOG_WARN("failed to save medium info", K(ret), K_(tablet_id), K(replay_medium_info));
} else { } else {
tmp_tablet_handle.reset(); tmp_tablet_handle.reset();
FLOG_INFO("success to save medium info", K(ret), K_(tablet_id), K(replay_medium_info), K(max_saved_version_)); FLOG_INFO("success to save medium info", K(ret), K_(ls_id), K_(tablet_id), K(replay_medium_info), K(max_saved_version_));
} }
return ret; return ret;
} }
@ -193,7 +193,7 @@ int ObTabletMediumCompactionInfoRecorder::sync_clog_succ_for_leader(const int64_
} else if (OB_FAIL(dec_ref_on_memtable(true/*sync_finish*/))) { } else if (OB_FAIL(dec_ref_on_memtable(true/*sync_finish*/))) {
LOG_WARN("failed to dec ref on memtable", K(ret), K_(tablet_id), KPC(medium_info_)); LOG_WARN("failed to dec ref on memtable", K(ret), K_(tablet_id), KPC(medium_info_));
} else { } else {
FLOG_INFO("success to save medium info", K(ret), K_(tablet_id), KPC(medium_info_), FLOG_INFO("success to save medium info", K(ret), K_(ls_id), K_(tablet_id), KPC(medium_info_),
K(max_saved_version_), K_(clog_scn)); K(max_saved_version_), K_(clog_scn));
} }
return ret; return ret;

View File

@ -153,7 +153,8 @@ int ObStorageSchemaRecorder::inner_replay_clog(
true/*for_replay*/, memtable::MemtableRefOp::NONE))) { true/*for_replay*/, memtable::MemtableRefOp::NONE))) {
LOG_WARN("failed to save storage schema", K(ret), K_(tablet_id), K(replay_storage_schema)); LOG_WARN("failed to save storage schema", K(ret), K_(tablet_id), K(replay_storage_schema));
} else { } else {
LOG_INFO("success to replay schema clog", K(ret), K(replay_storage_schema.get_schema_version()), K(replay_storage_schema.compat_mode_)); LOG_INFO("success to replay schema clog", K(ret), K_(ls_id), K_(tablet_id),
K(replay_storage_schema.get_schema_version()), K(replay_storage_schema.compat_mode_));
} }
replay_storage_schema.reset(); replay_storage_schema.reset();
tmp_tablet_handle.reset(); tmp_tablet_handle.reset();