Fix ha add major and minor with storage schema and tablet meta merge
This commit is contained in:
parent
0786a354df
commit
6dd8947a1c
@ -17,6 +17,7 @@
|
||||
#include "observer/ob_server_event_history_table_operator.h"
|
||||
#include "share/ob_cluster_version.h"
|
||||
#include "share/rc/ob_tenant_base.h"
|
||||
#include "storage/high_availability/ob_storage_ha_tablet_builder.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
@ -1173,6 +1174,8 @@ int ObTabletCopyFinishTask::process()
|
||||
LOG_WARN("failed to create new table store with ddl", K(ret), K_(tablet_id));
|
||||
} else if (OB_FAIL(create_new_table_store_with_minor_())) {
|
||||
LOG_WARN("failed to create new table store with minor", K(ret), K_(tablet_id));
|
||||
} else if (OB_FAIL(trim_tablet_())) {
|
||||
LOG_WARN("failed to trim tablet", K(ret), K_(tablet_id));
|
||||
} else if (OB_FAIL(update_tablet_data_status_())) {
|
||||
LOG_WARN("failed to update tablet data status", K(ret), K(tablet_id_));
|
||||
}
|
||||
@ -1250,60 +1253,15 @@ int ObTabletCopyFinishTask::get_sstable(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTabletCopyFinishTask::inner_update_tablet_table_store_with_minor_(
|
||||
const bool &need_tablet_meta_merge,
|
||||
ObTablesHandleArray *tables_handle_ptr)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObBatchUpdateTableStoreParam update_table_store_param;
|
||||
ObTabletHandle tablet_handle;
|
||||
ObTablet *tablet = nullptr;
|
||||
const bool is_rollback = false;
|
||||
bool need_merge = false;
|
||||
|
||||
if (!is_inited_) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("tablet copy finish task do not init", K(ret));
|
||||
} else if (OB_FAIL(ls_->get_tablet(tablet_id_, tablet_handle))) {
|
||||
LOG_WARN("failed to get tablet", K(ret), K(tablet_id_));
|
||||
} 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 (need_tablet_meta_merge && OB_FAIL(check_need_merge_tablet_meta_(tablet, need_merge))) {
|
||||
LOG_WARN("failedto check remote logical sstable exist", K(ret), KPC(tablet));
|
||||
} else {
|
||||
update_table_store_param.multi_version_start_ = 0;
|
||||
update_table_store_param.tablet_meta_ = need_merge ? src_tablet_meta_ : nullptr;
|
||||
update_table_store_param.rebuild_seq_ = ls_->get_rebuild_seq();
|
||||
|
||||
if (OB_FAIL(update_table_store_param.tables_handle_.assign(*tables_handle_ptr))) {
|
||||
LOG_WARN("failed to assign tables handle", K(ret), KPC(tables_handle_ptr));
|
||||
} else if (update_table_store_param.tables_handle_.empty()) {
|
||||
LOG_INFO("tablet do not has sstable", K(ret), K(tablet_id_), KPC(tables_handle_ptr), KPC(tablet));
|
||||
} else if (OB_FAIL(ls_->build_ha_tablet_new_table_store(tablet_id_, update_table_store_param))) {
|
||||
LOG_WARN("failed to build ha tablet new table store", K(ret), K(tablet_id_), KPC_(src_tablet_meta), K(update_table_store_param));
|
||||
}
|
||||
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (tablet->get_tablet_meta().has_next_tablet_
|
||||
&& OB_FAIL(ls_->trim_rebuild_tablet(tablet_id_, is_rollback))) {
|
||||
LOG_WARN("failed to trim rebuild tablet", K(ret), K(tablet_id_));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTabletCopyFinishTask::create_new_table_store_with_ddl_()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTablesHandleArray *tables_handle_ptr = &ddl_tables_handle_;
|
||||
const bool need_tablet_meta_merge = false;
|
||||
|
||||
if (!is_inited_) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("tablet copy finish task do not init", K(ret));
|
||||
} else if (OB_FAIL(inner_update_tablet_table_store_with_minor_(need_tablet_meta_merge, tables_handle_ptr))) {
|
||||
LOG_WARN("failed to update tablet table store with minor", K(ret));
|
||||
} else if (OB_FAIL(ObStorageHATabletBuilderUtil::build_table_with_ddl_tables(ls_, tablet_id_, ddl_tables_handle_))) {
|
||||
LOG_WARN("failed to build table with ddl tables", K(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -1316,8 +1274,9 @@ int ObTabletCopyFinishTask::create_new_table_store_with_minor_()
|
||||
if (!is_inited_) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("tablet copy finish task do not init", K(ret));
|
||||
} else if (OB_FAIL(inner_update_tablet_table_store_with_minor_(need_tablet_meta_merge, tables_handle_ptr))) {
|
||||
LOG_WARN("failed to update tablet table store with minor", K(ret));
|
||||
} else if (OB_FAIL(ObStorageHATabletBuilderUtil::build_table_with_minor_tables(ls_, tablet_id_,
|
||||
src_tablet_meta_, minor_tables_handle_))) {
|
||||
LOG_WARN("failed to build table with ddl tables", K(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -1325,111 +1284,20 @@ int ObTabletCopyFinishTask::create_new_table_store_with_minor_()
|
||||
int ObTabletCopyFinishTask::create_new_table_store_with_major_()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTabletHandle tablet_handle;
|
||||
ObTablet *tablet = nullptr;
|
||||
const bool is_rollback = false;
|
||||
if (!is_inited_) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("tablet copy finish task do not init", K(ret));
|
||||
} else if (OB_ISNULL(src_tablet_meta_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("src tablet meta should not be null", K(ret));
|
||||
} else if (OB_FAIL(ls_->get_tablet(tablet_id_, tablet_handle))) {
|
||||
LOG_WARN("failed to get tablet", K(ret), K(tablet_id_));
|
||||
} 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 (major_tables_handle_.empty()) {
|
||||
// do nothing
|
||||
} else if (ObTabletRestoreAction::is_restore_major(restore_action_) && 1 != major_tables_handle_.get_count() ) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("major tablet should only has one sstable", K(ret), "major_sstable_count", major_tables_handle_.get_count(), K(major_tables_handle_));
|
||||
} else {
|
||||
ObSEArray<ObITable *, MAX_SSTABLE_CNT_IN_STORAGE> major_tables;
|
||||
if (OB_FAIL(major_tables_handle_.get_tables(major_tables))) {
|
||||
LOG_WARN("failed to get tables", K(ret));
|
||||
} else if (OB_FAIL(ObTableStoreUtil::sort_major_tables(major_tables))) {
|
||||
LOG_WARN("failed to sort mjaor tables", K(ret));
|
||||
} else {
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < major_tables.count(); ++i) {
|
||||
ObITable *table_ptr = major_tables.at(i);
|
||||
if (OB_ISNULL(table_ptr)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table ptr should not be null", K(ret), KP(table_ptr));
|
||||
} else if (!table_ptr->is_major_sstable()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table ptr is not major", K(ret), KPC(table_ptr));
|
||||
} else if (OB_FAIL(inner_update_tablet_table_store_with_major_(tablet_id_, table_ptr))) {
|
||||
LOG_WARN("failed to update tablet table store", K(ret), K_(tablet_id), KPC(table_ptr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (tablet->get_tablet_meta().has_next_tablet_
|
||||
&& OB_FAIL(ls_->trim_rebuild_tablet(tablet_id_, is_rollback))) {
|
||||
LOG_WARN("failed to trim rebuild tablet", K(ret), K(tablet_id_));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTabletCopyFinishTask::inner_update_tablet_table_store_with_major_(
|
||||
const common::ObTabletID &tablet_id,
|
||||
ObITable *table_ptr)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTabletHandle tablet_handle;
|
||||
ObTablet *tablet = nullptr;
|
||||
ObTableHandleV2 table_handle_v2;
|
||||
SCN tablet_snapshot_version;
|
||||
ObTenantMetaMemMgr *meta_mem_mgr = nullptr;
|
||||
if (!tablet_id.is_valid() || OB_ISNULL(table_ptr) || OB_ISNULL(src_tablet_meta_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table ptr should not be null", K(ret), K(tablet_id), KP(table_ptr), KP(src_tablet_meta_));
|
||||
} else if (OB_FAIL(ls_->get_tablet(tablet_id, tablet_handle))) {
|
||||
LOG_WARN("failed to get tablet", K(ret), K(tablet_id));
|
||||
} 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(meta_mem_mgr = MTL(ObTenantMetaMemMgr *))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("failed to get meta mem mgr from MTL", K(ret));
|
||||
} else if (OB_FAIL(table_handle_v2.set_table(table_ptr, meta_mem_mgr, table_ptr->get_key().table_type_))) {
|
||||
LOG_WARN("failed to set table handle v2", K(ret), KPC(table_ptr));
|
||||
} else if (OB_FAIL(tablet->get_snapshot_version(tablet_snapshot_version))) {
|
||||
LOG_WARN("failed to get_snapshot_version", K(ret));
|
||||
} else {
|
||||
const int64_t update_snapshot_version = MAX(tablet->get_snapshot_version(), table_ptr->get_key().get_snapshot_version());
|
||||
const int64_t update_multi_version_start = MAX(tablet->get_multi_version_start(), table_ptr->get_key().get_snapshot_version());
|
||||
ObUpdateTableStoreParam param(table_handle_v2,
|
||||
update_snapshot_version,
|
||||
update_multi_version_start,
|
||||
&src_tablet_meta_->storage_schema_,
|
||||
ls_->get_rebuild_seq(),
|
||||
true/*need_report*/,
|
||||
SCN::min_scn()/*clog_checkpoint_scn*/,
|
||||
true/*need_check_sstable*/,
|
||||
true/*allow_duplicate_sstable*/,
|
||||
&src_tablet_meta_->medium_info_list_);
|
||||
if (tablet->get_storage_schema().get_version() < src_tablet_meta_->storage_schema_.get_version()) {
|
||||
SERVER_EVENT_ADD("storage_ha", "schema_change_need_merge_tablet_meta",
|
||||
"tenant_id", MTL_ID(),
|
||||
"tablet_id", tablet_id.id(),
|
||||
"old_schema_version", tablet->get_storage_schema().get_version(),
|
||||
"new_schema_version", src_tablet_meta_->storage_schema_.get_version());
|
||||
}
|
||||
#ifdef ERRSIM
|
||||
SERVER_EVENT_ADD("storage_ha", "update_major_tablet_table_store",
|
||||
"tablet_id", tablet_id.id(),
|
||||
"old_multi_version_start", tablet->get_multi_version_start(),
|
||||
"new_multi_version_start", src_tablet_meta_->multi_version_start_,
|
||||
"old_snapshot_version", tablet->get_snapshot_version(),
|
||||
"new_snapshot_version", table_ptr->get_key().get_snapshot_version());
|
||||
#endif
|
||||
if (FAILEDx(ls_->update_tablet_table_store(tablet_id, param, tablet_handle))) {
|
||||
LOG_WARN("failed to build ha tablet new table store", K(ret), K(tablet_id), K(param));
|
||||
}
|
||||
} else if (OB_FAIL(ObStorageHATabletBuilderUtil::build_tablet_with_major_tables(ls_,
|
||||
tablet_id_, major_tables_handle_, src_tablet_meta_->storage_schema_))) {
|
||||
LOG_WARN("failed to build tablet with major tables", K(ret), K(tablet_id_), K(major_tables_handle_), KPC(src_tablet_meta_));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -1455,7 +1323,7 @@ int ObTabletCopyFinishTask::update_tablet_data_status_()
|
||||
LOG_WARN("tablet here should only has one", K(ret), KPC(tablet));
|
||||
} else if (tablet->get_tablet_meta().ha_status_.is_data_status_complete()) {
|
||||
//do nothing
|
||||
} else if (OB_FAIL(check_remote_logical_sstable_exist_(tablet, is_logical_sstable_exist))) {
|
||||
} else if (OB_FAIL(ObStorageHATabletBuilderUtil::check_remote_logical_sstable_exist(tablet, is_logical_sstable_exist))) {
|
||||
LOG_WARN("failedto check remote logical sstable exist", K(ret), KPC(tablet));
|
||||
} else if (is_logical_sstable_exist && tablet->get_tablet_meta().ha_status_.is_restore_status_full()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
@ -1498,59 +1366,6 @@ int ObTabletCopyFinishTask::update_tablet_data_status_()
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTabletCopyFinishTask::check_need_merge_tablet_meta_(
|
||||
ObTablet *tablet,
|
||||
bool &need_merge)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
need_merge = false;
|
||||
bool is_exist = false;
|
||||
if (!is_inited_) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("tablet copy finish task do not init", K(ret));
|
||||
} else if (OB_ISNULL(tablet)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("check need merge tablet meta get invalid argument", K(ret), KP(tablet));
|
||||
} else if (tablet->get_tablet_meta().clog_checkpoint_scn_ >= src_tablet_meta_->clog_checkpoint_scn_) {
|
||||
need_merge = false;
|
||||
} else if (OB_FAIL(check_remote_logical_sstable_exist_(tablet, is_exist))) {
|
||||
LOG_WARN("failed to check remote logical sstable exist", K(ret), KPC(tablet));
|
||||
} else if (!is_exist) {
|
||||
need_merge = false;
|
||||
} else {
|
||||
need_merge = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTabletCopyFinishTask::check_remote_logical_sstable_exist_(
|
||||
ObTablet *tablet,
|
||||
bool &is_exist)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
is_exist = false;
|
||||
if (!is_inited_) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("tablet copy finish task do not init", K(ret));
|
||||
} else if (OB_ISNULL(tablet)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("check remote logical sstable exist get invalid argument", K(ret), KP(tablet));
|
||||
} else {
|
||||
const ObSSTableArray &minor_sstables = tablet->get_table_store().get_minor_sstables();
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < minor_sstables.count(); ++i) {
|
||||
const ObITable *table = minor_sstables.array_[i];
|
||||
if (OB_ISNULL(table)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("minor sstable should not be NULL", K(ret), KP(table));
|
||||
} else if (table->is_remote_logical_minor_sstable()) {
|
||||
is_exist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTabletCopyFinishTask::get_tables_handle_ptr_(
|
||||
const ObITable::TableKey &table_key,
|
||||
ObTablesHandleArray *&tables_handle_ptr)
|
||||
@ -1576,6 +1391,29 @@ int ObTabletCopyFinishTask::get_tables_handle_ptr_(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTabletCopyFinishTask::trim_tablet_()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTabletHandle tablet_handle;
|
||||
ObTablet *tablet = nullptr;
|
||||
const bool is_rollback = false;
|
||||
bool need_merge = false;
|
||||
|
||||
if (!is_inited_) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("tablet copy finish task do not init", K(ret));
|
||||
} else if (OB_FAIL(ls_->get_tablet(tablet_id_, tablet_handle))) {
|
||||
LOG_WARN("failed to get tablet", K(ret), K(tablet_id_));
|
||||
} 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 (tablet->get_tablet_meta().has_next_tablet_
|
||||
&& OB_FAIL(ls_->trim_rebuild_tablet(tablet_id_, is_rollback))) {
|
||||
LOG_WARN("failed to trim rebuild tablet", K(ret), K(tablet_id_));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,19 +226,9 @@ private:
|
||||
int create_new_table_store_with_major_();
|
||||
int create_new_table_store_with_ddl_();
|
||||
int create_new_table_store_with_minor_();
|
||||
int inner_update_tablet_table_store_with_minor_(
|
||||
const bool &need_tablet_meta_merge,
|
||||
ObTablesHandleArray *tables_handle_ptr);
|
||||
int inner_update_tablet_table_store_with_major_(
|
||||
const common::ObTabletID &tablet_id,
|
||||
ObITable *table);
|
||||
int trim_tablet_();
|
||||
|
||||
int update_tablet_data_status_();
|
||||
int check_need_merge_tablet_meta_(
|
||||
ObTablet *tablet,
|
||||
bool &need_merge);
|
||||
int check_remote_logical_sstable_exist_(
|
||||
ObTablet *tablet,
|
||||
bool &is_exist);
|
||||
int get_tables_handle_ptr_(
|
||||
const ObITable::TableKey &table_key,
|
||||
ObTablesHandleArray *&table_handle_ptr);
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "storage/tablet/ob_tablet_common.h"
|
||||
#include "storage/tablet/ob_tablet_create_delete_helper.h"
|
||||
#include "share/scn.h"
|
||||
#include "observer/ob_server_event_history_table_operator.h"
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
@ -311,8 +312,11 @@ int ObStorageHATabletsBuilder::create_or_update_tablet_(
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const bool keep_old = param_.need_keep_old_tablet_;
|
||||
ObTablesHandleArray tables_handle;
|
||||
ObTablesHandleArray major_tables;
|
||||
ObTablesHandleArray remote_logical_table;
|
||||
ObBatchUpdateTableStoreParam param;
|
||||
ObArenaAllocator allocator;
|
||||
ObStorageSchema storage_schema;
|
||||
|
||||
if (!is_inited_) {
|
||||
ret = OB_NOT_INIT;
|
||||
@ -323,22 +327,24 @@ int ObStorageHATabletsBuilder::create_or_update_tablet_(
|
||||
} else if (ObCopyTabletStatus::TABLET_NOT_EXIST == tablet_info.status_ && tablet_info.tablet_id_.is_ls_inner_tablet()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("sys tablet should exist", K(ret), K(tablet_info));
|
||||
} else if (OB_FAIL(hold_local_reuse_sstable_(tablet_info.tablet_id_, tables_handle))) {
|
||||
} else if (OB_FAIL(hold_local_reuse_sstable_(tablet_info.tablet_id_, major_tables, storage_schema, allocator))) {
|
||||
LOG_WARN("failed to hold local reuse sstable", K(ret), K(tablet_info));
|
||||
} else if (OB_FAIL(ls->rebuild_create_tablet(tablet_info.param_, keep_old))) {
|
||||
LOG_WARN("failed to create or update tablet", K(ret), K(tablet_info));
|
||||
} else if (OB_FAIL(create_tablet_remote_logical_sstable_(tablet_info.tablet_id_, tables_handle))) {
|
||||
} else if (OB_FAIL(create_tablet_with_major_sstables_(ls, tablet_info, major_tables, storage_schema))) {
|
||||
LOG_WARN("failed to crete tablet with major sstables", K(ret), KPC(ls), K(tablet_info), K(major_tables));
|
||||
} else if (OB_FAIL(create_tablet_remote_logical_sstable_(tablet_info.tablet_id_, remote_logical_table))) {
|
||||
LOG_WARN("failed to create tablet remote logical sstable", K(ret), K(tablet_info));
|
||||
} else if (tables_handle.empty()) {
|
||||
} else if (remote_logical_table.empty()) {
|
||||
//do nothing
|
||||
} else if (OB_FAIL(param.tables_handle_.assign(tables_handle))) {
|
||||
LOG_WARN("failed to assign tables handle", K(ret), K(tables_handle), K(tablet_info));
|
||||
} else if (OB_FAIL(param.tables_handle_.assign(remote_logical_table))) {
|
||||
LOG_WARN("failed to assign tables handle", K(ret), K(remote_logical_table), K(tablet_info));
|
||||
} else if (FALSE_IT(param.tablet_meta_ = &tablet_info.param_)) {
|
||||
} else if (FALSE_IT(param.rebuild_seq_ = ls->get_rebuild_seq())) {
|
||||
} else if (OB_FAIL(ls->build_ha_tablet_new_table_store(tablet_info.tablet_id_, param))) {
|
||||
LOG_WARN("failed to build ha tablet new table store", K(ret), K(tables_handle), K(tablet_info));
|
||||
LOG_WARN("failed to build ha tablet new table store", K(ret), K(remote_logical_table), K(tablet_info));
|
||||
} else {
|
||||
LOG_INFO("succeed build ha table new table store", K(tablet_info), K(tables_handle));
|
||||
LOG_INFO("succeed build ha table new table store", K(tablet_info), K(remote_logical_table));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -794,7 +800,9 @@ int ObStorageHATabletsBuilder::get_ddl_sstable_max_start_scn_(
|
||||
|
||||
int ObStorageHATabletsBuilder::hold_local_reuse_sstable_(
|
||||
const common::ObTabletID &tablet_id,
|
||||
ObTablesHandleArray &tables_handle)
|
||||
ObTablesHandleArray &tables_handle,
|
||||
ObStorageSchema &storage_schema,
|
||||
common::ObIAllocator &allocator)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
tables_handle.reset();
|
||||
@ -827,6 +835,13 @@ int ObStorageHATabletsBuilder::hold_local_reuse_sstable_(
|
||||
}
|
||||
} else if (OB_FAIL(hold_local_complete_tablet_sstable_(tablet, tables_handle))) {
|
||||
LOG_WARN("failed to hold local complete tablet sstable", K(ret), KP(tablet));
|
||||
} else if (!storage_schema.is_valid()
|
||||
|| storage_schema.get_schema_version() < tablet->get_storage_schema().get_schema_version()) {
|
||||
allocator.reset();
|
||||
storage_schema.reset();
|
||||
if (OB_FAIL(storage_schema.init(allocator, tablet->get_storage_schema()))) {
|
||||
LOG_WARN("failed to init storage schema", K(ret), KPC(tablet));
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_FAIL(ret)) {
|
||||
@ -1119,6 +1134,25 @@ int ObStorageHATabletsBuilder::update_local_tablet_(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObStorageHATabletsBuilder::create_tablet_with_major_sstables_(
|
||||
ObLS *ls,
|
||||
const obrpc::ObCopyTabletInfo &tablet_info,
|
||||
const ObTablesHandleArray &major_tables,
|
||||
const ObStorageSchema &storage_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (!is_inited_) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("storage ha tablets builder do not init", K(ret));
|
||||
} else if (major_tables.empty()) {
|
||||
//do nothing
|
||||
} else if (OB_FAIL(ObStorageHATabletBuilderUtil::build_tablet_with_major_tables(ls,
|
||||
tablet_info.tablet_id_, major_tables, storage_schema))) {
|
||||
LOG_WARN("failed to build tablet with major tables", K(ret), K(tablet_info), KPC(ls));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/******************ObStorageHATabletTableInfoMgr*********************/
|
||||
ObStorageHATableInfoMgr::ObStorageHATabletTableInfoMgr::ObStorageHATabletTableInfoMgr()
|
||||
: is_inited_(false),
|
||||
@ -1883,6 +1917,292 @@ int ObStorageHACopySSTableInfoMgr::get_copy_sstable_maro_range_info(
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/******************ObStorageHATabletBuilderUtil*********************/
|
||||
|
||||
int ObStorageHATabletBuilderUtil::get_tablet_(
|
||||
const common::ObTabletID &tablet_id,
|
||||
ObLS *ls,
|
||||
ObTabletHandle &tablet_handle)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(ls->get_tablet(tablet_id, tablet_handle))) {
|
||||
LOG_WARN("failed to get tablet", K(ret), K(tablet_id), KPC(ls));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObStorageHATabletBuilderUtil::build_tablet_with_major_tables(
|
||||
ObLS *ls,
|
||||
const common::ObTabletID &tablet_id,
|
||||
const ObTablesHandleArray &major_tables,
|
||||
const ObStorageSchema &storage_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTabletHandle tablet_handle;
|
||||
ObTablet *tablet = nullptr;
|
||||
ObSEArray<ObITable *, MAX_SSTABLE_CNT_IN_STORAGE> major_table_array;
|
||||
int64_t multi_version_start = 0;
|
||||
|
||||
if (OB_ISNULL(ls) || !tablet_id.is_valid()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("build tablet with major tables get invalid argument", K(ret), KP(ls), K(tablet_id));
|
||||
} 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 (FALSE_IT(tablet = tablet_handle.get_obj())) {
|
||||
} else if (OB_FAIL(calc_multi_version_start_with_major_(major_tables, tablet, multi_version_start))) {
|
||||
LOG_WARN("failed to calc multi version start with major", K(ret), KPC(tablet));
|
||||
} else if (OB_FAIL(major_tables.get_tables(major_table_array))) {
|
||||
LOG_WARN("failed to get tables", K(ret));
|
||||
} else if (OB_FAIL(ObTableStoreUtil::sort_major_tables(major_table_array))) {
|
||||
LOG_WARN("failed to sort mjaor tables", K(ret));
|
||||
} else {
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < major_table_array.count(); ++i) {
|
||||
ObITable *table_ptr = major_table_array.at(i);
|
||||
if (OB_ISNULL(table_ptr)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table ptr should not be null", K(ret), KP(table_ptr));
|
||||
} else if (!table_ptr->is_major_sstable()) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table ptr is not major", K(ret), KPC(table_ptr));
|
||||
} else if (OB_FAIL(inner_update_tablet_table_store_with_major_(multi_version_start, ls,
|
||||
tablet, table_ptr, storage_schema))) {
|
||||
LOG_WARN("failed to update tablet table store", K(ret), K(tablet_id), KPC(table_ptr));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObStorageHATabletBuilderUtil::calc_multi_version_start_with_major_(
|
||||
const ObTablesHandleArray &major_tables,
|
||||
ObTablet *tablet,
|
||||
int64_t &multi_version_start)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
multi_version_start = 0;
|
||||
int64_t tmp_multi_version_start = INT64_MAX;
|
||||
if (OB_ISNULL(tablet)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("calc multi version start with major get invalid argument", K(ret), KP(tablet));
|
||||
} else {
|
||||
const ObSSTableArray &local_major_tables = tablet->get_table_store().get_major_sstables();
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < local_major_tables.count(); ++i) {
|
||||
const ObITable *table = local_major_tables.get_table(i);
|
||||
if (OB_ISNULL(table)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table should not be NULL", K(ret), KP(table), KPC(tablet));
|
||||
} else {
|
||||
tmp_multi_version_start = std::min(tmp_multi_version_start, table->get_snapshot_version());
|
||||
}
|
||||
}
|
||||
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < major_tables.get_count(); ++i) {
|
||||
const ObITable *table = major_tables.get_table(i);
|
||||
if (OB_ISNULL(table)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table should not be NULL", K(ret), KP(table), KPC(tablet));
|
||||
} else {
|
||||
tmp_multi_version_start = std::min(tmp_multi_version_start, table->get_snapshot_version());
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (INT64_MAX == tmp_multi_version_start) {
|
||||
//do nothing
|
||||
} else {
|
||||
multi_version_start = tmp_multi_version_start;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObStorageHATabletBuilderUtil::inner_update_tablet_table_store_with_major_(
|
||||
const int64_t multi_version_start,
|
||||
ObLS *ls,
|
||||
ObTablet *tablet,
|
||||
ObITable *table,
|
||||
const ObStorageSchema &storage_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTabletHandle tablet_handle;
|
||||
ObTableHandleV2 table_handle_v2;
|
||||
SCN tablet_snapshot_version;
|
||||
ObTenantMetaMemMgr *meta_mem_mgr = nullptr;
|
||||
if (multi_version_start < 0 || OB_ISNULL(tablet) || OB_ISNULL(table) || OB_ISNULL(ls)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("table ptr should not be null", K(ret), K(multi_version_start), KP(tablet), KP(table), KP(ls));
|
||||
} else if (OB_ISNULL(meta_mem_mgr = MTL(ObTenantMetaMemMgr *))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("failed to get meta mem mgr from MTL", K(ret));
|
||||
} else if (OB_FAIL(table_handle_v2.set_table(table, meta_mem_mgr, table->get_key().table_type_))) {
|
||||
LOG_WARN("failed to set table handle v2", K(ret), KPC(table));
|
||||
} else if (OB_FAIL(tablet->get_snapshot_version(tablet_snapshot_version))) {
|
||||
LOG_WARN("failed to get_snapshot_version", K(ret));
|
||||
} else {
|
||||
const ObTabletID &tablet_id = tablet->get_tablet_meta().tablet_id_;
|
||||
const int64_t update_snapshot_version = MAX(tablet->get_snapshot_version(), table->get_key().get_snapshot_version());
|
||||
const int64_t update_multi_version_start = MAX(tablet->get_multi_version_start(), multi_version_start);
|
||||
ObUpdateTableStoreParam param(table_handle_v2,
|
||||
update_snapshot_version,
|
||||
update_multi_version_start,
|
||||
&storage_schema,
|
||||
ls->get_rebuild_seq(),
|
||||
true/*need_report*/,
|
||||
SCN::min_scn()/*clog_checkpoint_scn*/,
|
||||
true/*need_check_sstable*/,
|
||||
true/*allow_duplicate_sstable*/);
|
||||
if (tablet->get_storage_schema().get_version() < storage_schema.get_version()) {
|
||||
SERVER_EVENT_ADD("storage_ha", "schema_change_need_merge_tablet_meta",
|
||||
"tenant_id", MTL_ID(),
|
||||
"tablet_id", tablet_id.id(),
|
||||
"old_schema_version", tablet->get_storage_schema().get_version(),
|
||||
"new_schema_version", storage_schema.get_version());
|
||||
}
|
||||
#ifdef ERRSIM
|
||||
SERVER_EVENT_ADD("storage_ha", "update_major_tablet_table_store",
|
||||
"tablet_id", tablet_id.id(),
|
||||
"old_multi_version_start", tablet->get_multi_version_start(),
|
||||
"new_multi_version_start", update_multi_version_start,
|
||||
"old_snapshot_version", tablet->get_snapshot_version(),
|
||||
"new_snapshot_version", table->get_key().get_snapshot_version());
|
||||
#endif
|
||||
if (FAILEDx(ls->update_tablet_table_store(tablet_id, param, tablet_handle))) {
|
||||
LOG_WARN("failed to build ha tablet new table store", K(ret), KPC(tablet), K(param));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObStorageHATabletBuilderUtil::build_table_with_minor_tables(
|
||||
ObLS *ls,
|
||||
const common::ObTabletID &tablet_id,
|
||||
const ObMigrationTabletParam *src_tablet_meta,
|
||||
const ObTablesHandleArray &minor_tables)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTabletHandle tablet_handle;
|
||||
ObTablet *tablet = nullptr;
|
||||
const bool need_tablet_meta_merge = true;
|
||||
|
||||
if (OB_ISNULL(ls) || !tablet_id.is_valid() || OB_ISNULL(src_tablet_meta)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("build tablet with major tables get invalid argument", K(ret), KP(ls), K(tablet_id));
|
||||
} 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 (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, minor_tables))) {
|
||||
LOG_WARN("failed to update tablet table store with minor", K(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObStorageHATabletBuilderUtil::build_table_with_ddl_tables(
|
||||
ObLS *ls,
|
||||
const common::ObTabletID &tablet_id,
|
||||
const ObTablesHandleArray &ddl_tables)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObTabletHandle tablet_handle;
|
||||
ObTablet *tablet = nullptr;
|
||||
const bool need_tablet_meta_merge = false;
|
||||
const ObMigrationTabletParam *src_tablet_meta = nullptr;
|
||||
|
||||
if (OB_ISNULL(ls) || !tablet_id.is_valid()) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("build tablet with major tables get invalid argument", K(ret), KP(ls), K(tablet_id));
|
||||
} 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 (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, ddl_tables))) {
|
||||
LOG_WARN("failed to update tablet table store with minor", K(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObStorageHATabletBuilderUtil::inner_update_tablet_table_store_with_minor_(
|
||||
ObLS *ls,
|
||||
ObTablet *tablet,
|
||||
const bool &need_tablet_meta_merge,
|
||||
const ObMigrationTabletParam *src_tablet_meta,
|
||||
const ObTablesHandleArray &tables_handle)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObBatchUpdateTableStoreParam update_table_store_param;
|
||||
const bool is_rollback = false;
|
||||
bool need_merge = false;
|
||||
|
||||
if (OB_ISNULL(ls) || OB_ISNULL(tablet) || (need_tablet_meta_merge && OB_ISNULL(src_tablet_meta))) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("inner update tablet table store with minor get invalid argument", K(ret), KP(ls), KP(tablet));
|
||||
} else if (need_tablet_meta_merge && OB_FAIL(check_need_merge_tablet_meta_(src_tablet_meta, tablet, need_merge))) {
|
||||
LOG_WARN("failedto check remote logical sstable exist", K(ret), KPC(tablet));
|
||||
} else {
|
||||
const ObTabletID &tablet_id = tablet->get_tablet_meta().tablet_id_;
|
||||
update_table_store_param.tablet_meta_ = need_merge ? src_tablet_meta : nullptr;
|
||||
update_table_store_param.rebuild_seq_ = ls->get_rebuild_seq();
|
||||
|
||||
if (tables_handle.empty()) {
|
||||
//do nothing
|
||||
} else 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_ha_tablet_new_table_store(tablet_id, update_table_store_param))) {
|
||||
LOG_WARN("failed to build ha tablet new table store", K(ret), K(tablet_id), KPC(src_tablet_meta), K(update_table_store_param));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObStorageHATabletBuilderUtil::check_need_merge_tablet_meta_(
|
||||
const ObMigrationTabletParam *src_tablet_meta,
|
||||
ObTablet *tablet,
|
||||
bool &need_merge)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
need_merge = false;
|
||||
bool is_exist = false;
|
||||
if (OB_ISNULL(tablet) || OB_ISNULL(src_tablet_meta)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("check need merge tablet meta get invalid argument", K(ret), KP(tablet), KP(src_tablet_meta));
|
||||
} else if (tablet->get_tablet_meta().clog_checkpoint_scn_ >= src_tablet_meta->clog_checkpoint_scn_) {
|
||||
need_merge = false;
|
||||
} else if (OB_FAIL(check_remote_logical_sstable_exist(tablet, is_exist))) {
|
||||
LOG_WARN("failed to check remote logical sstable exist", K(ret), KPC(tablet));
|
||||
} else if (!is_exist) {
|
||||
need_merge = false;
|
||||
} else {
|
||||
need_merge = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObStorageHATabletBuilderUtil::check_remote_logical_sstable_exist(
|
||||
ObTablet *tablet,
|
||||
bool &is_exist)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
is_exist = false;
|
||||
|
||||
if (OB_ISNULL(tablet)) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("check remote logical sstable exist get invalid argument", K(ret), KP(tablet));
|
||||
} else {
|
||||
const ObSSTableArray &minor_sstables = tablet->get_table_store().get_minor_sstables();
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < minor_sstables.count(); ++i) {
|
||||
const ObITable *table = minor_sstables.array_[i];
|
||||
if (OB_ISNULL(table)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("minor sstable should not be NULL", K(ret), KP(table));
|
||||
} else if (table->is_remote_logical_minor_sstable()) {
|
||||
is_exist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,9 @@ private:
|
||||
share::SCN &max_start_scn);
|
||||
int hold_local_reuse_sstable_(
|
||||
const common::ObTabletID &tablet_id,
|
||||
ObTablesHandleArray &tables_handle);
|
||||
ObTablesHandleArray &tables_handle,
|
||||
ObStorageSchema &storage_schema,
|
||||
common::ObIAllocator &allocator);
|
||||
int hold_local_complete_tablet_sstable_(
|
||||
ObTablet *tablet,
|
||||
ObTablesHandleArray &tables_handle);
|
||||
@ -132,11 +134,14 @@ private:
|
||||
int update_local_tablet_(
|
||||
const obrpc::ObCopyTabletInfo &tablet_info,
|
||||
ObLS *ls);
|
||||
|
||||
int create_tablet_remote_logical_sstable_(
|
||||
ObTablet *tablet,
|
||||
ObTablesHandleArray &tables_handle);
|
||||
|
||||
int create_tablet_with_major_sstables_(
|
||||
ObLS *ls,
|
||||
const obrpc::ObCopyTabletInfo &tablet_info,
|
||||
const ObTablesHandleArray &major_tables,
|
||||
const ObStorageSchema &storage_schema);
|
||||
private:
|
||||
bool is_inited_;
|
||||
ObStorageHATabletsBuilderParam param_;
|
||||
@ -265,6 +270,53 @@ private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObStorageHACopySSTableInfoMgr);
|
||||
};
|
||||
|
||||
class ObStorageHATabletBuilderUtil
|
||||
{
|
||||
public:
|
||||
static int build_tablet_with_major_tables(
|
||||
ObLS *ls,
|
||||
const common::ObTabletID &tablet_id,
|
||||
const ObTablesHandleArray &major_tables,
|
||||
const ObStorageSchema &storage_schema);
|
||||
static int build_table_with_minor_tables(
|
||||
ObLS *ls,
|
||||
const common::ObTabletID &tablet_id,
|
||||
const ObMigrationTabletParam *src_tablet_meta,
|
||||
const ObTablesHandleArray &minor_tables);
|
||||
static int build_table_with_ddl_tables(
|
||||
ObLS *ls,
|
||||
const common::ObTabletID &tablet_id,
|
||||
const ObTablesHandleArray &ddl_tables);
|
||||
static int check_remote_logical_sstable_exist(
|
||||
ObTablet *tablet,
|
||||
bool &is_exist);
|
||||
private:
|
||||
static int get_tablet_(
|
||||
const common::ObTabletID &tablet_id,
|
||||
ObLS *ls,
|
||||
ObTabletHandle &tablet_handle);
|
||||
static int calc_multi_version_start_with_major_(
|
||||
const ObTablesHandleArray &major_tables,
|
||||
ObTablet *tablet,
|
||||
int64_t &multi_version_start);
|
||||
static int inner_update_tablet_table_store_with_major_(
|
||||
const int64_t multi_version_start,
|
||||
ObLS *ls,
|
||||
ObTablet *tablet,
|
||||
ObITable *table,
|
||||
const ObStorageSchema &storage_schema);
|
||||
static int inner_update_tablet_table_store_with_minor_(
|
||||
ObLS *ls,
|
||||
ObTablet *tablet,
|
||||
const bool &need_tablet_meta_merge,
|
||||
const ObMigrationTabletParam *src_tablet_meta,
|
||||
const ObTablesHandleArray &tables_handle);
|
||||
static int check_need_merge_tablet_meta_(
|
||||
const ObMigrationTabletParam *src_tablet_meta,
|
||||
ObTablet *tablet,
|
||||
bool &need_merge);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -318,8 +318,6 @@ bool ObUpdateTableStoreParam::is_valid() const
|
||||
|
||||
ObBatchUpdateTableStoreParam::ObBatchUpdateTableStoreParam()
|
||||
: tables_handle_(),
|
||||
snapshot_version_(0),
|
||||
multi_version_start_(0),
|
||||
rebuild_seq_(OB_INVALID_VERSION),
|
||||
update_logical_minor_sstable_(false),
|
||||
start_scn_(SCN::min_scn()),
|
||||
@ -330,7 +328,6 @@ ObBatchUpdateTableStoreParam::ObBatchUpdateTableStoreParam()
|
||||
void ObBatchUpdateTableStoreParam::reset()
|
||||
{
|
||||
tables_handle_.reset();
|
||||
multi_version_start_ = 0;
|
||||
rebuild_seq_ = OB_INVALID_VERSION;
|
||||
update_logical_minor_sstable_ = false;
|
||||
start_scn_.set_min();
|
||||
@ -339,9 +336,7 @@ void ObBatchUpdateTableStoreParam::reset()
|
||||
|
||||
bool ObBatchUpdateTableStoreParam::is_valid() const
|
||||
{
|
||||
return snapshot_version_ >= 0
|
||||
&& multi_version_start_ >= 0
|
||||
&& rebuild_seq_ > OB_INVALID_VERSION
|
||||
return rebuild_seq_ > OB_INVALID_VERSION
|
||||
&& (!update_logical_minor_sstable_
|
||||
|| (update_logical_minor_sstable_ && start_scn_ > SCN::min_scn() && OB_ISNULL(tablet_meta_)));
|
||||
}
|
||||
@ -356,7 +351,6 @@ int ObBatchUpdateTableStoreParam::assign(
|
||||
} else if (OB_FAIL(tables_handle_.assign(param.tables_handle_))) {
|
||||
LOG_WARN("failed to assign tables handle", K(ret), K(param));
|
||||
} else {
|
||||
multi_version_start_ = param.multi_version_start_;
|
||||
rebuild_seq_ = param.rebuild_seq_;
|
||||
update_logical_minor_sstable_ = param.update_logical_minor_sstable_;
|
||||
start_scn_ = param.start_scn_;
|
||||
|
@ -362,12 +362,10 @@ struct ObBatchUpdateTableStoreParam final
|
||||
int assign(const ObBatchUpdateTableStoreParam ¶m);
|
||||
int get_max_clog_checkpoint_scn(share::SCN &clog_checkpoint_scn) const;
|
||||
|
||||
TO_STRING_KV(K_(tables_handle), K_(snapshot_version), K_(multi_version_start),
|
||||
K_(rebuild_seq), K_(update_logical_minor_sstable), K_(start_scn), KP_(tablet_meta));
|
||||
TO_STRING_KV(K_(tables_handle), K_(rebuild_seq), K_(update_logical_minor_sstable), K_(start_scn),
|
||||
KP_(tablet_meta));
|
||||
|
||||
ObTablesHandleArray tables_handle_;
|
||||
int64_t snapshot_version_;
|
||||
int64_t multi_version_start_;
|
||||
int64_t rebuild_seq_;
|
||||
bool update_logical_minor_sstable_;
|
||||
share::SCN start_scn_;
|
||||
|
@ -1356,11 +1356,12 @@ int ObTabletTableStore::build_ha_major_tables_(
|
||||
inc_base_snapshot_version = -1;
|
||||
ObArray<ObITable *> major_tables;
|
||||
const bool allow_duplicate_sstable = true;
|
||||
const int64_t multi_version_start = 0;
|
||||
|
||||
if (!old_store.major_tables_.empty() && OB_FAIL(old_store.major_tables_.get_all_tables(major_tables))) {
|
||||
LOG_WARN("failed to get all tables", K(ret), K(old_store));
|
||||
} else if (OB_FAIL(inner_build_major_tables_(allocator, old_store, param.tables_handle_,
|
||||
param.multi_version_start_, allow_duplicate_sstable, inc_base_snapshot_version))) {
|
||||
multi_version_start, allow_duplicate_sstable, inc_base_snapshot_version))) {
|
||||
LOG_WARN("failed to inner build major tables", K(ret), K(param));
|
||||
}
|
||||
return ret;
|
||||
@ -1385,6 +1386,11 @@ int ObTabletTableStore::replace_ha_minor_sstables_(
|
||||
LOG_WARN("failed to get old minor tables", K(ret), K(old_store));
|
||||
} else if (OB_FAIL(check_old_store_minor_sstables_(old_minor_tables))) {
|
||||
LOG_WARN("failed to check old store minor sstables", K(ret), K(old_minor_tables));
|
||||
} else if (need_add_minor_tables.empty()) {
|
||||
if (old_minor_tables.empty()) {
|
||||
} else if (OB_FAIL(minor_tables_.init_and_copy(allocator, old_minor_tables, inc_pos))) {
|
||||
LOG_WARN("failed to init minor_tables", K(ret));
|
||||
}
|
||||
} else if (OB_FAIL(combin_ha_minor_sstables_(old_minor_tables, need_add_minor_tables, new_minor_tables))) {
|
||||
LOG_WARN("failed to combin ha minor sstables", K(ret), K(old_store), K(param));
|
||||
} else if (new_minor_tables.empty()) { // no minor tables
|
||||
|
Loading…
x
Reference in New Issue
Block a user