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

Function tdc_iterate

sql/table_cache.cc:1173–1218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1171
1172
1173int tdc_iterate(THD *thd, my_hash_walk_action action, void *argument,
1174 bool no_dups)
1175{
1176 eliminate_duplicates_arg no_dups_argument;
1177 LF_PINS *pins;
1178 myf alloc_flags= 0;
1179 uint hash_flags= HASH_UNIQUE;
1180 int res;
1181
1182 if (thd)
1183 {
1184 fix_thd_pins(thd);
1185 pins= thd->tdc_hash_pins;
1186 alloc_flags= MY_THREAD_SPECIFIC;
1187 hash_flags|= HASH_THREAD_SPECIFIC;
1188 }
1189 else
1190 pins= lf_hash_get_pins(&tdc_hash);
1191
1192 if (!pins)
1193 return ER_OUTOFMEMORY;
1194
1195 if (no_dups)
1196 {
1197 init_alloc_root(PSI_INSTRUMENT_ME, &no_dups_argument.root, 4096, 4096, MYF(alloc_flags));
1198 my_hash_init(PSI_INSTRUMENT_ME, &no_dups_argument.hash, &my_charset_bin,
1199 tdc_records(), 0, 0, eliminate_duplicates_get_key, 0,
1200 hash_flags);
1201 no_dups_argument.action= action;
1202 no_dups_argument.argument= argument;
1203 action= eliminate_duplicates;
1204 argument= &no_dups_argument;
1205 }
1206
1207 res= lf_hash_iterate(&tdc_hash, pins, action, argument);
1208
1209 if (!thd)
1210 lf_hash_put_pins(pins);
1211
1212 if (no_dups)
1213 {
1214 my_hash_free(&no_dups_argument.hash);
1215 free_root(&no_dups_argument.root, MYF(0));
1216 }
1217 return res;
1218}
1219
1220
1221int show_tc_active_instances(THD *thd, SHOW_VAR *var, void *buff,

Callers 4

tc_purgeFunction · 0.85
print_cached_tablesFunction · 0.85
list_open_tablesFunction · 0.85
flush_tablesFunction · 0.85

Calls 6

init_alloc_rootFunction · 0.85
tdc_recordsFunction · 0.85
lf_hash_iterateFunction · 0.85
my_hash_freeFunction · 0.85
free_rootFunction · 0.85
fix_thd_pinsFunction · 0.70

Tested by 1

print_cached_tablesFunction · 0.68