Skip to content

Commit

Permalink
variable: disable tidb_read_staleness for SET_VAR hint (#48477) (#48491)
Browse files Browse the repository at this point in the history
close #48478
  • Loading branch information
ti-chi-bot authored Nov 9, 2023
1 parent 963a6dc commit 8c0f360
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 100 deletions.
145 changes: 73 additions & 72 deletions pkg/sessionctx/variable/setvar_affect.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,78 +31,79 @@ var isHintUpdatableVerified = map[string]struct{}{
"tidb_enable_outer_join_reorder": {},
"tidb_enable_null_aware_anti_join": {},
"tidb_replica_read": {},
"tidb_read_staleness": {},
"tidb_enable_paging": {},
"tidb_read_consistency": {},
"tidb_distsql_scan_concurrency": {},
"tidb_opt_insubq_to_join_and_agg": {},
"tidb_opt_prefer_range_scan": {},
"tidb_opt_enable_correlation_adjustment": {},
"tidb_opt_limit_push_down_threshold": {},
"tidb_opt_correlation_threshold": {},
"tidb_opt_correlation_exp_factor": {},
"tidb_opt_cpu_factor": {},
"tidb_opt_copcpu_factor": {},
"tidb_opt_tiflash_concurrency_factor": {},
"tidb_opt_network_factor": {},
"tidb_opt_scan_factor": {},
"tidb_opt_desc_factor": {},
"tidb_opt_seek_factor": {},
"tidb_opt_memory_factor": {},
"tidb_opt_disk_factor": {},
"tidb_opt_concurrency_factor": {},
"tidb_opt_force_inline_cte": {},
"tidb_index_join_batch_size": {},
"tidb_index_lookup_size": {},
"tidb_index_serial_scan_concurrency": {},
"tidb_allow_batch_cop": {},
"tidb_allow_mpp": {},
"tidb_enforce_mpp": {},
"tidb_max_bytes_before_tiflash_external_join": {},
"tidb_max_bytes_before_tiflash_external_group_by": {},
"tidb_max_bytes_before_tiflash_external_sort": {},
"tidb_min_paging_size": {},
"tidb_max_paging_size": {},
"tidb_enable_cascades_planner": {},
"tidb_merge_join_concurrency": {},
"tidb_index_merge_intersection_concurrency": {},
"tidb_opt_projection_push_down": {},
"tidb_enable_vectorized_expression": {},
"tidb_opt_join_reorder_threshold": {},
"tidb_enable_index_merge": {},
"tidb_enable_extended_stats": {},
"tidb_isolation_read_engines": {},
"tidb_executor_concurrency": {},
"tidb_partition_prune_mode": {},
"tidb_enable_index_merge_join": {},
"tidb_enable_ordered_result_mode": {},
"tidb_enable_pseudo_for_outdated_stats": {},
"tidb_stats_load_sync_wait": {},
"tidb_cost_model_version": {},
"tidb_index_join_double_read_penalty_cost_rate": {},
"tidb_default_string_match_selectivity": {},
"tidb_enable_prepared_plan_cache": {},
"tidb_enable_non_prepared_plan_cache": {},
"tidb_plan_cache_max_plan_size": {},
"tidb_opt_range_max_size": {},
"tidb_opt_advanced_join_hint": {},
"tidb_opt_prefix_index_single_scan": {},
"tidb_store_batch_size": {},
"mpp_version": {},
"tidb_enable_inl_join_inner_multi_pattern": {},
"tidb_opt_enable_late_materialization": {},
"tidb_opt_ordering_index_selectivity_threshold": {},
"tidb_opt_enable_mpp_shared_cte_execution": {},
"tidb_opt_fix_control": {},
"tidb_runtime_filter_type": {},
"tidb_runtime_filter_mode": {},
"tidb_session_alias": {},
"tidb_opt_objective": {},
"mpp_exchange_compression_mode": {},
"tidb_allow_fallback_to_tikv": {},
"tiflash_fastscan": {},
"tiflash_fine_grained_shuffle_batch_size": {},
"tiflash_fine_grained_shuffle_stream_count": {},
// This var is used during the planner's preprocess phase. Need to fix its behavior.
// "tidb_read_staleness": {},
"tidb_enable_paging": {},
"tidb_read_consistency": {},
"tidb_distsql_scan_concurrency": {},
"tidb_opt_insubq_to_join_and_agg": {},
"tidb_opt_prefer_range_scan": {},
"tidb_opt_enable_correlation_adjustment": {},
"tidb_opt_limit_push_down_threshold": {},
"tidb_opt_correlation_threshold": {},
"tidb_opt_correlation_exp_factor": {},
"tidb_opt_cpu_factor": {},
"tidb_opt_copcpu_factor": {},
"tidb_opt_tiflash_concurrency_factor": {},
"tidb_opt_network_factor": {},
"tidb_opt_scan_factor": {},
"tidb_opt_desc_factor": {},
"tidb_opt_seek_factor": {},
"tidb_opt_memory_factor": {},
"tidb_opt_disk_factor": {},
"tidb_opt_concurrency_factor": {},
"tidb_opt_force_inline_cte": {},
"tidb_index_join_batch_size": {},
"tidb_index_lookup_size": {},
"tidb_index_serial_scan_concurrency": {},
"tidb_allow_batch_cop": {},
"tidb_allow_mpp": {},
"tidb_enforce_mpp": {},
"tidb_max_bytes_before_tiflash_external_join": {},
"tidb_max_bytes_before_tiflash_external_group_by": {},
"tidb_max_bytes_before_tiflash_external_sort": {},
"tidb_min_paging_size": {},
"tidb_max_paging_size": {},
"tidb_enable_cascades_planner": {},
"tidb_merge_join_concurrency": {},
"tidb_index_merge_intersection_concurrency": {},
"tidb_opt_projection_push_down": {},
"tidb_enable_vectorized_expression": {},
"tidb_opt_join_reorder_threshold": {},
"tidb_enable_index_merge": {},
"tidb_enable_extended_stats": {},
"tidb_isolation_read_engines": {},
"tidb_executor_concurrency": {},
"tidb_partition_prune_mode": {},
"tidb_enable_index_merge_join": {},
"tidb_enable_ordered_result_mode": {},
"tidb_enable_pseudo_for_outdated_stats": {},
"tidb_stats_load_sync_wait": {},
"tidb_cost_model_version": {},
"tidb_index_join_double_read_penalty_cost_rate": {},
"tidb_default_string_match_selectivity": {},
"tidb_enable_prepared_plan_cache": {},
"tidb_enable_non_prepared_plan_cache": {},
"tidb_plan_cache_max_plan_size": {},
"tidb_opt_range_max_size": {},
"tidb_opt_advanced_join_hint": {},
"tidb_opt_prefix_index_single_scan": {},
"tidb_store_batch_size": {},
"mpp_version": {},
"tidb_enable_inl_join_inner_multi_pattern": {},
"tidb_opt_enable_late_materialization": {},
"tidb_opt_ordering_index_selectivity_threshold": {},
"tidb_opt_enable_mpp_shared_cte_execution": {},
"tidb_opt_fix_control": {},
"tidb_runtime_filter_type": {},
"tidb_runtime_filter_mode": {},
"tidb_session_alias": {},
"tidb_opt_objective": {},
"mpp_exchange_compression_mode": {},
"tidb_allow_fallback_to_tikv": {},
"tiflash_fastscan": {},
"tiflash_fine_grained_shuffle_batch_size": {},
"tiflash_fine_grained_shuffle_stream_count": {},
// Variables that is compatible with MySQL.
"cte_max_recursion_depth": {},
"sql_mode": {},
Expand Down
20 changes: 0 additions & 20 deletions tests/integrationtest/r/sessionctx/setvar.result
Original file line number Diff line number Diff line change
Expand Up @@ -477,26 +477,6 @@ set @@tidb_enable_null_aware_anti_join=default;
select @@tidb_enable_null_aware_anti_join;
@@tidb_enable_null_aware_anti_join
1
select /*+ set_var(tidb_read_staleness=0) */ @@tidb_read_staleness;
@@tidb_read_staleness
0
select @@tidb_read_staleness;
@@tidb_read_staleness
0
set @@tidb_read_staleness=default;
select @@tidb_read_staleness;
@@tidb_read_staleness
0
select /*+ set_var(tidb_read_staleness=-1) */ @@tidb_read_staleness;
@@tidb_read_staleness
-1
select @@tidb_read_staleness;
@@tidb_read_staleness
0
set @@tidb_read_staleness=default;
select @@tidb_read_staleness;
@@tidb_read_staleness
0
select /*+ set_var(tidb_enable_paging=0) */ @@tidb_enable_paging;
@@tidb_enable_paging
0
Expand Down
16 changes: 8 additions & 8 deletions tests/integrationtest/t/sessionctx/setvar.test
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,14 @@ select /*+ set_var(tidb_enable_null_aware_anti_join=1) */ @@tidb_enable_null_awa
select @@tidb_enable_null_aware_anti_join;
set @@tidb_enable_null_aware_anti_join=default;
select @@tidb_enable_null_aware_anti_join;
select /*+ set_var(tidb_read_staleness=0) */ @@tidb_read_staleness;
select @@tidb_read_staleness;
set @@tidb_read_staleness=default;
select @@tidb_read_staleness;
select /*+ set_var(tidb_read_staleness=-1) */ @@tidb_read_staleness;
select @@tidb_read_staleness;
set @@tidb_read_staleness=default;
select @@tidb_read_staleness;
# select /*+ set_var(tidb_read_staleness=0) */ @@tidb_read_staleness;
# select @@tidb_read_staleness;
# set @@tidb_read_staleness=default;
# select @@tidb_read_staleness;
# select /*+ set_var(tidb_read_staleness=-1) */ @@tidb_read_staleness;
# select @@tidb_read_staleness;
# set @@tidb_read_staleness=default;
# select @@tidb_read_staleness;
select /*+ set_var(tidb_enable_paging=0) */ @@tidb_enable_paging;
select @@tidb_enable_paging;
set @@tidb_enable_paging=default;
Expand Down

0 comments on commit 8c0f360

Please sign in to comment.