fix restore report -4016 because incorrect restore stage of ddl sstable
This commit is contained in:
committed by
wangzelin.wzl
parent
7429c68cea
commit
20c9f424d8
@ -21,6 +21,7 @@
|
|||||||
#include "rootserver/ob_root_service.h"
|
#include "rootserver/ob_root_service.h"
|
||||||
#include "rootserver/ddl_task/ob_ddl_redefinition_task.h"
|
#include "rootserver/ddl_task/ob_ddl_redefinition_task.h"
|
||||||
#include "storage/tablelock/ob_table_lock_service.h"
|
#include "storage/tablelock/ob_table_lock_service.h"
|
||||||
|
#include "observer/ob_server_event_history_table_operator.h"
|
||||||
|
|
||||||
using namespace oceanbase::lib;
|
using namespace oceanbase::lib;
|
||||||
using namespace oceanbase::common;
|
using namespace oceanbase::common;
|
||||||
@ -597,6 +598,13 @@ int ObTableRedefinitionTask::copy_table_dependent_objects(const ObDDLTaskStatus
|
|||||||
int ObTableRedefinitionTask::take_effect(const ObDDLTaskStatus next_task_status)
|
int ObTableRedefinitionTask::take_effect(const ObDDLTaskStatus next_task_status)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
|
#ifdef ERRSIM
|
||||||
|
SERVER_EVENT_ADD("ddl_task", "before_table_redefinition_task_effect",
|
||||||
|
"tenant_id", tenant_id_,
|
||||||
|
"object_id", object_id_,
|
||||||
|
"target_object_id", target_object_id_);
|
||||||
|
DEBUG_SYNC(BEFORE_TABLE_REDEFINITION_TASK_EFFECT);
|
||||||
|
#endif
|
||||||
ObSArray<uint64_t> objs;
|
ObSArray<uint64_t> objs;
|
||||||
alter_table_arg_.ddl_task_type_ = share::MAKE_DDL_TAKE_EFFECT_TASK;
|
alter_table_arg_.ddl_task_type_ = share::MAKE_DDL_TAKE_EFFECT_TASK;
|
||||||
alter_table_arg_.table_id_ = object_id_;
|
alter_table_arg_.table_id_ = object_id_;
|
||||||
|
|||||||
@ -422,6 +422,7 @@ class ObString;
|
|||||||
ACT(BEFORE_COPY_DDL_SSTABLE,)\
|
ACT(BEFORE_COPY_DDL_SSTABLE,)\
|
||||||
ACT(BEFORE_DDL_WRITE_PREPARE_LOG,)\
|
ACT(BEFORE_DDL_WRITE_PREPARE_LOG,)\
|
||||||
ACT(AFTER_BACKUP_FETCH_MACRO_BLOCK_FAILED,)\
|
ACT(AFTER_BACKUP_FETCH_MACRO_BLOCK_FAILED,)\
|
||||||
|
ACT(BEFORE_TABLE_REDEFINITION_TASK_EFFECT,)\
|
||||||
ACT(MAX_DEBUG_SYNC_POINT,)
|
ACT(MAX_DEBUG_SYNC_POINT,)
|
||||||
|
|
||||||
DECLARE_ENUM(ObDebugSyncPoint, debug_sync_point, OB_DEBUG_SYNC_POINT_DEF);
|
DECLARE_ENUM(ObDebugSyncPoint, debug_sync_point, OB_DEBUG_SYNC_POINT_DEF);
|
||||||
|
|||||||
@ -1285,8 +1285,13 @@ int ObTabletCopyFinishTask::create_new_table_store_restore_major_()
|
|||||||
LOG_WARN("tablet should not be NULL", K(ret), K(tablet_id_));
|
LOG_WARN("tablet should not be NULL", K(ret), K(tablet_id_));
|
||||||
} else if (tables_handle_.empty()) {
|
} else if (tables_handle_.empty()) {
|
||||||
if (src_tablet_meta_->table_store_flag_.with_major_sstable()) {
|
if (src_tablet_meta_->table_store_flag_.with_major_sstable()) {
|
||||||
|
const ObSSTableArray &major_sstable_array = tablet->get_table_store().get_major_sstables();
|
||||||
|
if (major_sstable_array.empty()) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("should has major sstable", K(ret), K(tablet_id_), K(tables_handle_), KPC(tablet));
|
LOG_WARN("should has major sstable", K(ret), K(tablet_id_), K(tables_handle_), KPC(tablet));
|
||||||
|
} else {
|
||||||
|
LOG_INFO("already has major sstable", K(ret), K(tablet_id_));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO("tablet do not has sstable", K(ret), K(tablet_id_), K(tables_handle_), KPC(tablet));
|
LOG_INFO("tablet do not has sstable", K(ret), K(tablet_id_), K(tables_handle_), KPC(tablet));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2196,9 +2196,8 @@ int ObTabletRestoreTask::generate_ddl_restore_tasks_(
|
|||||||
} else if (OB_ISNULL(tablet_copy_finish_task) || OB_ISNULL(parent_task)) {
|
} else if (OB_ISNULL(tablet_copy_finish_task) || OB_ISNULL(parent_task)) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
LOG_WARN("generate minor task get invalid argument", K(ret), KP(tablet_copy_finish_task), KP(parent_task));
|
LOG_WARN("generate minor task get invalid argument", K(ret), KP(tablet_copy_finish_task), KP(parent_task));
|
||||||
} else if (ObTabletRestoreAction::is_restore_minor(tablet_restore_ctx_->action_)
|
} else if (!ObTabletRestoreAction::is_restore_minor(tablet_restore_ctx_->action_)) {
|
||||||
|| ObTabletRestoreAction::is_restore_tablet_meta(tablet_restore_ctx_->action_)) {
|
LOG_INFO("tablet not restore minor, skip ddl restore tasks",
|
||||||
LOG_INFO("tablet only restore minor, skip ddl restore tasks",
|
|
||||||
K(ret), KPC(ha_dag_net_ctx_), KPC(tablet_restore_ctx_));
|
K(ret), KPC(ha_dag_net_ctx_), KPC(tablet_restore_ctx_));
|
||||||
} else if (OB_FAIL(generate_restore_task_(ObITable::is_ddl_sstable, tablet_copy_finish_task, parent_task))) {
|
} else if (OB_FAIL(generate_restore_task_(ObITable::is_ddl_sstable, tablet_copy_finish_task, parent_task))) {
|
||||||
LOG_WARN("failed to generate ddl restore task", K(ret), KPC(ha_dag_net_ctx_), KPC(tablet_restore_ctx_));
|
LOG_WARN("failed to generate ddl restore task", K(ret), KPC(ha_dag_net_ctx_), KPC(tablet_restore_ctx_));
|
||||||
@ -2350,11 +2349,12 @@ int ObTabletRestoreTask::generate_restore_task_(
|
|||||||
const ObITable::TableKey ©_table_key = copy_table_key_array_.at(i);
|
const ObITable::TableKey ©_table_key = copy_table_key_array_.at(i);
|
||||||
ObFakeTask *wait_finish_task = nullptr;
|
ObFakeTask *wait_finish_task = nullptr;
|
||||||
bool need_copy = true;
|
bool need_copy = true;
|
||||||
|
const bool is_right_type = is_right_type_sstable(copy_table_key.table_type_);
|
||||||
|
|
||||||
if (!copy_table_key.is_valid()) {
|
if (!copy_table_key.is_valid()) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("copy table key info is invalid", K(ret), K(copy_table_key));
|
LOG_WARN("copy table key info is invalid", K(ret), K(copy_table_key));
|
||||||
} else if (!is_right_type_sstable(copy_table_key.table_type_)) {
|
} else if (!is_right_type) {
|
||||||
//do nothing
|
//do nothing
|
||||||
} else {
|
} else {
|
||||||
if (OB_FAIL(check_need_copy_sstable_(copy_table_key, need_copy))) {
|
if (OB_FAIL(check_need_copy_sstable_(copy_table_key, need_copy))) {
|
||||||
@ -2371,7 +2371,9 @@ int ObTabletRestoreTask::generate_restore_task_(
|
|||||||
} else {
|
} else {
|
||||||
parent_task = wait_finish_task;
|
parent_task = wait_finish_task;
|
||||||
LOG_INFO("succeed to generate sstable restore task", "is_leader",
|
LOG_INFO("succeed to generate sstable restore task", "is_leader",
|
||||||
tablet_restore_ctx_->is_leader_, "src", src_info_, K(copy_table_key));
|
tablet_restore_ctx_->is_leader_, "src", src_info_, K(copy_table_key),
|
||||||
|
"restore_action", tablet_restore_ctx_->action_, K(is_right_type),
|
||||||
|
K(copy_table_key_array_), K(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user