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

Method check_integrity

sql/sql_cache.cc:4888–5146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4886*/
4887
4888my_bool Query_cache::check_integrity(bool locked)
4889{
4890 my_bool result = 0;
4891 uint i;
4892 DBUG_ENTER("check_integrity");
4893
4894 if (!locked)
4895 lock_and_suspend();
4896
4897 if (my_hash_check(&queries))
4898 {
4899 DBUG_PRINT("error", ("queries hash is damaged"));
4900 result = 1;
4901 }
4902
4903 if (my_hash_check(&tables))
4904 {
4905 DBUG_PRINT("error", ("tables hash is damaged"));
4906 result = 1;
4907 }
4908
4909 DBUG_PRINT("qcache", ("physical address check ..."));
4910 size_t free=0, used=0;
4911 Query_cache_block * block = first_block;
4912 do
4913 {
4914 /* When checking at system start, there is no block. */
4915 if (!block)
4916 break;
4917
4918 DBUG_PRINT("qcache", ("block %p, type %u...",
4919 block, (uint) block->type));
4920 // Check alignment
4921 if ((((size_t)block) % ALIGN_SIZE(1)) !=
4922 (((size_t)first_block) % ALIGN_SIZE(1)))
4923 {
4924 DBUG_PRINT("error",
4925 ("block %p do not aligned by %d", block,
4926 (int) ALIGN_SIZE(1)));
4927 result = 1;
4928 }
4929 // Check memory allocation
4930 if (block->pnext == first_block) // Is it last block?
4931 {
4932 if (((uchar*)block) + block->length !=
4933 ((uchar*)first_block) + query_cache_size)
4934 {
4935 DBUG_PRINT("error",
4936 ("block %p, type %u, ended at %p, but cache ended at %p",
4937 block, (uint) block->type,
4938 (((uchar*)block) + block->length),
4939 (((uchar*)first_block) + query_cache_size)));
4940 result = 1;
4941 }
4942 }
4943 else
4944 if (((uchar*)block) + block->length != ((uchar*)block->pnext))
4945 {

Callers 3

flushMethod · 0.80
pack_cacheMethod · 0.80

Calls 11

my_hash_checkFunction · 0.85
in_listFunction · 0.85
my_hash_searchFunction · 0.85
in_blocksFunction · 0.85
parentMethod · 0.80
dataMethod · 0.45
tableMethod · 0.45
resultMethod · 0.45
queryMethod · 0.45

Tested by

no test coverage detected