[LS] remove create_type from ObCreateLSCommitSLog
This commit is contained in:
@ -356,7 +356,6 @@ TEST_F(ObLSBeforeRestartTest, create_unfinished_ls_with_commit_slog)
|
||||
ObLSService* ls_svr = MTL(ObLSService*);
|
||||
ObLSID id_103(103);
|
||||
palf::PalfBaseInfo palf_base_info;
|
||||
int64_t create_type = ObLSCreateType::NORMAL;
|
||||
const ObMigrationStatus migration_status = ObMigrationStatus::OB_MIGRATION_STATUS_NONE;
|
||||
|
||||
LOG_INFO("ObLSBeforeRestartTest::create_unfinished_ls_with_inner_tablet 1");
|
||||
@ -379,7 +378,7 @@ TEST_F(ObLSBeforeRestartTest, create_unfinished_ls_with_commit_slog)
|
||||
unused_allow_log_sync));
|
||||
ASSERT_EQ(OB_SUCCESS, ls->create_ls_inner_tablet(arg.get_compat_mode(),
|
||||
arg.get_create_scn()));
|
||||
ASSERT_EQ(OB_SUCCESS, ls_svr->write_commit_create_ls_slog_(ls->get_ls_id(), create_type));
|
||||
ASSERT_EQ(OB_SUCCESS, ls_svr->write_commit_create_ls_slog_(ls->get_ls_id()));
|
||||
}
|
||||
|
||||
// this ls will be offlined state after restart
|
||||
@ -418,7 +417,7 @@ TEST_F(ObLSBeforeRestartTest, create_restore_ls)
|
||||
unused_allow_log_sync));
|
||||
ASSERT_EQ(OB_SUCCESS, ls->create_ls_inner_tablet(arg.get_compat_mode(),
|
||||
arg.get_create_scn()));
|
||||
ASSERT_EQ(OB_SUCCESS, ls_svr->write_commit_create_ls_slog_(ls->get_ls_id(), create_type));
|
||||
ASSERT_EQ(OB_SUCCESS, ls_svr->write_commit_create_ls_slog_(ls->get_ls_id()));
|
||||
ASSERT_EQ(OB_SUCCESS, ls->finish_create_ls());
|
||||
ASSERT_EQ(OB_SUCCESS, ls_svr->post_create_ls_(create_type, ls));
|
||||
|
||||
@ -462,7 +461,7 @@ TEST_F(ObLSBeforeRestartTest, create_rebuild_ls)
|
||||
unused_allow_log_sync));
|
||||
ASSERT_EQ(OB_SUCCESS, ls->create_ls_inner_tablet(arg.get_compat_mode(),
|
||||
arg.get_create_scn()));
|
||||
ASSERT_EQ(OB_SUCCESS, ls_svr->write_commit_create_ls_slog_(ls->get_ls_id(), create_type));
|
||||
ASSERT_EQ(OB_SUCCESS, ls_svr->write_commit_create_ls_slog_(ls->get_ls_id()));
|
||||
ASSERT_EQ(OB_SUCCESS, ls->finish_create_ls());
|
||||
ASSERT_EQ(OB_SUCCESS, ls_svr->post_create_ls_(create_type, ls));
|
||||
|
||||
|
||||
@ -149,30 +149,6 @@ DEF_TO_STRING(ObLSIDLog)
|
||||
|
||||
OB_SERIALIZE_MEMBER(ObLSIDLog, ls_id_);
|
||||
|
||||
ObCreateLSCommitSLog::ObCreateLSCommitSLog(ObLSID &ls_id,
|
||||
const int64_t create_type)
|
||||
: ObLSIDLog(ls_id),
|
||||
create_type_(create_type)
|
||||
{
|
||||
}
|
||||
|
||||
bool ObCreateLSCommitSLog::is_valid() const
|
||||
{
|
||||
return ObLSIDLog::is_valid();
|
||||
}
|
||||
|
||||
DEF_TO_STRING(ObCreateLSCommitSLog)
|
||||
{
|
||||
int64_t pos = 0;
|
||||
J_OBJ_START();
|
||||
J_KV(K_(ls_id));
|
||||
J_KV(K_(create_type));
|
||||
J_OBJ_END();
|
||||
return pos;
|
||||
}
|
||||
|
||||
OB_SERIALIZE_MEMBER_INHERIT(ObCreateLSCommitSLog, ObLSIDLog, create_type_);
|
||||
|
||||
ObCreateTabletLog::ObCreateTabletLog(ObTablet *tablet)
|
||||
: tablet_(tablet)
|
||||
{
|
||||
|
||||
@ -179,21 +179,9 @@ protected:
|
||||
|
||||
using ObCreateLSPrepareSlog = ObLSMetaLog;
|
||||
using ObCreateLSAbortSLog = ObLSIDLog;
|
||||
using ObCreateLSCommitSLog = ObLSIDLog;
|
||||
using ObDeleteLSLog = ObLSIDLog;
|
||||
|
||||
struct ObCreateLSCommitSLog: public ObLSIDLog
|
||||
{
|
||||
OB_UNIS_VERSION(1);
|
||||
public:
|
||||
ObCreateLSCommitSLog(share::ObLSID &ls_id, const int64_t create_type);
|
||||
virtual ~ObCreateLSCommitSLog() {}
|
||||
virtual bool is_valid() const override;
|
||||
int64_t get_create_type() const { return create_type_; }
|
||||
DECLARE_TO_STRING;
|
||||
private:
|
||||
int64_t create_type_;
|
||||
};
|
||||
|
||||
struct ObCreateTabletLog : public ObIBaseStorageLogEntry
|
||||
{
|
||||
public:
|
||||
|
||||
@ -1215,13 +1215,12 @@ int ObTenantCheckpointSlogHandler::inner_replay_create_ls_commit_slog(
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
ObLSID ls_id;
|
||||
int64_t create_type = ObLSCreateType::NORMAL;
|
||||
ObCreateLSCommitSLog slog_entry(ls_id, create_type);
|
||||
ObCreateLSCommitSLog slog_entry(ls_id);
|
||||
int64_t pos = 0;
|
||||
const bool is_replay = true;
|
||||
if (OB_FAIL(slog_entry.deserialize(param.buf_, param.disk_addr_.size(), pos))) {
|
||||
LOG_WARN("fail to deserialize slog", K(ret), K(param), K(pos));
|
||||
} else if (OB_FAIL(MTL(ObLSService *)->replay_create_ls_commit(ls_id, slog_entry.get_create_type()))) {
|
||||
} else if (OB_FAIL(MTL(ObLSService *)->replay_create_ls_commit(ls_id))) {
|
||||
LOG_WARN("fail to replay create ls commit slog", K(ret), K(param), K(pos));
|
||||
} else {
|
||||
LOG_INFO("successfully replay create ls commit slog");
|
||||
|
||||
@ -349,12 +349,11 @@ int ObLSService::write_prepare_create_ls_slog_(const ObLSMeta &ls_meta) const
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLSService::write_commit_create_ls_slog_(const share::ObLSID &ls_id,
|
||||
const int64_t create_type) const
|
||||
int ObLSService::write_commit_create_ls_slog_(const share::ObLSID &ls_id) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
share::ObLSID tmp_ls_id = ls_id;
|
||||
ObCreateLSCommitSLog slog_entry(tmp_ls_id, create_type);
|
||||
ObCreateLSCommitSLog slog_entry(tmp_ls_id);
|
||||
ObStorageLogParam log_param;
|
||||
ObStorageLogger *slogger = MTL(ObStorageLogger*);
|
||||
log_param.data_ = &slog_entry;
|
||||
@ -587,13 +586,13 @@ int ObLSService::replay_remove_ls(const share::ObLSID &ls_id)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObLSService::replay_create_ls_commit(const share::ObLSID &ls_id,
|
||||
const int64_t create_type)
|
||||
int ObLSService::replay_create_ls_commit(const share::ObLSID &ls_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
ObLS *ls = nullptr;
|
||||
ObLSHandle ls_handle;
|
||||
int64_t create_type;
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("the ls service has not been inited", K(ret));
|
||||
@ -607,6 +606,9 @@ int ObLSService::replay_create_ls_commit(const share::ObLSID &ls_id,
|
||||
LOG_WARN("ls is null", K(ls_id));
|
||||
} else {
|
||||
ObLSLockGuard lock_ls(ls);
|
||||
if (OB_FAIL(ls->get_create_type(create_type))) {
|
||||
LOG_WARN("get ls create type failed", K(ret));
|
||||
} else {
|
||||
switch(create_type) {
|
||||
case ObLSCreateType::NORMAL: {
|
||||
if (OB_FAIL(ls->set_start_work_state())) {
|
||||
@ -638,6 +640,7 @@ int ObLSService::replay_create_ls_commit(const share::ObLSID &ls_id,
|
||||
}
|
||||
} // default
|
||||
} // switch
|
||||
}
|
||||
FLOG_INFO("replay create ls", KR(ret), K(ls_id));
|
||||
}
|
||||
return ret;
|
||||
@ -1077,8 +1080,7 @@ int ObLSService::create_ls_(const ObCreateLSCommonArg &arg,
|
||||
arg.create_scn_))) {
|
||||
LOG_WARN("create ls inner tablet failed", K(ret), K(ls_meta));
|
||||
} else if (FALSE_IT(state = ObLSCreateState::CREATE_STATE_INNER_TABLET_CREATED)) {
|
||||
} else if (OB_BREAK_FAIL(write_commit_create_ls_slog_(ls->get_ls_id(),
|
||||
arg.create_type_))) {
|
||||
} else if (OB_BREAK_FAIL(write_commit_create_ls_slog_(ls->get_ls_id()))) {
|
||||
LOG_WARN("fail to write create log stream commit slog", K(ret), K(ls_meta));
|
||||
} else if (OB_BREAK_FAIL(ls->finish_create_ls())) {
|
||||
LOG_WARN("finish create ls failed", KR(ret));
|
||||
|
||||
@ -83,8 +83,7 @@ public:
|
||||
int replay_create_ls(const ObLSMeta &ls_meta);
|
||||
// replay create ls commit slog.
|
||||
// @param [in] ls_id, the create process of which is committed.
|
||||
// @param [in] create_type, the create type, it is maybe a normal ls/migrate ls/restore ls
|
||||
int replay_create_ls_commit(const share::ObLSID &ls_id, const int64_t create_type);
|
||||
int replay_create_ls_commit(const share::ObLSID &ls_id);
|
||||
// create a LS for replay or update LS's meta
|
||||
// @param [in] ls_meta, all the parameters that is needed to create a LS for replay
|
||||
int replay_update_ls(const ObLSMeta &ls_meta);
|
||||
@ -187,8 +186,7 @@ private:
|
||||
int inner_del_ls_(ObLS *&ls);
|
||||
int add_ls_to_map_(ObLS *ls);
|
||||
int write_prepare_create_ls_slog_(const ObLSMeta &ls_meta) const;
|
||||
int write_commit_create_ls_slog_(const share::ObLSID &ls_id,
|
||||
const int64_t create_type) const;
|
||||
int write_commit_create_ls_slog_(const share::ObLSID &ls_id) const;
|
||||
int write_abort_create_ls_slog_(const share::ObLSID &ls_id) const;
|
||||
int write_remove_ls_slog_(const share::ObLSID &ls_id) const;
|
||||
int remove_ls_from_map_(const share::ObLSID &ls_id);
|
||||
|
||||
Reference in New Issue
Block a user