Fix flashback error code when read snapshot recycled
This commit is contained in:
		| @ -321,7 +321,7 @@ int ObDASScanOp::open_op() | |||||||
|     LOG_WARN("init scan param failed", K(ret)); |     LOG_WARN("init scan param failed", K(ret)); | ||||||
|   } else if (OB_FAIL(tsc_service.table_scan(scan_param_, result_))) { |   } else if (OB_FAIL(tsc_service.table_scan(scan_param_, result_))) { | ||||||
|     if (OB_SNAPSHOT_DISCARDED == ret && scan_param_.fb_snapshot_.is_valid()) { |     if (OB_SNAPSHOT_DISCARDED == ret && scan_param_.fb_snapshot_.is_valid()) { | ||||||
|       ret = OB_TABLE_DEFINITION_CHANGED; |       ret = OB_INVALID_QUERY_TIMESTAMP; | ||||||
|     } else if (OB_TRY_LOCK_ROW_CONFLICT != ret) { |     } else if (OB_TRY_LOCK_ROW_CONFLICT != ret) { | ||||||
|       LOG_WARN("fail to scan table", K(scan_param_), K(ret)); |       LOG_WARN("fail to scan table", K(scan_param_), K(ret)); | ||||||
|     } |     } | ||||||
| @ -371,7 +371,6 @@ int ObDASScanOp::release_op() | |||||||
|   //need to clear the flag:need_switch_param_ |   //need to clear the flag:need_switch_param_ | ||||||
|   //otherwise table_rescan will jump to the switch iterator path in retry |   //otherwise table_rescan will jump to the switch iterator path in retry | ||||||
|   scan_param_.need_switch_param_ = false; |   scan_param_.need_switch_param_ = false; | ||||||
|   scan_param_.partition_guard_ = nullptr; |  | ||||||
|   scan_param_.destroy_schema_guard(); |   scan_param_.destroy_schema_guard(); | ||||||
|  |  | ||||||
|   if (retry_alloc_ != nullptr) { |   if (retry_alloc_ != nullptr) { | ||||||
|  | |||||||
| @ -46,7 +46,6 @@ struct ObStorageDatum; | |||||||
| } | } | ||||||
| namespace storage | namespace storage | ||||||
| { | { | ||||||
| class ObIPartitionGroupGuard; |  | ||||||
|  |  | ||||||
| // | // | ||||||
| // Project storage output row to expression array, the core project logic is: | // Project storage output row to expression array, the core project logic is: | ||||||
| @ -135,7 +134,6 @@ public: | |||||||
|         table_param_(NULL), |         table_param_(NULL), | ||||||
|         allocator_(&CURRENT_CONTEXT->get_arena_allocator()), |         allocator_(&CURRENT_CONTEXT->get_arena_allocator()), | ||||||
|         need_scn_(false), |         need_scn_(false), | ||||||
|         partition_guard_(NULL), |  | ||||||
|         need_switch_param_(false), |         need_switch_param_(false), | ||||||
|         is_thread_scope_(true) |         is_thread_scope_(true) | ||||||
|   {} |   {} | ||||||
| @ -150,7 +148,6 @@ public: | |||||||
|   common::ObIAllocator *allocator_; //stmt level allocator, only be free at the end of query |   common::ObIAllocator *allocator_; //stmt level allocator, only be free at the end of query | ||||||
|   common::SampleInfo sample_info_; |   common::SampleInfo sample_info_; | ||||||
|   bool need_scn_; |   bool need_scn_; | ||||||
|   ObIPartitionGroupGuard *partition_guard_; // remove after SQL adopt tablet |  | ||||||
|   bool need_switch_param_; |   bool need_switch_param_; | ||||||
|   OB_INLINE virtual bool is_valid() const { |   OB_INLINE virtual bool is_valid() const { | ||||||
|     return  snapshot_.valid_ && ObVTableScanParam::is_valid(); |     return  snapshot_.valid_ && ObVTableScanParam::is_valid(); | ||||||
|  | |||||||
| @ -540,9 +540,13 @@ int ObAccessService::check_read_allowed_( | |||||||
|     if (OB_FAIL(ret)) { |     if (OB_FAIL(ret)) { | ||||||
|     } else if (OB_FAIL(construct_store_ctx_other_variables_(*ls, tablet_id, scan_param.timeout_, |     } else if (OB_FAIL(construct_store_ctx_other_variables_(*ls, tablet_id, scan_param.timeout_, | ||||||
|          ctx.mvcc_acc_ctx_.get_snapshot_version(), tablet_handle, ctx_guard))) { |          ctx.mvcc_acc_ctx_.get_snapshot_version(), tablet_handle, ctx_guard))) { | ||||||
|  |       if (OB_SNAPSHOT_DISCARDED == ret && scan_param.fb_snapshot_.is_valid()) { | ||||||
|  |         ret = OB_TABLE_DEFINITION_CHANGED; | ||||||
|  |       } else { | ||||||
|         LOG_WARN("failed to check replica allow to read", K(ret), K(tablet_id), "timeout", scan_param.timeout_); |         LOG_WARN("failed to check replica allow to read", K(ret), K(tablet_id), "timeout", scan_param.timeout_); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |   } | ||||||
|   return ret; |   return ret; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 JiahuaChen
					JiahuaChen