MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / end_key_cache

Function end_key_cache

mysys/mf_keycache.c:725–769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

723*/
724
725void end_key_cache(KEY_CACHE *keycache, my_bool cleanup)
726{
727 DBUG_ENTER("end_key_cache");
728 DBUG_PRINT("enter", ("key_cache: 0x%lx", (long) keycache));
729
730 if (!keycache->key_cache_inited)
731 DBUG_VOID_RETURN;
732
733 if (keycache->disk_blocks > 0)
734 {
735 if (keycache->block_mem)
736 {
737 my_large_free((uchar*) keycache->block_mem);
738 keycache->block_mem= NULL;
739 my_free(keycache->block_root);
740 keycache->block_root= NULL;
741 }
742 keycache->disk_blocks= -1;
743 /* Reset blocks_changed to be safe if flush_all_key_blocks is called */
744 keycache->blocks_changed= 0;
745 }
746
747 DBUG_PRINT("status", ("used: %lu changed: %lu w_requests: %lu "
748 "writes: %lu r_requests: %lu reads: %lu",
749 keycache->blocks_used, keycache->global_blocks_changed,
750 (ulong) keycache->global_cache_w_requests,
751 (ulong) keycache->global_cache_write,
752 (ulong) keycache->global_cache_r_requests,
753 (ulong) keycache->global_cache_read));
754
755 /*
756 Reset these values to be able to detect a disabled key cache.
757 See Bug#44068 (RESTORE can disable the MyISAM Key Cache).
758 */
759 keycache->blocks_used= 0;
760 keycache->blocks_unused= 0;
761
762 if (cleanup)
763 {
764 mysql_mutex_destroy(&keycache->cache_lock);
765 keycache->key_cache_inited= keycache->can_be_used= 0;
766 KEYCACHE_DEBUG_CLOSE;
767 }
768 DBUG_VOID_RETURN;
769} /* end_key_cache */
770
771
772/*

Callers 1

resize_key_cacheFunction · 0.85

Calls 2

my_large_freeFunction · 0.85
my_freeFunction · 0.85

Tested by

no test coverage detected