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