提交 2aa1574b 编写于 作者: O obdev 提交者: wangzelin.wzl

cherry-pick from 3_1_x_release to 3.1_opensource_release

上级 7eb645fb
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "rootserver/ob_schema_history_recycler.h" #include "rootserver/ob_schema_history_recycler.h"
#include "rootserver/ob_rs_async_rpc_proxy.h" #include "rootserver/ob_rs_async_rpc_proxy.h"
#include "rootserver/ob_rs_event_history_table_operator.h" #include "rootserver/ob_rs_event_history_table_operator.h"
#include "storage/ob_freeze_info_snapshot_mgr.h"
namespace oceanbase { namespace oceanbase {
namespace rootserver { namespace rootserver {
...@@ -658,6 +659,19 @@ int ObSchemaHistoryRecycler::get_recycle_schema_version_by_global_stat( ...@@ -658,6 +659,19 @@ int ObSchemaHistoryRecycler::get_recycle_schema_version_by_global_stat(
K(reserved_schema_version)); K(reserved_schema_version));
} }
} }
if (OB_SUCC(ret)) {
int64_t schema_version = 0;
for (int64_t i = 0; OB_SUCC(ret) && i < tenant_ids.count(); i++) {
const uint64_t tenant_id = tenant_ids.at(i);
if (OB_FAIL(storage::ObFreezeInfoMgrWrapper::get_instance().get_restore_point_min_schema_version(
tenant_id, schema_version))) {
LOG_WARN("fail to get restore point min_schema_version", K(ret), K(tenant_id));
} else if (INT64_MAX != schema_version &&
OB_FAIL(fill_recycle_schema_versions(tenant_id, schema_version, recycle_schema_versions))) {
LOG_WARN("fail to fill recycle schema versions", KR(ret), K(tenant_id), K(schema_version));
}
}
}
} }
return ret; return ret;
} }
......
...@@ -560,7 +560,22 @@ int ObFreezeInfoSnapshotMgr::get_reserve_points(const int64_t tenant_id, const s ...@@ -560,7 +560,22 @@ int ObFreezeInfoSnapshotMgr::get_reserve_points(const int64_t tenant_id, const s
return ret; return ret;
} }
int ObFreezeInfoSnapshotMgr::get_latest_freeze_version(int64_t& freeze_version) int ObFreezeInfoSnapshotMgr::get_restore_point_min_schema_version(const int64_t tenant_id, int64_t &schema_version)
{
int ret = OB_SUCCESS;
schema_version = INT64_MAX;
RLockGuard lock_guard(lock_);
ObIArray<ObSnapshotInfo> &snapshots = snapshots_[cur_idx_];
for (int64_t i = 0; i < snapshots.count() && OB_SUCC(ret); ++i) {
const ObSnapshotInfo &snapshot = snapshots.at(i);
if (snapshot.snapshot_type_ == SNAPSHOT_FOR_RESTORE_POINT && tenant_id == snapshot.tenant_id_) {
schema_version = std::min(snapshot.schema_version_, schema_version);
}
}
return ret;
}
int ObFreezeInfoSnapshotMgr::get_latest_freeze_version(int64_t &freeze_version)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
......
...@@ -148,30 +148,51 @@ public: ...@@ -148,30 +148,51 @@ public:
int64_t get_latest_frozen_timestamp(); int64_t get_latest_frozen_timestamp();
// no schema version is returned if you do not give the tenant id // no schema version is returned if you do not give the tenant id
int get_freeze_info_by_major_version(const int64_t major_version, FreezeInfoLite& freeze_info); int get_freeze_info_by_major_version(const int64_t major_version,
int get_freeze_info_by_major_version(const uint64_t table_id, const int64_t major_version, FreezeInfo& freeze_info); FreezeInfoLite &freeze_info);
int get_freeze_info_by_major_version( int get_freeze_info_by_major_version(const uint64_t table_id,
const int64_t major_version, FreezeInfoLite& freeze_info, bool& is_first_major_version); const int64_t major_version,
int get_freeze_info_behind_major_version(const int64_t major_version, common::ObIArray<FreezeInfoLite>& freeze_infos); FreezeInfo &freeze_info);
int get_freeze_info_by_major_version(const int64_t major_version,
int get_tenant_freeze_info_by_major_version( FreezeInfoLite &freeze_info,
const uint64_t tenant_id, const int64_t major_version, FreezeInfo& freeze_info); bool &is_first_major_version);
int get_freeze_info_behind_major_version(const int64_t major_version,
int get_freeze_info_by_snapshot_version(const int64_t snapshot_version, FreezeInfoLite& freeze_info); common::ObIArray<FreezeInfoLite> &freeze_infos);
int get_freeze_info_by_snapshot_version(
const uint64_t table_id, const int64_t snapshot_version, FreezeInfo& freeze_info); int get_tenant_freeze_info_by_major_version(const uint64_t tenant_id,
const int64_t major_version,
int get_neighbour_major_freeze(const int64_t snapshot_version, NeighbourFreezeInfoLite& info); FreezeInfo &freeze_info);
int get_neighbour_major_freeze(const uint64_t table_id, const int64_t snapshot_version, NeighbourFreezeInfo& info);
int get_freeze_info_by_snapshot_version(const int64_t snapshot_version,
int get_min_reserved_snapshot(const common::ObPartitionKey& pkey, const int64_t merged_version, FreezeInfoLite &freeze_info);
const int64_t schema_version, int64_t& snapshot_version, int64_t& backup_snapshot_version); int get_freeze_info_by_snapshot_version(const uint64_t table_id,
int get_reserve_points(const int64_t tenant_id, const share::ObSnapShotType snapshot_type, const int64_t snapshot_version,
common::ObIArray<share::ObSnapshotInfo>& restore_points, int64_t& snapshot_gc_ts); FreezeInfo &freeze_info);
int update_info(const int64_t snapshot_gc_ts, const common::ObIArray<SchemaPair>& gc_schema_version,
const common::ObIArray<FreezeInfoLite>& info_list, const common::ObIArray<share::ObSnapshotInfo>& snapshots, int get_neighbour_major_freeze(const int64_t snapshot_version,
const int64_t backup_snapshot_version, const int64_t delay_delete_snapshot_version, NeighbourFreezeInfoLite &info);
const int64_t min_major_version, bool& changed); int get_neighbour_major_freeze(const uint64_t table_id,
const int64_t snapshot_version,
NeighbourFreezeInfo &info);
int get_min_reserved_snapshot(const common::ObPartitionKey &pkey,
const int64_t merged_version,
const int64_t schema_version,
int64_t &snapshot_version,
int64_t &backup_snapshot_version);
int get_reserve_points(const int64_t tenant_id,
const share::ObSnapShotType snapshot_type,
common::ObIArray<share::ObSnapshotInfo> &restore_points,
int64_t &snapshot_gc_ts);
int get_restore_point_min_schema_version(const int64_t tenant_id, int64_t &schema_version);
int update_info(const int64_t snapshot_gc_ts,
const common::ObIArray<SchemaPair> &gc_schema_version,
const common::ObIArray<FreezeInfoLite> &info_list,
const common::ObIArray<share::ObSnapshotInfo> &snapshots,
const int64_t backup_snapshot_version,
const int64_t delay_delete_snapshot_version,
const int64_t min_major_version,
bool& changed);
int64_t get_snapshot_gc_ts(); int64_t get_snapshot_gc_ts();
int get_local_backup_snapshot_version(int64_t& backup_snapshot_version); int get_local_backup_snapshot_version(int64_t& backup_snapshot_version);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册