patch backup piece to 3.1. open source
This commit is contained in:
@ -21,20 +21,33 @@ namespace oceanbase {
|
||||
namespace share {
|
||||
class ObRsMgr;
|
||||
class ObBackupDestDetector;
|
||||
|
||||
struct ObLogArchiveSimpleInfo final {
|
||||
int64_t update_ts_;
|
||||
int64_t checkpoint_ts_;
|
||||
int64_t start_ts_;
|
||||
share::ObLogArchiveStatus::STATUS status_;
|
||||
uint64_t tenant_id_;
|
||||
int64_t cur_piece_id_;
|
||||
int64_t cur_piece_create_date_;
|
||||
bool is_piece_freezing_; // if true, prev piece is valid
|
||||
int64_t prev_piece_id_;
|
||||
int64_t prev_piece_create_date_;
|
||||
|
||||
ObLogArchiveSimpleInfo();
|
||||
void reset();
|
||||
bool is_valid() const;
|
||||
bool is_piece_freezing() const
|
||||
{
|
||||
return is_piece_freezing_;
|
||||
}
|
||||
TO_STRING_KV(K_(update_ts), K_(checkpoint_ts), K_(start_ts), K_(status), K_(tenant_id), K_(cur_piece_id),
|
||||
K_(cur_piece_create_date), K_(is_piece_freezing), K_(prev_piece_id), K_(prev_piece_create_date));
|
||||
};
|
||||
|
||||
// 用于切主后确认pg的checkpoint ts,可能会触发内部表的访问。
|
||||
class ObLogArchiveInfoMgr final {
|
||||
public:
|
||||
struct ObLogArchiveSimpleInfo final {
|
||||
int64_t update_ts_;
|
||||
int64_t checkpoint_ts_;
|
||||
int64_t start_ts_;
|
||||
share::ObLogArchiveStatus::STATUS status_;
|
||||
uint64_t tenant_id_;
|
||||
|
||||
ObLogArchiveSimpleInfo();
|
||||
void reset();
|
||||
bool is_valid() const;
|
||||
TO_STRING_KV(K_(update_ts), K_(checkpoint_ts), K_(start_ts), K_(status), K_(tenant_id));
|
||||
};
|
||||
static ObLogArchiveInfoMgr& get_instance();
|
||||
|
||||
int init(common::ObMySQLProxy& sql_proxy);
|
||||
@ -70,24 +83,34 @@ public:
|
||||
void wait();
|
||||
void destroy();
|
||||
int get_log_archive_backup_info(ObLogArchiveBackupInfo& info);
|
||||
int get_log_archive_backup_info_and_piece(
|
||||
ObLogArchiveBackupInfo& new_backup_info, ObNonFrozenBackupPieceInfo& new_backup_piece);
|
||||
int get_backup_snapshot_version(int64_t& snapshot_version);
|
||||
int get_log_archive_checkpoint(int64_t& snapshot_version);
|
||||
int record_drop_tenant_log_archive_history(const uint64_t tenant_id);
|
||||
int get_delay_delete_schema_version(const uint64_t tenant_id,
|
||||
share::schema::ObMultiVersionSchemaService& schema_service, bool& is_backup, int64_t& reserved_schema_version);
|
||||
int check_if_doing_backup(bool& is_doing);
|
||||
int check_if_doing_backup_backup(bool& is_doing);
|
||||
int get_restore_info(const uint64_t tenant_id, ObPhysicalRestoreInfo& info);
|
||||
int get_restore_info(
|
||||
const bool need_valid_restore_schema_version, const uint64_t tenant_id, ObPhysicalRestoreInfo& info);
|
||||
int get_restore_status(const uint64_t tenant_id, PhysicalRestoreStatus& status);
|
||||
int get_restore_job_id(const uint64_t tenant_id, int64_t& job_id);
|
||||
int get_restore_piece_list(const uint64_t tenant_id, common::ObIArray<share::ObSimpleBackupPiecePath>& piece_list);
|
||||
int get_restore_set_list(const uint64_t tenant_id, common::ObIArray<share::ObSimpleBackupSetPath>& set_list);
|
||||
int reload();
|
||||
int is_base_backup_start(bool& is_started);
|
||||
int get_base_data_restore_schema_version(const uint64_t tenant_id, int64_t& schema_version);
|
||||
static int fetch_sys_log_archive_backup_info_and_piece(common::ObMySQLProxy& sql_proxy,
|
||||
ObLogArchiveBackupInfo& new_backup_info, ObNonFrozenBackupPieceInfo& new_backup_piece);
|
||||
int64_t get_log_archive_checkpoint_interval() const;
|
||||
|
||||
private:
|
||||
static const int64_t DEFAULT_UPDATE_INTERVAL_US = 10 * 1000 * 1000; // 10s
|
||||
int get_restore_info_from_cache(const uint64_t tenant_id, ObSimplePhysicalRestoreJob& simple_job_info);
|
||||
int get_restore_status_from_cache(const uint64_t tenant_id, PhysicalRestoreStatus& status);
|
||||
int check_backup_dest_(ObLogArchiveBackupInfo& backup_info);
|
||||
int update_log_archive_checkpoint_interval_();
|
||||
|
||||
private:
|
||||
ObBackupInfoMgr();
|
||||
@ -109,14 +132,18 @@ private:
|
||||
ObBackupInfoUpdateTask update_task_;
|
||||
ObLogArchiveBackupInfo backup_infos_[2];
|
||||
ObLogArchiveBackupInfo* cur_backup_info_;
|
||||
ObNonFrozenBackupPieceInfo backup_pieces_[2];
|
||||
ObNonFrozenBackupPieceInfo* cur_backup_piece_;
|
||||
RestoreJobArray restore_jobs_[2];
|
||||
RestoreJobArray* cur_restore_job_;
|
||||
bool is_base_backup_started_[2];
|
||||
bool* cur_base_backup_started_;
|
||||
common::SpinRWLock lock_;
|
||||
lib::ObMutex mutex_;
|
||||
bool is_loaded_;
|
||||
bool is_backup_loaded_;
|
||||
bool is_restore_loaded_;
|
||||
ObBackupDestDetector* backup_dest_detector_;
|
||||
int64_t log_archive_checkpoint_interval_;
|
||||
DISALLOW_COPY_AND_ASSIGN(ObBackupInfoMgr);
|
||||
};
|
||||
|
||||
@ -131,11 +158,22 @@ public:
|
||||
const char* backup_tenant_name_;
|
||||
int64_t restore_timestamp_;
|
||||
const char* passwd_array_;
|
||||
common::ObArray<share::ObSimpleBackupSetPath> backup_set_path_list_;
|
||||
common::ObArray<share::ObSimpleBackupPiecePath> backup_piece_path_list_;
|
||||
|
||||
int get_largest_backup_set_path(share::ObSimpleBackupSetPath& simple_path) const;
|
||||
int get_smallest_backup_piece_path(share::ObSimpleBackupPiecePath& simple_path) const;
|
||||
};
|
||||
static int get_restore_backup_info(const GetRestoreBackupInfoParam& param, ObRestoreBackupInfo& info);
|
||||
|
||||
static int get_restore_sys_table_ids(
|
||||
const ObPhysicalRestoreInfo& info, common::ObIArray<common::ObPartitionKey>& pkey_list);
|
||||
|
||||
private:
|
||||
// get info from cluster backup dest level
|
||||
static int get_restore_backup_info_v1_(const GetRestoreBackupInfoParam& param, ObRestoreBackupInfo& info);
|
||||
// get info from simple path level
|
||||
static int get_restore_backup_info_v2_(const GetRestoreBackupInfoParam& param, ObRestoreBackupInfo& info);
|
||||
};
|
||||
|
||||
class ObRestoreFatalErrorReporter : public share::ObThreadPool {
|
||||
|
||||
Reference in New Issue
Block a user