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

Method resize

sql/sql_cache.cc:1296–1351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1294
1295
1296size_t Query_cache::resize(size_t query_cache_size_arg)
1297{
1298 size_t new_query_cache_size;
1299 DBUG_ENTER("Query_cache::resize");
1300 DBUG_PRINT("qcache", ("from %zu to %zu",query_cache_size,
1301 query_cache_size_arg));
1302 DBUG_ASSERT(initialized);
1303
1304 lock_and_suspend();
1305
1306 /*
1307 Wait for all readers and writers to exit. When the list of all queries
1308 is iterated over with a block level lock, we are done.
1309 */
1310 Query_cache_block *block= queries_blocks;
1311 if (block)
1312 {
1313 do
1314 {
1315 BLOCK_LOCK_WR(block);
1316 Query_cache_query *query= block->query();
1317 if (query->writer())
1318 {
1319 /*
1320 Drop the writer; this will cancel any attempts to store
1321 the processed statement associated with this writer.
1322 */
1323 query->writer()->first_query_block= NULL;
1324 query->writer(0);
1325 refused++;
1326 }
1327 query->unlock_n_destroy();
1328 block= block->next;
1329 } while (block != queries_blocks);
1330 queries_blocks= NULL; // avoid second destroying by free_cache
1331 }
1332 free_cache();
1333
1334 query_cache_size= query_cache_size_arg;
1335 new_query_cache_size= init_cache();
1336
1337 /*
1338 m_cache_status is internal query cache switch so switching it on/off
1339 will not be reflected on global_system_variables.query_cache_type
1340 */
1341 if (new_query_cache_size && global_system_variables.query_cache_type != 0)
1342 {
1343 DBUG_EXECUTE("check_querycache",check_integrity(1););
1344 m_cache_status= OK; // size > 0 => enable cache
1345 }
1346 else
1347 m_cache_status= DISABLED; // size 0 means the cache disabled
1348
1349 unlock();
1350 DBUG_RETURN(new_query_cache_size);
1351}
1352
1353

Callers 15

scan_backup_dirFunction · 0.45
initMethod · 0.45
PopulateServicesListMethod · 0.45
add_nodeMethod · 0.45
wsrep_store_error_daFunction · 0.45
hostname_cache_resizeFunction · 0.45
fix_key_hintsMethod · 0.45
fix_query_cache_sizeFunction · 0.45
handle_connections_winFunction · 0.45
resize_key_cacheFunction · 0.45

Calls 5

free_cacheFunction · 0.85
check_integrityFunction · 0.85
writerMethod · 0.80
unlock_n_destroyMethod · 0.80
queryMethod · 0.45

Tested by

no test coverage detected