[CP] [CP] [CP] Fix backup point create do not filter local sstable which is avaiable after backup point create
This commit is contained in:
		 godyangfight
					godyangfight
				
			
				
					committed by
					
						 wangzelin.wzl
						wangzelin.wzl
					
				
			
			
				
	
			
			
			 wangzelin.wzl
						wangzelin.wzl
					
				
			
						parent
						
							5af4cb27dc
						
					
				
				
					commit
					eab142b0ee
				
			
							
								
								
									
										2
									
								
								deps/oblib/src/lib/utility/ob_tracepoint.h
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								deps/oblib/src/lib/utility/ob_tracepoint.h
									
									
									
									
										vendored
									
									
								
							| @ -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, | ||||
|  | ||||
| @ -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()); | ||||
|     } | ||||
|  | ||||
| @ -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), | ||||
|  | ||||
| @ -8119,6 +8119,16 @@ int ObPGStorage::update_backup_points( | ||||
|   int ret = OB_SUCCESS; | ||||
|   ObSEArray<int64_t, 1> 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); | ||||
|  | ||||
| @ -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) | ||||
|  | ||||
| @ -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<uint64_t>& 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)); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user