diff --git a/deps/oblib/src/lib/utility/ob_tracepoint.h b/deps/oblib/src/lib/utility/ob_tracepoint.h index 7b1df77ab3410be199cad4ad8a175e68d89528d1..f7f23efd1d7f3a6f737485c3e03376bd68836ce3 100644 --- a/deps/oblib/src/lib/utility/ob_tracepoint.h +++ b/deps/oblib/src/lib/utility/ob_tracepoint.h @@ -450,6 +450,8 @@ public: EN_BACKUP_DATA_CLEAN_ERROR = 189, EN_BACKUP_COMMON_HEADER_NOT_COMPLETED = 190, EN_BACKUP_SCHEDULER_WEAK_READ = 191, + EN_CREATE_BACKUP_POINT_ERROR = 193, + EN_CHECK_STANDBY_CLUSTER_SCHEMA_CONDITION = 201, EN_ALLOCATE_LOB_BUF_FAILED = 202, EN_ALLOCATE_DESERIALIZE_LOB_BUF_FAILED = 203, diff --git a/src/storage/backup/ob_partition_base_data_physical_restore_v2.cpp b/src/storage/backup/ob_partition_base_data_physical_restore_v2.cpp index f1d4cfa7efa916f974591d6fd26134e96cf74b4d..a3bdc06b3cc7c9c2ab6b778f0dadd102043f15ca 100644 --- a/src/storage/backup/ob_partition_base_data_physical_restore_v2.cpp +++ b/src/storage/backup/ob_partition_base_data_physical_restore_v2.cpp @@ -898,6 +898,8 @@ int ObPartitionGroupMetaRestoreReaderV2::init(common::ObInOutBandwidthThrottle & ObBackupInfoMgr::get_instance().get_base_data_restore_schema_version(tenant_id, restore_schema_version))) { STORAGE_LOG(WARN, "failed to get base data restore schema version", K(ret), K(tenant_id), K(restore_info)); } else { + // here get min schema because restore may cut data. pg meta record schema version for cut data if restore + // snapshot version is smaller than backup point create end snapshot. current_schema_version = std::min(pg_meta_.storage_info_.get_data_info().get_schema_version(), backup_pg_meta_info_.pg_meta_.storage_info_.get_data_info().get_schema_version()); } diff --git a/src/storage/ob_partition_store.cpp b/src/storage/ob_partition_store.cpp index fde816a2396f1f9f0e07bc9aa208e7332c5d5b6a..097c650e0f5c3c4ce1800c9e92ea3d62ef902473 100644 --- a/src/storage/ob_partition_store.cpp +++ b/src/storage/ob_partition_store.cpp @@ -4552,6 +4552,7 @@ int ObPartitionStore::get_restore_point_normal_tables_(const int64_t snapshot_ve ObTablesHandle tmp_handle; ObTablesHandle new_handle; ObMultiVersionTableStore *table_store = NULL; + bool is_exist = false; if (OB_FAIL(store_map_->get(index_id, table_store))) { LOG_WARN("failed to get table store", K(ret), K(index_id)); } else if (OB_ISNULL(table_store)) { @@ -4559,7 +4560,9 @@ int ObPartitionStore::get_restore_point_normal_tables_(const int64_t snapshot_ve LOG_WARN("table store should not be null", K(ret), "index_id", index_id); } else if (OB_FAIL(table_store->get_multi_version_start(multi_version_start))) { LOG_WARN("failed to get multi_version_start", K(ret), K(pkey_), K(index_id)); - } else if (meta_->create_timestamp_ < snapshot_version && multi_version_start > snapshot_version) { + } else if (OB_FAIL(schema_filter.check_table_exist_in_recovery_schema(index_id, is_exist))) { + LOG_WARN("failed to check table exist in recovery schema", K(ret), K(index_id)); + } else if (is_exist && meta_->create_timestamp_ < snapshot_version && multi_version_start > snapshot_version) { ret = OB_ERR_UNEXPECTED; LOG_WARN("table store has not kept multi version", K(ret), diff --git a/src/storage/ob_pg_storage.cpp b/src/storage/ob_pg_storage.cpp index 154eb2f6f7385423a2ad97ab07d8bb8e1d1c584e..de39bebbf74c9f4a11d6eafdce089bb0cba60feb 100644 --- a/src/storage/ob_pg_storage.cpp +++ b/src/storage/ob_pg_storage.cpp @@ -8119,6 +8119,16 @@ int ObPGStorage::update_backup_points( int ret = OB_SUCCESS; ObSEArray snapshot_versions; const bool is_restore_point = false; + +#ifdef ERRSIM + if (OB_SUCC(ret)) { + ret = E(EventTable::EN_CREATE_BACKUP_POINT_ERROR) OB_SUCCESS; + if (OB_FAIL(ret)) { + STORAGE_LOG(ERROR, "fake EN_CREATE_BACKUP_POINT_ERROR", K(ret)); + } + } +#endif + for (int64_t i = 0; OB_SUCC(ret) && i < backup_points.count(); i++) { const int64_t snapshot_ts = backup_points.at(i); const int64_t schema_version = schema_versions.at(i); diff --git a/src/storage/ob_storage_struct.cpp b/src/storage/ob_storage_struct.cpp index 17871f5334d60758bc51cff4609c0ca52f12990d..07381b0f82b84d772f12ae9065054d378a512e6d 100644 --- a/src/storage/ob_storage_struct.cpp +++ b/src/storage/ob_storage_struct.cpp @@ -1258,6 +1258,25 @@ int ObRecoveryPointSchemaFilter::get_table_ids_in_pg_(const ObPartitionKey &pgke return ret; } +int ObRecoveryPointSchemaFilter::check_table_exist_in_recovery_schema(const uint64_t table_id, bool &is_exist) +{ + int ret = OB_SUCCESS; + ObSchemaGetterGuard *schema_guard = NULL; + is_exist = false; + + if (!is_inited_) { + ret = OB_NOT_INIT; + LOG_WARN("recovery point schema filter do not init", K(ret)); + } else if (OB_INVALID_ID == table_id) { + ret = OB_INVALID_ARGUMENT; + LOG_WARN("check table is local index get invalid argument"); + } else if (FALSE_IT(schema_guard = &recovery_point_schema_guard_)) { + } else if (OB_FAIL(check_table_exist_(table_id, *schema_guard, is_exist))) { + STORAGE_LOG(WARN, "failed to check table exist", K(ret), K(table_id)); + } + return ret; +} + /***********************ObBackupRestoreTableSchemaChecker***************************/ int ObBackupRestoreTableSchemaChecker::check_backup_restore_need_skip_table( const share::schema::ObTableSchema *table_schema, bool &need_skip, const bool is_restore_point) diff --git a/src/storage/ob_storage_struct.h b/src/storage/ob_storage_struct.h index e2322cc1ea60d37ad1438b1ac54f3995bc70b211..94aa3060b414cee05ce3c90fef07374114ee1157 100644 --- a/src/storage/ob_storage_struct.h +++ b/src/storage/ob_storage_struct.h @@ -625,6 +625,7 @@ public: int do_filter_pg_partitions(const common::ObPartitionKey& pg_key, common::ObPartitionArray& partitions); int check_if_table_miss_by_schema( const common::ObPartitionKey& pgkey, const common::hash::ObHashSet& table_ids); + int check_table_exist_in_recovery_schema(const uint64_t table_id, bool &is_exist); TO_STRING_KV( K_(is_inited), K_(tenant_id), K_(tenant_recovery_point_schema_version), K_(tenant_current_schema_version));