Fix multi_version_start larger than split_start_commit_version
This commit is contained in:
parent
b187dbc87e
commit
e352718516
@ -55,7 +55,8 @@ const char *ObStorageSnapshotInfo::ObSnapShotTypeStr[] = {
|
||||
"MULTI_VERSION_START_ON_TABLET",
|
||||
"SNAPSHOT_ON_TABLET",
|
||||
"LS_RESERVED",
|
||||
"MIN_MEDIUM"
|
||||
"MIN_MEDIUM",
|
||||
"SPLIT"
|
||||
};
|
||||
|
||||
ObStorageSnapshotInfo::ObStorageSnapshotInfo()
|
||||
|
@ -47,6 +47,7 @@ struct ObStorageSnapshotInfo
|
||||
SNAPSHOT_ON_TABLET,
|
||||
SNAPSHOT_FOR_LS_RESERVED,
|
||||
SNAPSHOT_FOR_MIN_MEDIUM,
|
||||
SNAPSHOT_FOR_SPLIT,
|
||||
SNAPSHOT_MAX,
|
||||
};
|
||||
ObStorageSnapshotInfo();
|
||||
|
@ -5949,6 +5949,11 @@ int ObTablet::get_kept_snapshot_info(
|
||||
}
|
||||
}
|
||||
|
||||
int64_t min_split_snapshot = INT64_MAX;
|
||||
if (FAILEDx(get_kept_snapshot_for_split(min_split_snapshot))) {
|
||||
LOG_WARN("failed to get kept snapshot for split", K(ret), K(tablet_id));
|
||||
}
|
||||
|
||||
ObStorageSnapshotInfo old_snapshot_info;
|
||||
if (FAILEDx(MTL(ObTenantFreezeInfoMgr*)->get_min_reserved_snapshot(tablet_id, max_merged_snapshot, snapshot_info))) {
|
||||
LOG_WARN("failed to get multi version from freeze info mgr", K(ret), K(tablet_id));
|
||||
@ -5963,6 +5968,7 @@ int ObTablet::get_kept_snapshot_info(
|
||||
} else if (min_reserved_snapshot_on_ls > 0) {
|
||||
snapshot_info.update_by_smaller_snapshot(ObStorageSnapshotInfo::SNAPSHOT_FOR_LS_RESERVED, min_reserved_snapshot_on_ls);
|
||||
snapshot_info.update_by_smaller_snapshot(ObStorageSnapshotInfo::SNAPSHOT_FOR_MIN_MEDIUM, min_medium_snapshot);
|
||||
snapshot_info.update_by_smaller_snapshot(ObStorageSnapshotInfo::SNAPSHOT_FOR_SPLIT, min_split_snapshot);
|
||||
if (snapshot_info.snapshot_ < get_multi_version_start()) {
|
||||
use_multi_version_start_on_tablet = true;
|
||||
}
|
||||
@ -5996,6 +6002,35 @@ int ObTablet::get_kept_snapshot_info(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTablet::get_kept_snapshot_for_split(int64_t &min_split_snapshot) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const share::ObLSID &ls_id = tablet_meta_.ls_id_;
|
||||
const common::ObTabletID &tablet_id = tablet_meta_.tablet_id_;
|
||||
min_split_snapshot = INT64_MAX;
|
||||
if (!is_ls_inner_tablet()) {
|
||||
mds::MdsWriter writer;
|
||||
mds::TwoPhaseCommitState trans_stat;
|
||||
share::SCN trans_version;
|
||||
ObTabletCreateDeleteMdsUserData user_data;
|
||||
if (OB_FAIL(ObITabletMdsInterface::get_latest_tablet_status(user_data, writer, trans_stat, trans_version))) {
|
||||
if (OB_EMPTY_RESULT == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
} else {
|
||||
LOG_WARN("failed to get tx data", K(ret), K(ls_id), K(tablet_id));
|
||||
}
|
||||
} else if (ObTabletStatus::SPLIT_SRC == user_data.get_tablet_status()) {
|
||||
if (mds::TwoPhaseCommitState::ON_PREPARE == trans_stat) {
|
||||
// commit version may be smaller than min_reserved_snapshot_on_ls, which is calculated from gts
|
||||
min_split_snapshot = get_multi_version_start();
|
||||
} else if (mds::TwoPhaseCommitState::ON_COMMIT == trans_stat) {
|
||||
min_split_snapshot = user_data.start_split_commit_version_;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTablet::write_sync_tablet_seq_log(ObTabletAutoincSeq &autoinc_seq,
|
||||
const bool is_tablet_creating,
|
||||
share::SCN &scn)
|
||||
|
@ -931,6 +931,7 @@ private:
|
||||
common::ObIAllocator &allocator,
|
||||
storage::ObMetaDiskAddr &addr,
|
||||
char *&buf) const;
|
||||
int get_kept_snapshot_for_split(int64_t &min_split_snapshot) const;
|
||||
public:
|
||||
static constexpr int32_t VERSION_V1 = 1;
|
||||
static constexpr int32_t VERSION_V2 = 2;
|
||||
|
@ -105,7 +105,7 @@ public:
|
||||
share::SCN delete_commit_scn_; // delete tx commit log scn
|
||||
int64_t delete_commit_version_; // delete tx commit trans version
|
||||
int64_t start_transfer_commit_version_; // start transfer commit trans version(transfer in/transfer out)
|
||||
int64_t start_split_commit_version_; // start split commit trans version TODO(lihongqin.lhq): master占位
|
||||
int64_t start_split_commit_version_; // start split commit trans version
|
||||
};
|
||||
|
||||
inline bool ObTabletCreateDeleteMdsUserData::is_valid() const
|
||||
|
Loading…
x
Reference in New Issue
Block a user