Commit 7223b4ed authored by unknown's avatar unknown

Lock control file also when we have created it in this run. Assertions.


storage/maria/ma_control_file.c:
  Even if the file is just created we have to lock it, otherwise some
  other Maria instance may write to it.
storage/maria/ma_pagecache.c:
  catch too big page numbers when they enter the pagecache; this helps
  debugging BUG#34250.
parent 99b3d018
......@@ -235,7 +235,14 @@ CONTROL_FILE_ERROR ma_control_file_create_or_open()
DBUG_RETURN(CONTROL_FILE_UNKNOWN_ERROR);
if (my_access(name,F_OK))
DBUG_RETURN(create_control_file(name, open_flags));
{
if (create_control_file(name, open_flags))
{
errmsg= "Can't create file";
goto err;
}
goto lock_file;
}
/* Otherwise, file exists */
......@@ -348,6 +355,7 @@ CONTROL_FILE_ERROR ma_control_file_create_or_open()
CF_LSN_OFFSET);
last_logno= uint4korr(buffer + new_cf_create_time_size + CF_FILENO_OFFSET);
lock_file:
retry= 0;
/*
......@@ -365,7 +373,7 @@ CONTROL_FILE_ERROR ma_control_file_create_or_open()
name, my_errno, MARIA_MAX_CONTROL_FILE_LOCK_RETRY);
if (retry++ > MARIA_MAX_CONTROL_FILE_LOCK_RETRY)
{
errmsg= "Could not get an exclusive lock; File is probably in use by another process";
errmsg= "Could not get an exclusive lock; file is probably in use by another process";
goto err;
}
sleep(1);
......
......@@ -1553,6 +1553,7 @@ static void unlink_hash(PAGECACHE *pagecache, PAGECACHE_HASH_LINK *hash_link)
struct st_my_thread_var *thread;
hash_link->file= first_page->file;
DBUG_ASSERT(first_page->pageno < ((ULL(1)) << 40));
hash_link->pageno= first_page->pageno;
do
{
......@@ -1714,6 +1715,7 @@ static PAGECACHE_HASH_LINK *get_hash_link(PAGECACHE *pagecache,
goto restart;
}
hash_link->file= *file;
DBUG_ASSERT(pageno < ((ULL(1)) << 40));
hash_link->pageno= pageno;
link_hash(start, hash_link);
/* Register the request for the page */
......@@ -2971,6 +2973,7 @@ uchar *pagecache_read(PAGECACHE *pagecache,
page_cache_page_pin_str[pin]));
DBUG_ASSERT(buff != 0 || (buff == 0 && (pin == PAGECACHE_PIN ||
pin == PAGECACHE_PIN_LEFT_PINNED)));
DBUG_ASSERT(pageno < ((ULL(1)) << 40));
#endif
if (!page_link)
......@@ -3302,6 +3305,7 @@ my_bool pagecache_delete(PAGECACHE *pagecache,
pin == PAGECACHE_PIN_LEFT_PINNED);
restart:
DBUG_ASSERT(pageno < ((ULL(1)) << 40));
if (pagecache->can_be_used)
{
/* Key cache is used */
......@@ -3476,6 +3480,7 @@ my_bool pagecache_write_part(PAGECACHE *pagecache,
DBUG_ASSERT(lock != PAGECACHE_LOCK_LEFT_READLOCKED);
DBUG_ASSERT(lock != PAGECACHE_LOCK_READ_UNLOCK);
DBUG_ASSERT(offset + size <= pagecache->block_size);
DBUG_ASSERT(pageno < ((ULL(1)) << 40));
#endif
if (!page_link)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment