add ddl inc start and commit log record
This commit is contained in:
parent
7e4d77ff69
commit
1c4a992ee1
@ -26,20 +26,21 @@ using namespace share;
|
||||
using namespace common;
|
||||
|
||||
ObDDLIncStartClogCb::ObDDLIncStartClogCb()
|
||||
: is_inited_(false), log_basic_(), scn_(SCN::min_scn())
|
||||
: is_inited_(false), ls_id_(), log_basic_(), scn_(SCN::min_scn())
|
||||
{
|
||||
}
|
||||
|
||||
int ObDDLIncStartClogCb::init(const ObDDLIncLogBasic& log_basic)
|
||||
int ObDDLIncStartClogCb::init(const ObLSID &ls_id, const ObDDLIncLogBasic &log_basic)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (IS_INIT) {
|
||||
ret = OB_INIT_TWICE;
|
||||
LOG_WARN("init twice", K(ret));
|
||||
} else if (OB_UNLIKELY(!log_basic.is_valid())) {
|
||||
} else if (OB_UNLIKELY(!ls_id.is_valid() || !log_basic.is_valid())) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid argument", K(ret), K(log_basic));
|
||||
LOG_WARN("invalid argument", K(ret), K(ls_id), K(log_basic));
|
||||
} else {
|
||||
ls_id_ = ls_id;
|
||||
log_basic_ = log_basic;
|
||||
is_inited_ = true;
|
||||
}
|
||||
@ -55,7 +56,7 @@ int ObDDLIncStartClogCb::on_success()
|
||||
status_.set_ret_code(ret);
|
||||
status_.set_state(STATE_SUCCESS);
|
||||
try_release();
|
||||
|
||||
FLOG_INFO("write ddl inc start log success", K(ls_id_), K(scn_), K(log_basic_));
|
||||
return OB_SUCCESS;
|
||||
}
|
||||
|
||||
@ -184,7 +185,7 @@ ObDDLIncCommitClogCb::ObDDLIncCommitClogCb()
|
||||
{
|
||||
}
|
||||
|
||||
int ObDDLIncCommitClogCb::init(const share::ObLSID &ls_id, const ObDDLIncLogBasic &log_basic)
|
||||
int ObDDLIncCommitClogCb::init(const ObLSID &ls_id, const ObDDLIncLogBasic &log_basic)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (IS_INIT) {
|
||||
@ -219,10 +220,7 @@ int ObDDLIncCommitClogCb::on_success()
|
||||
if (log_basic_.get_lob_meta_tablet_id().is_valid()) {
|
||||
(void)ls->tablet_freeze(log_basic_.get_lob_meta_tablet_id(), is_sync);
|
||||
}
|
||||
FLOG_INFO("Commit Async Tablet Freeze Task by DDL Commit Log",
|
||||
K(ls_id_),
|
||||
K(log_basic_.get_tablet_id()),
|
||||
K(log_basic_.get_lob_meta_tablet_id()));
|
||||
FLOG_INFO("write ddl inc commit log success", K(ls_id_), K(scn_), K(log_basic_));
|
||||
}
|
||||
|
||||
status_.set_ret_code(ret);
|
||||
|
@ -44,14 +44,15 @@ class ObDDLIncStartClogCb : public ObDDLIncClogCb
|
||||
public:
|
||||
ObDDLIncStartClogCb();
|
||||
virtual ~ObDDLIncStartClogCb() = default;
|
||||
int init(const ObDDLIncLogBasic &log_basic);
|
||||
int init(const share::ObLSID &ls_id, const ObDDLIncLogBasic &log_basic);
|
||||
virtual int on_success() override;
|
||||
virtual int on_failure() override;
|
||||
virtual void try_release() override;
|
||||
share::SCN get_scn() const { return scn_; }
|
||||
TO_STRING_KV(K(is_inited_), K(log_basic_));
|
||||
TO_STRING_KV(K(is_inited_), K(ls_id_), K(log_basic_), K(scn_));
|
||||
private:
|
||||
bool is_inited_;
|
||||
share::ObLSID ls_id_;
|
||||
ObDDLIncLogBasic log_basic_;
|
||||
share::SCN scn_;
|
||||
};
|
||||
@ -88,7 +89,7 @@ public:
|
||||
virtual int on_failure() override;
|
||||
virtual void try_release() override;
|
||||
share::SCN get_scn() const { return scn_; }
|
||||
TO_STRING_KV(K(is_inited_), K(log_basic_));
|
||||
TO_STRING_KV(K(is_inited_), K(ls_id_), K(log_basic_), K(scn_));
|
||||
private:
|
||||
bool is_inited_;
|
||||
share::ObLSID ls_id_;
|
||||
|
@ -146,8 +146,6 @@ int ObDDLIncRedoLogWriter::write_inc_start_log(
|
||||
LOG_WARN("fail to init DDLIncStartLog", K(ret), K(log_basic));
|
||||
} else if (OB_FAIL(local_write_inc_start_log(log, tx_desc, start_scn))) {
|
||||
LOG_WARN("local write inc start log fail", K(ret));
|
||||
} else {
|
||||
LOG_INFO("local write inc start log success", K(tablet_id_), K(lob_meta_tablet_id));
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -206,15 +204,11 @@ int ObDDLIncRedoLogWriter::write_inc_commit_log(
|
||||
} else {
|
||||
LOG_WARN("local write inc commit log fail", K(ret), K(tablet_id_));
|
||||
}
|
||||
} else {
|
||||
LOG_INFO("local write inc commit log success", K(tablet_id_), K(lob_meta_tablet_id));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && remote_write_) {
|
||||
if (OB_FAIL(retry_remote_write_inc_commit_log(lob_meta_tablet_id, tx_desc))) {
|
||||
LOG_WARN("remote write inc commit log fail", K(ret), K(tablet_id_));
|
||||
} else {
|
||||
LOG_INFO("remote write inc commit log success", K(tablet_id_), K(lob_meta_tablet_id), K(leader_addr_));
|
||||
}
|
||||
}
|
||||
|
||||
@ -421,7 +415,7 @@ int ObDDLIncRedoLogWriter::local_write_inc_start_log(
|
||||
} else if (OB_ISNULL(cb = OB_NEW(ObDDLIncStartClogCb, ObMemAttr(MTL_ID(), "DDL_IRLW")))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("fail to alloc memory", K(ret));
|
||||
} else if (OB_FAIL(cb->init(log.get_log_basic()))) {
|
||||
} else if (OB_FAIL(cb->init(ls_id_, log.get_log_basic()))) {
|
||||
LOG_WARN("failed to init cb", K(ret));
|
||||
} else if (OB_ISNULL(trans_ctx = ctx_guard.get_store_ctx().mvcc_acc_ctx_.tx_ctx_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
|
@ -1041,10 +1041,15 @@ int ObDDLIncStartReplayExecutor::do_replay_(ObTabletHandle &tablet_handle)
|
||||
}
|
||||
} else if (!need_replay) {
|
||||
// do nothing
|
||||
FLOG_INFO("no need to replay ddl inc start log", K(ls_->get_ls_id()), K(scn_), K(log_->get_log_basic()));
|
||||
} else {
|
||||
SyncTabletFreezeHelper sync_tablet_freeze(
|
||||
ls_, log_->get_log_basic().get_tablet_id(), log_->get_log_basic().get_lob_meta_tablet_id());
|
||||
return sync_tablet_freeze();
|
||||
if (OB_FAIL(sync_tablet_freeze())) {
|
||||
LOG_WARN("fail to sync tablet freeze", K(ret), K(ls_->get_ls_id()), K(scn_), K(log_->get_log_basic()));
|
||||
} else {
|
||||
FLOG_INFO("replay ddl inc start log success", K(ls_->get_ls_id()), K(scn_), K(log_->get_log_basic()));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -1096,10 +1101,15 @@ int ObDDLIncCommitReplayExecutor::do_replay_(ObTabletHandle &tablet_handle)
|
||||
}
|
||||
} else if (!need_replay) {
|
||||
// do nothing
|
||||
FLOG_INFO("no need to replay ddl inc commit log", K(ls_->get_ls_id()), K(scn_), K(log_->get_log_basic()));
|
||||
} else {
|
||||
SyncTabletFreezeHelper sync_tablet_freeze(
|
||||
ls_, log_->get_log_basic().get_tablet_id(), log_->get_log_basic().get_lob_meta_tablet_id());
|
||||
return sync_tablet_freeze();
|
||||
if (OB_FAIL(sync_tablet_freeze())) {
|
||||
LOG_WARN("fail to sync tablet freeze", K(ret), K(ls_->get_ls_id()), K(scn_), K(log_->get_log_basic()));
|
||||
} else {
|
||||
FLOG_INFO("replay ddl inc commit log success", K(ls_->get_ls_id()), K(scn_), K(log_->get_log_basic()));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user