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

Function cache_empty

mysys/mf_keycache.c:4487–4522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4485}
4486
4487static int cache_empty(KEY_CACHE *keycache)
4488{
4489 int errcnt= 0;
4490 int idx;
4491 if (keycache->disk_blocks <= 0)
4492 return 1;
4493 for (idx= 0; idx < keycache->disk_blocks; idx++)
4494 {
4495 BLOCK_LINK *block= keycache->block_root + idx;
4496 if (block->status || block->requests || block->hash_link)
4497 {
4498 fprintf(stderr, "block index: %u\n", idx);
4499 fail_block(block);
4500 errcnt++;
4501 }
4502 }
4503 for (idx= 0; idx < keycache->hash_links; idx++)
4504 {
4505 HASH_LINK *hash_link= keycache->hash_link_root + idx;
4506 if (hash_link->requests || hash_link->block)
4507 {
4508 fprintf(stderr, "hash_link index: %u\n", idx);
4509 fail_hlink(hash_link);
4510 errcnt++;
4511 }
4512 }
4513 if (errcnt)
4514 {
4515 fprintf(stderr, "blocks: %d used: %lu\n",
4516 keycache->disk_blocks, keycache->blocks_used);
4517 fprintf(stderr, "hash_links: %d used: %d\n",
4518 keycache->hash_links, keycache->hash_links_used);
4519 fprintf(stderr, "\n");
4520 }
4521 return !errcnt;
4522}
4523#endif
4524

Callers 1

resize_key_cacheFunction · 0.85

Calls 2

fail_blockFunction · 0.85
fail_hlinkFunction · 0.85

Tested by

no test coverage detected