MCPcopy Create free account
hub / github.com/MariaDB/server / dsmrr_init

Method dsmrr_init

sql/multi_range_read.cc:1124–1352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1122*/
1123
1124int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
1125 void *seq_init_param, uint n_ranges, uint mode,
1126 HANDLER_BUFFER *buf)
1127{
1128 TABLE *table= h_arg->get_table();
1129 THD *thd= table->in_use;
1130 int res;
1131 Key_parameters keypar;
1132 uint UNINIT_VAR(key_buff_elem_size); /* set/used when do_sort_keys==TRUE */
1133 handler *h_idx;
1134 Mrr_ordered_rndpos_reader *disk_strategy= NULL;
1135 bool do_sort_keys= FALSE;
1136 DBUG_ENTER("DsMrr_impl::dsmrr_init");
1137 /*
1138 index_merge may invoke a scan on an object for which dsmrr_info[_const]
1139 has not been called, so set the owner handler here as well.
1140 */
1141 primary_file= h_arg;
1142 is_mrr_assoc= !MY_TEST(mode & HA_MRR_NO_ASSOCIATION);
1143
1144 strategy_exhausted= FALSE;
1145
1146 /* By default, have do-nothing buffer manager */
1147 buf_manager.arg= this;
1148 buf_manager.reset_buffer_sizes= do_nothing;
1149 buf_manager.redistribute_buffer_space= do_nothing;
1150
1151 if (!hint_key_state(thd, table, h_arg->active_index,
1152 MRR_HINT_ENUM, optimizer_flag(thd, OPTIMIZER_SWITCH_MRR)) ||
1153 mode & (HA_MRR_USE_DEFAULT_IMPL | HA_MRR_SORTED))
1154 goto use_default_impl;
1155
1156 /*
1157 Determine whether we'll need to do key sorting and/or rnd_pos() scan
1158 */
1159 index_strategy= NULL;
1160 if ((mode & HA_MRR_SINGLE_POINT) &&
1161 optimizer_flag(thd, OPTIMIZER_SWITCH_MRR_SORT_KEYS))
1162 {
1163 do_sort_keys= TRUE;
1164 index_strategy= &reader_factory.ordered_index_reader;
1165 }
1166 else
1167 index_strategy= &reader_factory.simple_index_reader;
1168
1169 strategy= index_strategy;
1170 /*
1171 We don't need a rowid-to-rndpos step if
1172 - We're doing a scan on clustered primary key
1173 - [In the future] We're doing an index_only read
1174 */
1175 DBUG_ASSERT(primary_file->inited == handler::INDEX ||
1176 (primary_file->inited == handler::RND &&
1177 secondary_file &&
1178 secondary_file->inited == handler::INDEX));
1179
1180 h_idx= (primary_file->inited == handler::INDEX)? primary_file: secondary_file;
1181 keyno= h_idx->active_index;

Callers 5

multi_range_read_initMethod · 0.80
multi_range_read_initMethod · 0.80
multi_range_read_initMethod · 0.80
multi_range_read_initMethod · 0.80
multi_range_read_initMethod · 0.80

Calls 14

hint_key_stateFunction · 0.85
optimizer_flagFunction · 0.85
is_clustering_keyMethod · 0.80
get_key_infoMethod · 0.80
set_buffer_spaceMethod · 0.80
ha_index_initMethod · 0.80
get_tableMethod · 0.45
have_space_forMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected