Fix migration release mds node dead lock bug.
This commit is contained in:
parent
e64627a407
commit
d5d74f213e
@ -1271,6 +1271,7 @@ TEST_F(TestLSTabletService, test_new_tablet_has_backup_table_with_ha_status)
|
||||
update_table_store_param.tablet_meta_ = nullptr;
|
||||
update_table_store_param.rebuild_seq_ = ls->get_rebuild_seq();
|
||||
update_table_store_param.need_replace_remote_sstable_ = false;
|
||||
update_table_store_param.release_mds_scn_.set_min();
|
||||
ret = update_table_store_param.tables_handle_.add_table(table_handle);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -713,6 +713,7 @@ DEFINE_ERROR(OB_SERVICE_STOPPED, -4783, -1, "HY000", "The service has stopped");
|
||||
DEFINE_ERROR(OB_SERVER_CONNECTION_ERROR, -4784, -1, "HY000", "Server '%s' connection error");
|
||||
DEFINE_ORACLE_ERROR_EXT(OB_ERR_ATLER_TABLE_ILLEGAL_FK_DROP_INDEX, -4785, ER_DROP_INDEX_FK, "HY000", "Cannot drop index: needed in a foreign key constraint", "Cannot drop index '%.*s': needed in a foreign key constraint", 02266, "Cannot drop index: needed in a foreign key constraint", "Cannot drop index '%.*s': needed in a foreign key constraint");
|
||||
DEFINE_ORACLE_ERROR(OB_ERR_FLASHBACK_QUERY_EXP_NULL, -4786, -1, "HY000", "NULL snapshot expression not allowed here", 30055, "NULL snapshot expression not allowed here");
|
||||
DEFINE_ERROR(OB_RELEASE_MDS_NODE_ERROR, -4787, -1, "HY000", "Release mds node error");
|
||||
|
||||
// 余留位置
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
@ -479,6 +479,7 @@ constexpr int OB_SERVICE_STOPPED = -4783;
|
||||
constexpr int OB_SERVER_CONNECTION_ERROR = -4784;
|
||||
constexpr int OB_ERR_ATLER_TABLE_ILLEGAL_FK_DROP_INDEX = -4785;
|
||||
constexpr int OB_ERR_FLASHBACK_QUERY_EXP_NULL = -4786;
|
||||
constexpr int OB_RELEASE_MDS_NODE_ERROR = -4787;
|
||||
constexpr int OB_ERR_PARSER_INIT = -5000;
|
||||
constexpr int OB_ERR_PARSE_SQL = -5001;
|
||||
constexpr int OB_ERR_RESOLVE_SQL = -5002;
|
||||
@ -2550,6 +2551,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
|
||||
#define OB_SERVER_CONNECTION_ERROR__USER_ERROR_MSG "Server '%s' connection error"
|
||||
#define OB_ERR_ATLER_TABLE_ILLEGAL_FK_DROP_INDEX__USER_ERROR_MSG "Cannot drop index '%.*s': needed in a foreign key constraint"
|
||||
#define OB_ERR_FLASHBACK_QUERY_EXP_NULL__USER_ERROR_MSG "NULL snapshot expression not allowed here"
|
||||
#define OB_RELEASE_MDS_NODE_ERROR__USER_ERROR_MSG "Release mds node error"
|
||||
#define OB_ERR_PARSER_INIT__USER_ERROR_MSG "Failed to init SQL parser"
|
||||
#define OB_ERR_PARSE_SQL__USER_ERROR_MSG "%s near \'%.*s\' at line %d"
|
||||
#define OB_ERR_RESOLVE_SQL__USER_ERROR_MSG "Resolve error"
|
||||
@ -5527,6 +5529,8 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
|
||||
#define OB_ERR_ATLER_TABLE_ILLEGAL_FK_DROP_INDEX__OBE_USER_ERROR_MSG "OBE-02266: Cannot drop index '%.*s': needed in a foreign key constraint"
|
||||
#define OB_ERR_FLASHBACK_QUERY_EXP_NULL__ORA_USER_ERROR_MSG "ORA-30055: NULL snapshot expression not allowed here"
|
||||
#define OB_ERR_FLASHBACK_QUERY_EXP_NULL__OBE_USER_ERROR_MSG "OBE-30055: NULL snapshot expression not allowed here"
|
||||
#define OB_RELEASE_MDS_NODE_ERROR__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -4787, Release mds node error"
|
||||
#define OB_RELEASE_MDS_NODE_ERROR__OBE_USER_ERROR_MSG "OBE-00600: internal error code, arguments: -4787, Release mds node error"
|
||||
#define OB_ERR_PARSER_INIT__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -5000, Failed to init SQL parser"
|
||||
#define OB_ERR_PARSER_INIT__OBE_USER_ERROR_MSG "OBE-00600: internal error code, arguments: -5000, Failed to init SQL parser"
|
||||
#define OB_ERR_PARSE_SQL__ORA_USER_ERROR_MSG "ORA-00900: %s near \'%.*s\' at line %d"
|
||||
@ -9150,7 +9154,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
|
||||
#define OB_ERR_INVALID_DATE_MSG_FMT_V2__ORA_USER_ERROR_MSG "ORA-01861: Incorrect datetime value for column '%.*s' at row %ld"
|
||||
#define OB_ERR_INVALID_DATE_MSG_FMT_V2__OBE_USER_ERROR_MSG "OBE-01861: Incorrect datetime value for column '%.*s' at row %ld"
|
||||
|
||||
extern int g_all_ob_errnos[2391];
|
||||
extern int g_all_ob_errnos[2392];
|
||||
|
||||
const char *ob_error_name(const int oberr);
|
||||
const char* ob_error_cause(const int oberr);
|
||||
|
@ -1720,6 +1720,7 @@ int ObTabletSplitMergeTask::update_table_store_with_batch_tables(
|
||||
param.tablet_split_param_.multi_version_start_ = src_tablet_handle.get_obj()->get_multi_version_start();
|
||||
param.tablet_split_param_.merge_type_ = merge_type;
|
||||
param.rebuild_seq_ = ls_handle.get_ls()->get_rebuild_seq(); // old rebuild seq.
|
||||
param.release_mds_scn_.set_min();
|
||||
if (OB_FAIL(MTL(ObLSService *)->get_ls(ls_id, new_ls_handle, ObLSGetMod::DDL_MOD))) {
|
||||
LOG_WARN("failed to get log stream", K(ret), K(param));
|
||||
} else if (OB_FAIL(new_ls_handle.get_ls()->build_tablet_with_batch_tables(dst_tablet_id, param))) {
|
||||
|
@ -2724,13 +2724,7 @@ int ObStorageHATabletBuilderUtil::inner_update_tablet_table_store_with_major_(
|
||||
}
|
||||
|
||||
int ObStorageHATabletBuilderUtil::build_table_with_minor_tables(
|
||||
ObLS *ls,
|
||||
const common::ObTabletID &tablet_id,
|
||||
const ObMigrationTabletParam *src_tablet_meta,
|
||||
const ObTablesHandleArray &mds_tables,
|
||||
const ObTablesHandleArray &minor_tables,
|
||||
const ObTablesHandleArray &ddl_tables,
|
||||
const ObTabletRestoreAction::ACTION &restore_action)
|
||||
const BatchBuildMinorSSTablesParam ¶m)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTabletHandle tablet_handle;
|
||||
@ -2738,7 +2732,7 @@ int ObStorageHATabletBuilderUtil::build_table_with_minor_tables(
|
||||
ObTablesHandleArray sstables;
|
||||
ObTablesHandleArray ddl_co_tables;
|
||||
|
||||
const bool is_replace_remote = ObTabletRestoreAction::is_restore_replace_remote_sstable(restore_action);
|
||||
const bool is_replace_remote = ObTabletRestoreAction::is_restore_replace_remote_sstable(param.restore_action_);
|
||||
bool need_tablet_meta_merge = true;
|
||||
// When we want to place the minor tables on the source side in the local table store,
|
||||
// whatever from backup or other observer, tablet meta merge action is necessary,
|
||||
@ -2748,32 +2742,32 @@ int ObStorageHATabletBuilderUtil::build_table_with_minor_tables(
|
||||
need_tablet_meta_merge = false;
|
||||
}
|
||||
|
||||
if (OB_ISNULL(ls) || !tablet_id.is_valid() || OB_ISNULL(src_tablet_meta) || !ObTabletRestoreAction::is_valid(restore_action)) {
|
||||
if (!param.is_valid()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("build tablet with major tables get invalid argument", K(ret), KP(ls), K(tablet_id), K(restore_action));
|
||||
} else if (ObTabletRestoreAction::is_restore_major(restore_action)) {
|
||||
LOG_WARN("build tablet with major tables get invalid argument", K(ret), K(param));
|
||||
} else if (ObTabletRestoreAction::is_restore_major(param.restore_action_)) {
|
||||
//do nothing
|
||||
} else {
|
||||
if (OB_FAIL(append_sstable_array_(sstables, mds_tables))) {
|
||||
LOG_WARN("failed to append mds tables handle into array", K(ret), K(mds_tables));
|
||||
} else if (OB_FAIL(append_sstable_array_(sstables, minor_tables))) {
|
||||
LOG_WARN("failed to append minor tables handle into array", K(ret), K(minor_tables));
|
||||
} else if (!ddl_tables.empty() && ddl_tables.get_table(0)->is_column_store_sstable()) {
|
||||
if (OB_FAIL(assemble_column_oriented_sstable_(ddl_tables, ddl_co_tables))) {
|
||||
LOG_WARN("assemble co tables failed", K(ret), K(ddl_tables));
|
||||
if (OB_FAIL(append_sstable_array_(sstables, param.mds_tables_))) {
|
||||
LOG_WARN("failed to append mds tables handle into array", K(ret), K(param));
|
||||
} else if (OB_FAIL(append_sstable_array_(sstables, param.minor_tables_))) {
|
||||
LOG_WARN("failed to append minor tables handle into array", K(ret), K(param));
|
||||
} else if (!param.ddl_tables_.empty() && param.ddl_tables_.get_table(0)->is_column_store_sstable()) {
|
||||
if (OB_FAIL(assemble_column_oriented_sstable_(param.ddl_tables_, ddl_co_tables))) {
|
||||
LOG_WARN("assemble co tables failed", K(ret), K(param));
|
||||
} else if (OB_FAIL(append_sstable_array_(sstables, ddl_co_tables))) {
|
||||
LOG_WARN("failed to append ddl tables handle", K(ret), K(ddl_co_tables));
|
||||
}
|
||||
} else if (OB_FAIL(append_sstable_array_(sstables, ddl_tables))) {
|
||||
LOG_WARN("failed to append ddl tables handle", K(ret), K(ddl_tables));
|
||||
} else if (OB_FAIL(append_sstable_array_(sstables, param.ddl_tables_))) {
|
||||
LOG_WARN("failed to append ddl tables handle", K(ret), K(param));
|
||||
}
|
||||
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_FAIL(get_tablet_(tablet_id, ls, tablet_handle))) {
|
||||
LOG_WARN("failed to get tablet", K(ret), K(tablet_id), KPC(ls));
|
||||
} else if (OB_FAIL(get_tablet_(param.tablet_id_, param.ls_, tablet_handle))) {
|
||||
LOG_WARN("failed to get tablet", K(ret), K(param));
|
||||
} else if (FALSE_IT(tablet = tablet_handle.get_obj())) {
|
||||
} else if (OB_FAIL(inner_update_tablet_table_store_with_minor_(ls, tablet, need_tablet_meta_merge,
|
||||
src_tablet_meta, sstables, is_replace_remote))) {
|
||||
} else if (OB_FAIL(inner_update_tablet_table_store_with_minor_(param, tablet, need_tablet_meta_merge,
|
||||
sstables, is_replace_remote))) {
|
||||
LOG_WARN("failed to update tablet table store with minor", K(ret));
|
||||
}
|
||||
}
|
||||
@ -2781,29 +2775,29 @@ int ObStorageHATabletBuilderUtil::build_table_with_minor_tables(
|
||||
}
|
||||
|
||||
int ObStorageHATabletBuilderUtil::inner_update_tablet_table_store_with_minor_(
|
||||
ObLS *ls,
|
||||
const BatchBuildMinorSSTablesParam ¶m,
|
||||
ObTablet *tablet,
|
||||
const bool &need_tablet_meta_merge,
|
||||
const ObMigrationTabletParam *src_tablet_meta,
|
||||
const ObTablesHandleArray &tables_handle,
|
||||
const bool is_replace_remote)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObBatchUpdateTableStoreParam update_table_store_param;
|
||||
|
||||
if (OB_ISNULL(ls) || OB_ISNULL(tablet) || (need_tablet_meta_merge && OB_ISNULL(src_tablet_meta))) {
|
||||
if (!param.is_valid() || OB_ISNULL(tablet)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("inner update tablet table store with minor get invalid argument", K(ret), KP(ls), KP(tablet));
|
||||
LOG_WARN("inner update tablet table store with minor get invalid argument", K(ret), K(param), KP(tablet));
|
||||
} else {
|
||||
const ObTabletID &tablet_id = tablet->get_tablet_meta().tablet_id_;
|
||||
update_table_store_param.tablet_meta_ = need_tablet_meta_merge ? src_tablet_meta : nullptr;
|
||||
update_table_store_param.rebuild_seq_ = ls->get_rebuild_seq();
|
||||
update_table_store_param.tablet_meta_ = need_tablet_meta_merge ? param.src_tablet_meta_ : nullptr;
|
||||
update_table_store_param.rebuild_seq_ = param.ls_->get_rebuild_seq();
|
||||
update_table_store_param.need_replace_remote_sstable_ = is_replace_remote;
|
||||
update_table_store_param.release_mds_scn_ = param.release_mds_scn_;
|
||||
|
||||
if (OB_FAIL(update_table_store_param.tables_handle_.assign(tables_handle))) {
|
||||
LOG_WARN("failed to assign tables handle", K(ret), K(tables_handle));
|
||||
} else if (OB_FAIL(ls->build_tablet_with_batch_tables(tablet_id, update_table_store_param))) {
|
||||
LOG_WARN("failed to build ha tablet new table store", K(ret), K(tablet_id), KPC(tablet), KPC(src_tablet_meta), K(update_table_store_param));
|
||||
} else if (OB_FAIL(param.ls_->build_tablet_with_batch_tables(tablet_id, update_table_store_param))) {
|
||||
LOG_WARN("failed to build ha tablet new table store", K(ret), K(tablet_id), KPC(tablet), K(param), K(update_table_store_param));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -2879,6 +2873,56 @@ int ObStorageHATabletBuilderUtil::check_hybrid_store(
|
||||
return ret;
|
||||
}
|
||||
|
||||
ObStorageHATabletBuilderUtil::BatchBuildMinorSSTablesParam::BatchBuildMinorSSTablesParam()
|
||||
: ls_(nullptr),
|
||||
tablet_id_(),
|
||||
src_tablet_meta_(nullptr),
|
||||
mds_tables_(),
|
||||
minor_tables_(),
|
||||
ddl_tables_(),
|
||||
restore_action_(ObTabletRestoreAction::MAX),
|
||||
release_mds_scn_()
|
||||
{
|
||||
}
|
||||
|
||||
bool ObStorageHATabletBuilderUtil::BatchBuildMinorSSTablesParam::is_valid() const
|
||||
{
|
||||
return OB_NOT_NULL(ls_)
|
||||
&& tablet_id_.is_valid()
|
||||
&& OB_NOT_NULL(src_tablet_meta_)
|
||||
&& src_tablet_meta_->is_valid()
|
||||
&& ObTabletRestoreAction::is_valid(restore_action_)
|
||||
&& release_mds_scn_.is_valid();
|
||||
}
|
||||
|
||||
void ObStorageHATabletBuilderUtil::BatchBuildMinorSSTablesParam::reset()
|
||||
{
|
||||
ls_ = nullptr;
|
||||
tablet_id_.reset();
|
||||
src_tablet_meta_ = nullptr;
|
||||
mds_tables_.reset();
|
||||
minor_tables_.reset();
|
||||
ddl_tables_.reset();
|
||||
restore_action_ = ObTabletRestoreAction::MAX;
|
||||
release_mds_scn_.reset();
|
||||
}
|
||||
|
||||
int ObStorageHATabletBuilderUtil::BatchBuildMinorSSTablesParam::assign_sstables(
|
||||
ObTablesHandleArray &mds_tables,
|
||||
ObTablesHandleArray &minor_tables,
|
||||
ObTablesHandleArray &ddl_tables)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(mds_tables_.assign(mds_tables))) {
|
||||
LOG_WARN("failed to assign mds tables", K(ret), K(mds_tables));
|
||||
} else if (OB_FAIL(minor_tables_.assign(minor_tables))) {
|
||||
LOG_WARN("failed to assign minor tables", K(ret), K(minor_tables));
|
||||
} else if (OB_FAIL(ddl_tables_.assign(ddl_tables))) {
|
||||
LOG_WARN("failed to assign ddl tables", K(ret), K(ddl_tables));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -324,6 +324,29 @@ public:
|
||||
TO_STRING_KV(K_(need_replace_remote_sstable), K_(param_array));
|
||||
};
|
||||
|
||||
struct BatchBuildMinorSSTablesParam final
|
||||
{
|
||||
BatchBuildMinorSSTablesParam();
|
||||
~BatchBuildMinorSSTablesParam() {}
|
||||
bool is_valid() const;
|
||||
void reset();
|
||||
int assign_sstables(
|
||||
ObTablesHandleArray &mds_tables,
|
||||
ObTablesHandleArray &minor_tables,
|
||||
ObTablesHandleArray &ddl_tables);
|
||||
|
||||
ObLS *ls_;
|
||||
common::ObTabletID tablet_id_;
|
||||
const ObMigrationTabletParam *src_tablet_meta_;
|
||||
ObTablesHandleArray mds_tables_;
|
||||
ObTablesHandleArray minor_tables_;
|
||||
ObTablesHandleArray ddl_tables_;
|
||||
ObTabletRestoreAction::ACTION restore_action_;
|
||||
share::SCN release_mds_scn_;
|
||||
TO_STRING_KV(KP_(ls), K_(tablet_id), KP_(src_tablet_meta), K_(mds_tables),
|
||||
K_(minor_tables), K_(ddl_tables), K_(restore_action), K_(release_mds_scn));
|
||||
DISALLOW_COPY_AND_ASSIGN(BatchBuildMinorSSTablesParam);
|
||||
};
|
||||
|
||||
public:
|
||||
static int build_tablet_with_major_tables(
|
||||
@ -338,13 +361,7 @@ public:
|
||||
const ObStorageSchema &storage_schema,
|
||||
const BatchBuildTabletTablesExtraParam &extra_param);
|
||||
static int build_table_with_minor_tables(
|
||||
ObLS *ls,
|
||||
const common::ObTabletID &tablet_id,
|
||||
const ObMigrationTabletParam *src_tablet_meta,
|
||||
const ObTablesHandleArray &mds_tables,
|
||||
const ObTablesHandleArray &minor_tables,
|
||||
const ObTablesHandleArray &ddl_tables,
|
||||
const ObTabletRestoreAction::ACTION &restore_action);
|
||||
const BatchBuildMinorSSTablesParam ¶m);
|
||||
static int check_remote_logical_sstable_exist(
|
||||
ObTablet *tablet,
|
||||
bool &is_exist);
|
||||
@ -387,10 +404,9 @@ private:
|
||||
const int64_t transfer_seq,
|
||||
const BuildTabletTableExtraParam &extra_param);
|
||||
static int inner_update_tablet_table_store_with_minor_(
|
||||
ObLS *ls,
|
||||
const BatchBuildMinorSSTablesParam ¶m,
|
||||
ObTablet *tablet,
|
||||
const bool &need_tablet_meta_merge,
|
||||
const ObMigrationTabletParam *src_tablet_meta,
|
||||
const ObTablesHandleArray &tables_handle,
|
||||
const bool is_replace_remote);
|
||||
static int assemble_column_oriented_sstable_(
|
||||
|
@ -292,7 +292,6 @@ int ObTabletCopyFinishTask::create_new_table_store_with_minor_()
|
||||
share::SCN mds_max_end_scn(SCN::min_scn());
|
||||
ObTabletHandle tablet_handle;
|
||||
ObTablet *tablet = nullptr;
|
||||
ObTabletPointer *pointer = nullptr;
|
||||
if (!is_inited_) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("tablet copy finish task do not init", K(ret));
|
||||
@ -301,34 +300,30 @@ int ObTabletCopyFinishTask::create_new_table_store_with_minor_()
|
||||
} else if (OB_ISNULL(tablet = tablet_handle.get_obj())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("tablet should not be NULL", K(ret), K(tablet_id_));
|
||||
} else if (OB_ISNULL(pointer = tablet->get_pointer_handle().get_resource_ptr())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("tablet pointer should not be NULL", K(ret), KPC(tablet));
|
||||
} else if (OB_FAIL(get_mds_sstable_max_end_scn_(mds_max_end_scn))) {
|
||||
LOG_WARN("failed to get mds sstable max end scn", K(ret), K(mds_tables_handle_));
|
||||
} else {
|
||||
TabletMdsLockGuard<LockMode::EXCLUSIVE> guard;
|
||||
pointer->get_mds_truncate_lock_guard(guard);
|
||||
//Release mds node failed must do dag net retry.
|
||||
//Because ls still replay and mds may has residue node which makes data incorrect.
|
||||
//So should make ls offline and online
|
||||
if (OB_FAIL(ObStorageHATabletBuilderUtil::build_table_with_minor_tables(ls_,
|
||||
tablet_id_,
|
||||
src_tablet_meta_,
|
||||
mds_tables_handle_,
|
||||
minor_tables_handle_,
|
||||
ddl_tables_handle_,
|
||||
restore_action_))) {
|
||||
ObStorageHATabletBuilderUtil::BatchBuildMinorSSTablesParam param;
|
||||
param.ls_ = ls_;
|
||||
param.tablet_id_ = tablet_id_;
|
||||
param.src_tablet_meta_ = src_tablet_meta_;
|
||||
param.restore_action_ = restore_action_;
|
||||
param.release_mds_scn_ = mds_max_end_scn;
|
||||
|
||||
if (OB_FAIL(param.assign_sstables(mds_tables_handle_, minor_tables_handle_, ddl_tables_handle_))) {
|
||||
LOG_WARN("failed to assign sstables", K(ret), KPC(ls_), K(tablet_id_));
|
||||
} else if (OB_FAIL(ObStorageHATabletBuilderUtil::build_table_with_minor_tables(param))) {
|
||||
LOG_WARN("failed to build table with minor tables", K(ret), K(mds_tables_handle_),
|
||||
K(minor_tables_handle_), K(ddl_tables_handle_), K(restore_action_));
|
||||
} else if (mds_max_end_scn.is_min()) {
|
||||
//do nothing
|
||||
} else if (OB_FAIL(pointer->release_mds_nodes_redo_scn_below(tablet_id_, mds_max_end_scn))) {
|
||||
LOG_WARN("failed to relase mds node redo scn blow", K(ret), K(tablet_id_), K(mds_max_end_scn));
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
const bool need_retry = false;
|
||||
if (OB_SUCCESS != (tmp_ret = ha_dag_->get_ha_dag_net_ctx()->set_result(ret, need_retry))) {
|
||||
LOG_ERROR("failed to set ha dag net ctx result", K(tmp_ret), K(ret));
|
||||
if (OB_RELEASE_MDS_NODE_ERROR == ret) {
|
||||
//Release mds node failed must do dag net retry.
|
||||
//Because ls still replay and mds may has residue node which makes data incorrect.
|
||||
//So should make ls offline and online
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
const bool need_retry = false;
|
||||
if (OB_SUCCESS != (tmp_ret = ha_dag_->get_ha_dag_net_ctx()->set_result(ret, need_retry))) {
|
||||
LOG_ERROR("failed to set ha dag net ctx result", K(tmp_ret), K(ret));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1718,6 +1718,7 @@ int ObTransferReplaceTableTask::transfer_replace_tables_(
|
||||
param.rebuild_seq_ = ls->get_rebuild_seq();
|
||||
param.is_transfer_replace_ = true;
|
||||
param.tablet_meta_ = &mig_param;
|
||||
param.release_mds_scn_.set_min();
|
||||
#ifdef ERRSIM
|
||||
param.errsim_point_info_ = ctx_->errsim_point_info_;
|
||||
SERVER_EVENT_SYNC_ADD("TRANSFER", "TRANSFER_REPLACE_TABLE_WITH_LOG_REPLAY_SKIP_CHECK",
|
||||
|
@ -93,6 +93,7 @@
|
||||
#include "storage/ddl/ob_tablet_ddl_kv.h"
|
||||
#include "share/vector_index/ob_plugin_vector_index_adaptor.h"
|
||||
#include "share/vector_index/ob_plugin_vector_index_service.h"
|
||||
#include "storage/meta_mem/ob_tablet_pointer.h"
|
||||
|
||||
using namespace oceanbase::share;
|
||||
using namespace oceanbase::common;
|
||||
@ -3989,6 +3990,7 @@ int ObLSTabletService::build_tablet_with_batch_tables(
|
||||
int ret = OB_SUCCESS;
|
||||
ObArenaAllocator allocator(common::ObMemAttr(MTL_ID(), "BuildHaTab"));
|
||||
ObMetaDiskAddr disk_addr;
|
||||
ObTabletPointer *pointer = nullptr;
|
||||
ObTimeGuard time_guard("ObLSTabletService::build_ha_tablet_new_table_store", 1_s);
|
||||
|
||||
if (IS_NOT_INIT) {
|
||||
@ -4012,16 +4014,34 @@ int ObLSTabletService::build_tablet_with_batch_tables(
|
||||
LOG_WARN("failed to get tablet", K(ret), K(tablet_id));
|
||||
} else if (old_tablet_handle.get_obj()->is_empty_shell()) {
|
||||
LOG_INFO("old tablet is empty shell tablet, should skip this operation", K(ret), "old_tablet", old_tablet_handle.get_obj());
|
||||
} else if (OB_ISNULL(pointer = old_tablet_handle.get_obj()->get_pointer_handle().get_resource_ptr())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("tablet pointer should not be NULL", K(ret), K(old_tablet_handle));
|
||||
} else {
|
||||
time_guard.click("GetTablet");
|
||||
|
||||
if (param.release_mds_scn_.is_min()) {
|
||||
//do nothing
|
||||
} else {
|
||||
TabletMdsLockGuard<storage::LockMode::EXCLUSIVE> guard;
|
||||
pointer->get_mds_truncate_lock_guard(guard);
|
||||
if (OB_FAIL(pointer->release_mds_nodes_redo_scn_below(tablet_id, param.release_mds_scn_))) {
|
||||
//overwrite ret
|
||||
LOG_WARN("failed to relase mds node redo scn below", K(ret), K(tablet_id), "release mds scn", param.release_mds_scn_);
|
||||
ret = OB_RELEASE_MDS_NODE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
time_guard.click("ReleaseMDS");
|
||||
|
||||
ObTablet *old_tablet = old_tablet_handle.get_obj();
|
||||
ObTablet *tmp_tablet = nullptr;
|
||||
const share::ObLSID &ls_id = ls_->get_ls_id();
|
||||
const ObTabletMapKey key(ls_id, tablet_id);
|
||||
const ObTabletPersisterParam persist_param(ls_id, ls_->get_ls_epoch(), tablet_id, old_tablet->get_transfer_seq());
|
||||
|
||||
if (OB_FAIL(ObTabletCreateDeleteHelper::acquire_tmp_tablet(key, allocator, tmp_tablet_handle))) {
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_FAIL(ObTabletCreateDeleteHelper::acquire_tmp_tablet(key, allocator, tmp_tablet_handle))) {
|
||||
LOG_WARN("failed to acquire tablet", K(ret), K(key));
|
||||
} else if (FALSE_IT(tmp_tablet = tmp_tablet_handle.get_obj())) {
|
||||
} else if (OB_FAIL(tmp_tablet->init_for_sstable_replace(allocator, param, *old_tablet))) {
|
||||
|
@ -592,7 +592,8 @@ ObBatchUpdateTableStoreParam::ObBatchUpdateTableStoreParam()
|
||||
tablet_meta_(nullptr),
|
||||
restore_status_(ObTabletRestoreStatus::FULL),
|
||||
tablet_split_param_(),
|
||||
need_replace_remote_sstable_(false)
|
||||
need_replace_remote_sstable_(false),
|
||||
release_mds_scn_()
|
||||
{
|
||||
}
|
||||
|
||||
@ -606,12 +607,14 @@ void ObBatchUpdateTableStoreParam::reset()
|
||||
restore_status_ = ObTabletRestoreStatus::FULL;
|
||||
tablet_split_param_.reset();
|
||||
need_replace_remote_sstable_ = false;
|
||||
release_mds_scn_.reset();
|
||||
}
|
||||
|
||||
bool ObBatchUpdateTableStoreParam::is_valid() const
|
||||
{
|
||||
return rebuild_seq_ > OB_INVALID_VERSION
|
||||
&& ObTabletRestoreStatus::is_valid(restore_status_);
|
||||
&& ObTabletRestoreStatus::is_valid(restore_status_)
|
||||
&& release_mds_scn_.is_valid();
|
||||
}
|
||||
|
||||
int ObBatchUpdateTableStoreParam::assign(
|
||||
@ -630,6 +633,7 @@ int ObBatchUpdateTableStoreParam::assign(
|
||||
tablet_meta_ = param.tablet_meta_;
|
||||
restore_status_ = param.restore_status_;
|
||||
need_replace_remote_sstable_ = param.need_replace_remote_sstable_;
|
||||
release_mds_scn_ = param.release_mds_scn_;
|
||||
#ifdef ERRSIM
|
||||
errsim_point_info_ = param.errsim_point_info_;
|
||||
#endif
|
||||
|
@ -500,7 +500,8 @@ struct ObBatchUpdateTableStoreParam final
|
||||
int get_max_clog_checkpoint_scn(share::SCN &clog_checkpoint_scn) const;
|
||||
|
||||
TO_STRING_KV(K_(tables_handle), K_(rebuild_seq), K_(is_transfer_replace),
|
||||
K_(start_scn), KP_(tablet_meta), K_(restore_status), K_(tablet_split_param), K_(need_replace_remote_sstable));
|
||||
K_(start_scn), KP_(tablet_meta), K_(restore_status), K_(tablet_split_param),
|
||||
K_(need_replace_remote_sstable), K_(release_mds_scn));
|
||||
|
||||
ObTablesHandleArray tables_handle_;
|
||||
#ifdef ERRSIM
|
||||
@ -513,6 +514,7 @@ struct ObBatchUpdateTableStoreParam final
|
||||
ObTabletRestoreStatus::STATUS restore_status_;
|
||||
ObSplitTableStoreParam tablet_split_param_;
|
||||
bool need_replace_remote_sstable_;
|
||||
share::SCN release_mds_scn_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ObBatchUpdateTableStoreParam);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user