fix standby tenant archive and remove lag target
This commit is contained in:
parent
e4e4dea9c1
commit
26d0ec3d60
@ -304,7 +304,7 @@ int ObLSArchiveTask::get_max_archive_info(const ArchiveKey &key,
|
||||
info.incarnation_ = key.incarnation_;
|
||||
info.start_lsn_ = piece_min_lsn.val_;
|
||||
info.start_scn_ = piece_start_scn;
|
||||
info.checkpoint_scn_ = scn > piece_start_scn ? scn : piece_start_scn;
|
||||
info.checkpoint_scn_ = scn;
|
||||
info.lsn_ = lsn.val_;
|
||||
info.input_bytes_ = static_cast<int64_t>(info.lsn_ - info.start_lsn_);
|
||||
info.output_bytes_ = info.input_bytes_;
|
||||
|
@ -190,6 +190,8 @@ int ObDestRoundCheckpointer::gen_new_round_info_(const ObTenantArchiveRoundAttr
|
||||
} else if (old_round_info.state_.is_beginning()) {
|
||||
if (counter.not_start_cnt_ > 0) {
|
||||
need_checkpoint = false;
|
||||
} else if (next_checkpoint_scn < old_round_info.start_scn_) {
|
||||
need_checkpoint = false;
|
||||
} else if (OB_FALSE_IT(new_round_info.checkpoint_scn_ = next_checkpoint_scn)) {
|
||||
} else if (counter.interrupted_cnt_ > 0) {
|
||||
ObSqlString comment;
|
||||
@ -274,7 +276,7 @@ int ObDestRoundCheckpointer::generate_pieces_(const ObTenantArchiveRoundAttr &ol
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
if (result.new_round_info_.max_scn_ == old_round_info.start_scn_) {
|
||||
if (old_round_info.state_ == result.new_round_info_.state_ && result.new_round_info_.max_scn_ == old_round_info.start_scn_) {
|
||||
// No log stream started archive before disable archive, then no piece generated in the round.
|
||||
LOG_INFO("no piece generated.", K(old_round_info), K(result));
|
||||
} else {
|
||||
|
@ -288,32 +288,6 @@ int ObArchivePersistHelper::get_binding(common::ObISQLClient &proxy, const bool
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObArchivePersistHelper::get_lag_target(common::ObISQLClient &proxy, const bool need_lock, const int64_t dest_no,
|
||||
int64_t &lag_target) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
common::ObSqlString value;
|
||||
const common::ObString str(OB_STR_LAG_TARGET);
|
||||
ObLogArchiveDestAtrr dest_attr;
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("ObArchivePersistHelper not init", K(ret));
|
||||
} else if (OB_FAIL(get_string_value(proxy, dest_no, need_lock, str, value))) {
|
||||
if (OB_ENTRY_NOT_EXIST == ret) {
|
||||
// not exist, use default
|
||||
lag_target = OB_DEFAULT_LAG_TARGET;
|
||||
ret = OB_SUCCESS;
|
||||
} else {
|
||||
LOG_WARN("fail to get string value", K(ret));
|
||||
}
|
||||
} else if (OB_FAIL(dest_attr.set_lag_target(value.ptr()))) {
|
||||
LOG_WARN("fail to set checkpoint interval", K(ret), K(value));
|
||||
} else {
|
||||
lag_target = dest_attr.lag_target_;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObArchivePersistHelper::get_dest_state(
|
||||
common::ObISQLClient &proxy,
|
||||
const bool need_lock,
|
||||
|
@ -85,8 +85,6 @@ public:
|
||||
int get_binding(common::ObISQLClient &proxy, const bool need_lock, const int64_t dest_no,
|
||||
ObLogArchiveDestAtrr::Binding &binding) const;
|
||||
|
||||
int get_lag_target(common::ObISQLClient &proxy, const bool need_lock, const int64_t dest_no,
|
||||
int64_t &lag_target) const;
|
||||
|
||||
int get_dest_state(common::ObISQLClient &proxy, const bool need_lock, const int64_t dest_no,
|
||||
ObLogArchiveDestState &state) const;
|
||||
|
@ -687,10 +687,6 @@ int ObLogArchiveDestConfigParser::do_parse_sub_config_(const common::ObString &c
|
||||
if (OB_FAIL(do_parse_piece_switch_interval_(token, saveptr))) {
|
||||
LOG_WARN("fail to do parse piece switch interval", K(ret), K(token), K(saveptr));
|
||||
}
|
||||
} else if (0 == STRCASECMP(token, OB_STR_LAG_TARGET)) {
|
||||
if (OB_FAIL(do_parse_lag_target_(token, saveptr))) {
|
||||
LOG_WARN("fail to do parse lag target", K(ret), K(token), K(saveptr));
|
||||
}
|
||||
} else if (0 == STRCASECMP(token, OB_STR_COMPRESSION)) {
|
||||
if (OB_FAIL(do_parse_compression_(token, saveptr))) {
|
||||
LOG_WARN("fail to do parse compression", K(ret), K(token), K(saveptr));
|
||||
@ -753,21 +749,6 @@ int ObLogArchiveDestConfigParser::do_parse_piece_switch_interval_(const common::
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLogArchiveDestConfigParser::do_parse_lag_target_(const common::ObString &name, const common::ObString &value)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (name.empty() || value.empty()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid log archve dest config", K(ret), K(name), K(value));
|
||||
} else if (OB_FAIL(archive_dest_.set_lag_target(value.ptr()))) {
|
||||
LOG_WARN("fail to set piece switch interval", K(ret), K(value));
|
||||
} else if (!archive_dest_.is_lag_target_valid()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("piece switch interval is not valid", K(ret), K(value));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLogArchiveDestConfigParser::do_parse_compression_(const common::ObString &name, const common::ObString &value)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -192,7 +192,6 @@ protected:
|
||||
virtual int do_parse_sub_config_(const common::ObString &config_str);
|
||||
int do_parse_log_archive_dest_(const common::ObString &dest_type_str, const common::ObString &url);
|
||||
int do_parse_piece_switch_interval_(const common::ObString &name, const common::ObString &value);
|
||||
int do_parse_lag_target_(const common::ObString &name, const common::ObString &value);
|
||||
int do_parse_compression_(const common::ObString &name, const common::ObString &value);
|
||||
int do_parse_log_archive_mode_(const common::ObString &name, const common::ObString &value);
|
||||
int update_archive_dest_config_(common::ObISQLClient &trans);
|
||||
|
@ -4259,7 +4259,6 @@ ObLogArchiveDestAtrr::ObLogArchiveDestAtrr()
|
||||
binding_ = Binding::OPTIONAL;
|
||||
dest_id_ = 0;
|
||||
piece_switch_interval_ = OB_DEFAULT_PIECE_SWITCH_INTERVAL;
|
||||
lag_target_ = OB_DEFAULT_LAG_TARGET;
|
||||
state_.set_enable();
|
||||
}
|
||||
|
||||
@ -4279,22 +4278,6 @@ int ObLogArchiveDestAtrr::set_piece_switch_interval(const char *buf)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLogArchiveDestAtrr::set_lag_target(const char *buf)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool is_valid = false;
|
||||
if (OB_ISNULL(buf)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid args", K(ret), KP(buf));
|
||||
} else if (OB_FALSE_IT(lag_target_ = ObConfigTimeParser::get(buf, is_valid))) {
|
||||
} else if (!is_valid || !is_lag_target_valid()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
lag_target_ = 0;
|
||||
LOG_WARN("invalid lag_target", K(ret), K(buf));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLogArchiveDestAtrr::set_log_archive_dest(const common::ObString &str)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -4339,7 +4322,6 @@ bool ObLogArchiveDestAtrr::is_valid() const
|
||||
return is_dest_valid()
|
||||
&& dest_id_ > 0
|
||||
&& is_piece_switch_interval_valid()
|
||||
&& is_lag_target_valid()
|
||||
&& state_.is_valid();
|
||||
};
|
||||
|
||||
@ -4353,12 +4335,6 @@ bool ObLogArchiveDestAtrr::is_piece_switch_interval_valid() const
|
||||
return piece_switch_interval_ >= OB_MIN_LOG_ARCHIVE_PIECE_SWITH_INTERVAL;
|
||||
}
|
||||
|
||||
bool ObLogArchiveDestAtrr::is_lag_target_valid() const
|
||||
{
|
||||
return lag_target_ >= OB_MIN_LAG_TARGET
|
||||
&& lag_target_ <= OB_MAX_LAG_TARGET;
|
||||
}
|
||||
|
||||
int ObLogArchiveDestAtrr::gen_config_items(common::ObIArray<BackupConfigItemPair> &items) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -4415,18 +4391,6 @@ int ObLogArchiveDestAtrr::gen_config_items(common::ObIArray<BackupConfigItemPair
|
||||
LOG_WARN("failed to push backup config", K(ret));
|
||||
}
|
||||
|
||||
// gen lag_target config
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_FAIL(config.key_.assign(OB_STR_LAG_TARGET))) {
|
||||
LOG_WARN("failed to assign key", K(ret));
|
||||
} else if (OB_FAIL(get_lag_target(tmp.ptr(), tmp.capacity()))) {
|
||||
LOG_WARN("failed to get lag target", K(ret));
|
||||
} else if (OB_FAIL(config.value_.assign(tmp.ptr()))) {
|
||||
LOG_WARN("failed to assign value", K(ret));
|
||||
} else if(OB_FAIL(items.push_back(config))) {
|
||||
LOG_WARN("failed to push backup config", K(ret));
|
||||
}
|
||||
|
||||
// gen state config
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_FAIL(config.key_.assign(OB_STR_STATE))) {
|
||||
@ -4480,11 +4444,6 @@ int ObLogArchiveDestAtrr::get_piece_switch_interval(char *buf, int64_t len) cons
|
||||
return ObBackupUtils::convert_timestamp_to_timestr(piece_switch_interval_, buf, len);
|
||||
}
|
||||
|
||||
int ObLogArchiveDestAtrr::get_lag_target(char *buf, int64_t len) const
|
||||
{
|
||||
return ObBackupUtils::convert_timestamp_to_timestr(lag_target_, buf, len);
|
||||
}
|
||||
|
||||
int ObLogArchiveDestAtrr::assign(const ObLogArchiveDestAtrr& that)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -4495,7 +4454,6 @@ int ObLogArchiveDestAtrr::assign(const ObLogArchiveDestAtrr& that)
|
||||
binding_ = that.binding_;
|
||||
dest_id_ = that.dest_id_;
|
||||
piece_switch_interval_ = that.piece_switch_interval_;
|
||||
lag_target_ = that.lag_target_;
|
||||
if (OB_FAIL(dest_.deep_copy(that.dest_))) {
|
||||
LOG_WARN("fail to deep copy dest", K(ret));
|
||||
} else if (OB_FAIL(state_.assign(that.state_))) {
|
||||
|
@ -1691,30 +1691,26 @@ struct ObLogArchiveDestAtrr final
|
||||
~ObLogArchiveDestAtrr() {}
|
||||
|
||||
int set_piece_switch_interval(const char *buf);
|
||||
int set_lag_target(const char *buf);
|
||||
int set_log_archive_dest(const common::ObString &str);
|
||||
int set_binding(const char *buf);
|
||||
|
||||
bool is_valid() const;
|
||||
bool is_dest_valid() const;
|
||||
bool is_piece_switch_interval_valid() const;
|
||||
bool is_lag_target_valid() const;
|
||||
|
||||
int get_binding(char *buf, int64_t len) const;
|
||||
int get_piece_switch_interval(char *buf, int64_t len) const;
|
||||
int get_lag_target(char *buf, int64_t len) const;
|
||||
|
||||
int gen_config_items(common::ObIArray<BackupConfigItemPair> &items) const;
|
||||
int gen_path_config_items(common::ObIArray<BackupConfigItemPair> &items) const;
|
||||
|
||||
int assign(const ObLogArchiveDestAtrr& that);
|
||||
|
||||
TO_STRING_KV(K_(dest), K_(binding), K_(dest_id), K_(piece_switch_interval), K_(lag_target), K_(state));
|
||||
TO_STRING_KV(K_(dest), K_(binding), K_(dest_id), K_(piece_switch_interval), K_(state));
|
||||
share::ObBackupDest dest_;
|
||||
Binding binding_;
|
||||
int64_t dest_id_;
|
||||
int64_t piece_switch_interval_;
|
||||
int64_t lag_target_;
|
||||
ObLogArchiveDestState state_;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user