|
1 | 1 | /*****************************************************************************
|
2 | 2 |
|
3 | 3 | Copyright (c) 2007, 2016, Oracle and/or its affiliates.
|
4 |
| -Copyrigth (c) 2014, 2016, MariaDB Corporation |
| 4 | +Copyrigth (c) 2014, 2017, MariaDB Corporation |
5 | 5 |
|
6 | 6 | This program is free software; you can redistribute it and/or modify it under
|
7 | 7 | the terms of the GNU General Public License as published by the Free Software
|
@@ -4097,287 +4097,6 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_config =
|
4097 | 4097 | STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
|
4098 | 4098 | };
|
4099 | 4099 |
|
4100 |
| -/* Fields of the dynamic table INNODB_TEMP_TABLE_INFO. */ |
4101 |
| -static ST_FIELD_INFO i_s_innodb_temp_table_info_fields_info[] = |
4102 |
| -{ |
4103 |
| -#define IDX_TEMP_TABLE_ID 0 |
4104 |
| - {STRUCT_FLD(field_name, "TABLE_ID"), |
4105 |
| - STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), |
4106 |
| - STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), |
4107 |
| - STRUCT_FLD(value, 0), |
4108 |
| - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), |
4109 |
| - STRUCT_FLD(old_name, ""), |
4110 |
| - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, |
4111 |
| - |
4112 |
| -#define IDX_TEMP_TABLE_NAME 1 |
4113 |
| - {STRUCT_FLD(field_name, "NAME"), |
4114 |
| - STRUCT_FLD(field_length, MAX_TABLE_UTF8_LEN), |
4115 |
| - STRUCT_FLD(field_type, MYSQL_TYPE_STRING), |
4116 |
| - STRUCT_FLD(value, 0), |
4117 |
| - STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL), |
4118 |
| - STRUCT_FLD(old_name, ""), |
4119 |
| - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, |
4120 |
| - |
4121 |
| -#define IDX_TEMP_TABLE_N_COLS 2 |
4122 |
| - {STRUCT_FLD(field_name, "N_COLS"), |
4123 |
| - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), |
4124 |
| - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), |
4125 |
| - STRUCT_FLD(value, 0), |
4126 |
| - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), |
4127 |
| - STRUCT_FLD(old_name, ""), |
4128 |
| - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, |
4129 |
| - |
4130 |
| -#define IDX_TEMP_TABLE_SPACE_ID 3 |
4131 |
| - {STRUCT_FLD(field_name, "SPACE"), |
4132 |
| - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), |
4133 |
| - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), |
4134 |
| - STRUCT_FLD(value, 0), |
4135 |
| - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), |
4136 |
| - STRUCT_FLD(old_name, ""), |
4137 |
| - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, |
4138 |
| - |
4139 |
| -#define IDX_TEMP_TABLE_PTT 4 |
4140 |
| - {STRUCT_FLD(field_name, "PER_TABLE_TABLESPACE"), |
4141 |
| - STRUCT_FLD(field_length, 64), |
4142 |
| - STRUCT_FLD(field_type, MYSQL_TYPE_STRING), |
4143 |
| - STRUCT_FLD(value, 0), |
4144 |
| - STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL), |
4145 |
| - STRUCT_FLD(old_name, ""), |
4146 |
| - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, |
4147 |
| - |
4148 |
| -#define IDX_TEMP_TABLE_IS_COMPRESSED 5 |
4149 |
| - {STRUCT_FLD(field_name, "IS_COMPRESSED"), |
4150 |
| - STRUCT_FLD(field_length, 64), |
4151 |
| - STRUCT_FLD(field_type, MYSQL_TYPE_STRING), |
4152 |
| - STRUCT_FLD(value, 0), |
4153 |
| - STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL), |
4154 |
| - STRUCT_FLD(old_name, ""), |
4155 |
| - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, |
4156 |
| - END_OF_ST_FIELD_INFO |
4157 |
| -}; |
4158 |
| - |
4159 |
| -struct temp_table_info_t{ |
4160 |
| - table_id_t m_table_id; |
4161 |
| - char m_table_name[MAX_TABLE_UTF8_LEN]; |
4162 |
| - unsigned m_n_cols; |
4163 |
| - unsigned m_space_id; |
4164 |
| - char m_per_table_tablespace[64]; |
4165 |
| - char m_is_compressed[64]; |
4166 |
| -}; |
4167 |
| - |
4168 |
| -typedef std::vector<temp_table_info_t, ut_allocator<temp_table_info_t> > |
4169 |
| - temp_table_info_cache_t; |
4170 |
| - |
4171 |
| -/*******************************************************************//** |
4172 |
| -Fill Information Schema table INNODB_TEMP_TABLE_INFO for a particular |
4173 |
| -temp-table |
4174 |
| -@return 0 on success, 1 on failure */ |
4175 |
| -static |
4176 |
| -int |
4177 |
| -i_s_innodb_temp_table_info_fill( |
4178 |
| -/*=============================*/ |
4179 |
| - THD* thd, /*!< in: thread */ |
4180 |
| - TABLE_LIST* tables, /*!< in/out: tables |
4181 |
| - to fill */ |
4182 |
| - const temp_table_info_t* info) /*!< in: temp-table |
4183 |
| - information */ |
4184 |
| -{ |
4185 |
| - TABLE* table; |
4186 |
| - Field** fields; |
4187 |
| - |
4188 |
| - DBUG_ENTER("i_s_innodb_temp_table_info_fill"); |
4189 |
| - |
4190 |
| - table = tables->table; |
4191 |
| - |
4192 |
| - fields = table->field; |
4193 |
| - |
4194 |
| - OK(fields[IDX_TEMP_TABLE_ID]->store(info->m_table_id, true)); |
4195 |
| - |
4196 |
| - OK(field_store_string( |
4197 |
| - fields[IDX_TEMP_TABLE_NAME], info->m_table_name)); |
4198 |
| - |
4199 |
| - OK(fields[IDX_TEMP_TABLE_N_COLS]->store(info->m_n_cols)); |
4200 |
| - |
4201 |
| - OK(fields[IDX_TEMP_TABLE_SPACE_ID]->store(info->m_space_id)); |
4202 |
| - |
4203 |
| - OK(field_store_string( |
4204 |
| - fields[IDX_TEMP_TABLE_PTT], info->m_per_table_tablespace)); |
4205 |
| - |
4206 |
| - OK(field_store_string( |
4207 |
| - fields[IDX_TEMP_TABLE_IS_COMPRESSED], info->m_is_compressed)); |
4208 |
| - |
4209 |
| - DBUG_RETURN(schema_table_store_record(thd, table)); |
4210 |
| -} |
4211 |
| - |
4212 |
| -/*******************************************************************//** |
4213 |
| -Populate current table information to cache */ |
4214 |
| -static |
4215 |
| -void |
4216 |
| -innodb_temp_table_populate_cache( |
4217 |
| -/*=============================*/ |
4218 |
| - const dict_table_t* table, /*! in: table */ |
4219 |
| - temp_table_info_t* cache) /*! in/out: populate data in this |
4220 |
| - cache */ |
4221 |
| -{ |
4222 |
| - cache->m_table_id = table->id; |
4223 |
| - |
4224 |
| - char db_utf8[MAX_DB_UTF8_LEN]; |
4225 |
| - char table_utf8[MAX_TABLE_UTF8_LEN]; |
4226 |
| - |
4227 |
| - dict_fs2utf8(table->name.m_name, |
4228 |
| - db_utf8, sizeof(db_utf8), |
4229 |
| - table_utf8, sizeof(table_utf8)); |
4230 |
| - strcpy(cache->m_table_name, table_utf8); |
4231 |
| - |
4232 |
| - cache->m_n_cols = table->n_cols; |
4233 |
| - |
4234 |
| - cache->m_space_id = table->space; |
4235 |
| - |
4236 |
| - if (fsp_is_system_temporary(table->space)) { |
4237 |
| - strcpy(cache->m_per_table_tablespace, "FALSE"); |
4238 |
| - } else { |
4239 |
| - strcpy(cache->m_per_table_tablespace, "TRUE"); |
4240 |
| - } |
4241 |
| - |
4242 |
| - if (dict_table_page_size(table).is_compressed()) { |
4243 |
| - strcpy(cache->m_is_compressed, "TRUE"); |
4244 |
| - } else { |
4245 |
| - strcpy(cache->m_is_compressed, "FALSE"); |
4246 |
| - } |
4247 |
| -} |
4248 |
| - |
4249 |
| -/*******************************************************************//** |
4250 |
| -This function will iterate over all available table and will fill |
4251 |
| -stats for temp-tables to INNODB_TEMP_TABLE_INFO. |
4252 |
| -@return 0 on success, 1 on failure */ |
4253 |
| -static |
4254 |
| -int |
4255 |
| -i_s_innodb_temp_table_info_fill_table( |
4256 |
| -/*===================================*/ |
4257 |
| - THD* thd, /*!< in: thread */ |
4258 |
| - TABLE_LIST* tables, /*!< in/out: tables to fill */ |
4259 |
| - Item* ) /*!< in: condition (ignored) */ |
4260 |
| -{ |
4261 |
| - int status = 0; |
4262 |
| - dict_table_t* table = NULL; |
4263 |
| - |
4264 |
| - DBUG_ENTER("i_s_innodb_temp_table_info_fill_table"); |
4265 |
| - |
4266 |
| - /* Only allow the PROCESS privilege holder to access the stats */ |
4267 |
| - if (check_global_access(thd, PROCESS_ACL)) { |
4268 |
| - DBUG_RETURN(0); |
4269 |
| - } |
4270 |
| - |
4271 |
| - /* First populate all temp-table info by acquiring dict_sys->mutex. |
4272 |
| - Note: Scan is being done on NON-LRU list which mainly has system |
4273 |
| - table entries and temp-table entries. This means 2 things: list |
4274 |
| - is smaller so processing would be faster and most of the data |
4275 |
| - is relevant */ |
4276 |
| - temp_table_info_cache_t all_temp_info_cache; |
4277 |
| - all_temp_info_cache.reserve(UT_LIST_GET_LEN(dict_sys->table_non_LRU)); |
4278 |
| - |
4279 |
| - mutex_enter(&dict_sys->mutex); |
4280 |
| - for (table = UT_LIST_GET_FIRST(dict_sys->table_non_LRU); |
4281 |
| - table != NULL; |
4282 |
| - table = UT_LIST_GET_NEXT(table_LRU, table)) { |
4283 |
| - |
4284 |
| - if (!dict_table_is_temporary(table)) { |
4285 |
| - continue; |
4286 |
| - } |
4287 |
| - |
4288 |
| - temp_table_info_t current_temp_table_info; |
4289 |
| - |
4290 |
| - innodb_temp_table_populate_cache( |
4291 |
| - table, ¤t_temp_table_info); |
4292 |
| - |
4293 |
| - all_temp_info_cache.push_back(current_temp_table_info); |
4294 |
| - } |
4295 |
| - mutex_exit(&dict_sys->mutex); |
4296 |
| - |
4297 |
| - /* Now populate the info to MySQL table */ |
4298 |
| - temp_table_info_cache_t::const_iterator end = all_temp_info_cache.end(); |
4299 |
| - for (temp_table_info_cache_t::const_iterator it |
4300 |
| - = all_temp_info_cache.begin(); |
4301 |
| - it != end; |
4302 |
| - it++) { |
4303 |
| - status = i_s_innodb_temp_table_info_fill(thd, tables, &(*it)); |
4304 |
| - if (status) { |
4305 |
| - break; |
4306 |
| - } |
4307 |
| - } |
4308 |
| - |
4309 |
| - DBUG_RETURN(status); |
4310 |
| -} |
4311 |
| - |
4312 |
| -/*******************************************************************//** |
4313 |
| -Bind the dynamic table INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO. |
4314 |
| -@return 0 on success, 1 on failure */ |
4315 |
| -static |
4316 |
| -int |
4317 |
| -i_s_innodb_temp_table_info_init( |
4318 |
| -/*=============================*/ |
4319 |
| - void* p) /*!< in/out: table schema object */ |
4320 |
| -{ |
4321 |
| - ST_SCHEMA_TABLE* schema; |
4322 |
| - |
4323 |
| - DBUG_ENTER("i_s_innodb_temp_table_info_init"); |
4324 |
| - |
4325 |
| - schema = reinterpret_cast<ST_SCHEMA_TABLE*>(p); |
4326 |
| - |
4327 |
| - schema->fields_info = i_s_innodb_temp_table_info_fields_info; |
4328 |
| - schema->fill_table = i_s_innodb_temp_table_info_fill_table; |
4329 |
| - |
4330 |
| - DBUG_RETURN(0); |
4331 |
| -} |
4332 |
| - |
4333 |
| -struct st_maria_plugin i_s_innodb_temp_table_info = |
4334 |
| -{ |
4335 |
| - /* the plugin type (a MYSQL_XXX_PLUGIN value) */ |
4336 |
| - /* int */ |
4337 |
| - STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), |
4338 |
| - |
4339 |
| - /* pointer to type-specific plugin descriptor */ |
4340 |
| - /* void* */ |
4341 |
| - STRUCT_FLD(info, &i_s_info), |
4342 |
| - |
4343 |
| - /* plugin name */ |
4344 |
| - /* const char* */ |
4345 |
| - STRUCT_FLD(name, "INNODB_TEMP_TABLE_INFO"), |
4346 |
| - |
4347 |
| - /* plugin author (for SHOW PLUGINS) */ |
4348 |
| - /* const char* */ |
4349 |
| - STRUCT_FLD(author, plugin_author), |
4350 |
| - |
4351 |
| - /* general descriptive text (for SHOW PLUGINS) */ |
4352 |
| - /* const char* */ |
4353 |
| - STRUCT_FLD(descr, "InnoDB Temp Table Stats"), |
4354 |
| - |
4355 |
| - /* the plugin license (PLUGIN_LICENSE_XXX) */ |
4356 |
| - /* int */ |
4357 |
| - STRUCT_FLD(license, PLUGIN_LICENSE_GPL), |
4358 |
| - |
4359 |
| - /* the function to invoke when plugin is loaded */ |
4360 |
| - /* int (*)(void*); */ |
4361 |
| - STRUCT_FLD(init, i_s_innodb_temp_table_info_init), |
4362 |
| - |
4363 |
| - /* the function to invoke when plugin is unloaded */ |
4364 |
| - /* int (*)(void*); */ |
4365 |
| - STRUCT_FLD(deinit, i_s_common_deinit), |
4366 |
| - |
4367 |
| - /* plugin version (for SHOW PLUGINS) */ |
4368 |
| - /* unsigned int */ |
4369 |
| - STRUCT_FLD(version, INNODB_VERSION_SHORT), |
4370 |
| - |
4371 |
| - /* struct st_mysql_show_var* */ |
4372 |
| - STRUCT_FLD(status_vars, NULL), |
4373 |
| - |
4374 |
| - /* struct st_mysql_sys_var** */ |
4375 |
| - STRUCT_FLD(system_vars, NULL), |
4376 |
| - |
4377 |
| - STRUCT_FLD(version_info, INNODB_VERSION_STR), |
4378 |
| - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA) |
4379 |
| -}; |
4380 |
| - |
4381 | 4100 | /* Fields of the dynamic table INNODB_BUFFER_POOL_STATS. */
|
4382 | 4101 | static ST_FIELD_INFO i_s_innodb_buffer_stats_fields_info[] =
|
4383 | 4102 | {
|
|
0 commit comments