rename st_my_thread_var::opt_info -> st_my_thread_var::keycache_link

This commit is contained in:
Sergei Golubchik 2015-01-19 14:19:05 +01:00
parent e2a2768278
commit c75eec8e0d
4 changed files with 26 additions and 27 deletions

View File

@ -724,7 +724,7 @@ struct st_my_thread_var
int volatile abort; int volatile abort;
my_bool init; my_bool init;
struct st_my_thread_var *next,**prev; struct st_my_thread_var *next,**prev;
void *opt_info; void *keycache_link;
uint lock_type; /* used by conditional release the queue */ uint lock_type; /* used by conditional release the queue */
void *stack_ends_here; void *stack_ends_here;
safe_mutex_t *mutex_in_use; safe_mutex_t *mutex_in_use;

View File

@ -1370,7 +1370,7 @@ static void link_block(SIMPLE_KEY_CACHE_CB *keycache, BLOCK_LINK *block,
keycache->waiting_for_block.last_thread; keycache->waiting_for_block.last_thread;
struct st_my_thread_var *first_thread= last_thread->next; struct st_my_thread_var *first_thread= last_thread->next;
struct st_my_thread_var *next_thread= first_thread; struct st_my_thread_var *next_thread= first_thread;
HASH_LINK *hash_link= (HASH_LINK *) first_thread->opt_info; HASH_LINK *hash_link= (HASH_LINK *) first_thread->keycache_link;
struct st_my_thread_var *thread; struct st_my_thread_var *thread;
do do
{ {
@ -1380,7 +1380,7 @@ static void link_block(SIMPLE_KEY_CACHE_CB *keycache, BLOCK_LINK *block,
We notify about the event all threads that ask We notify about the event all threads that ask
for the same page as the first thread in the queue for the same page as the first thread in the queue
*/ */
if ((HASH_LINK *) thread->opt_info == hash_link) if ((HASH_LINK *) thread->keycache_link == hash_link)
{ {
KEYCACHE_DBUG_PRINT("link_block: signal", ("thread %ld", thread->id)); KEYCACHE_DBUG_PRINT("link_block: signal", ("thread %ld", thread->id));
keycache_pthread_cond_signal(&thread->suspend); keycache_pthread_cond_signal(&thread->suspend);
@ -1714,7 +1714,7 @@ static void unlink_hash(SIMPLE_KEY_CACHE_CB *keycache, HASH_LINK *hash_link)
keycache->waiting_for_hash_link.last_thread; keycache->waiting_for_hash_link.last_thread;
struct st_my_thread_var *first_thread= last_thread->next; struct st_my_thread_var *first_thread= last_thread->next;
struct st_my_thread_var *next_thread= first_thread; struct st_my_thread_var *next_thread= first_thread;
KEYCACHE_PAGE *first_page= (KEYCACHE_PAGE *) (first_thread->opt_info); KEYCACHE_PAGE *first_page= (KEYCACHE_PAGE *) (first_thread->keycache_link);
struct st_my_thread_var *thread; struct st_my_thread_var *thread;
hash_link->file= first_page->file; hash_link->file= first_page->file;
@ -1723,7 +1723,7 @@ static void unlink_hash(SIMPLE_KEY_CACHE_CB *keycache, HASH_LINK *hash_link)
{ {
KEYCACHE_PAGE *page; KEYCACHE_PAGE *page;
thread= next_thread; thread= next_thread;
page= (KEYCACHE_PAGE *) thread->opt_info; page= (KEYCACHE_PAGE *) thread->keycache_link;
next_thread= thread->next; next_thread= thread->next;
/* /*
We notify about the event all threads that ask We notify about the event all threads that ask
@ -1812,13 +1812,13 @@ restart:
KEYCACHE_DBUG_PRINT("get_hash_link", ("waiting")); KEYCACHE_DBUG_PRINT("get_hash_link", ("waiting"));
page.file= file; page.file= file;
page.filepos= filepos; page.filepos= filepos;
thread->opt_info= (void *) &page; thread->keycache_link= (void *) &page;
link_into_queue(&keycache->waiting_for_hash_link, thread); link_into_queue(&keycache->waiting_for_hash_link, thread);
KEYCACHE_DBUG_PRINT("get_hash_link: wait", KEYCACHE_DBUG_PRINT("get_hash_link: wait",
("suspend thread %ld", thread->id)); ("suspend thread %ld", thread->id));
keycache_pthread_cond_wait(&thread->suspend, keycache_pthread_cond_wait(&thread->suspend,
&keycache->cache_lock); &keycache->cache_lock);
thread->opt_info= NULL; thread->keycache_link= NULL;
goto restart; goto restart;
} }
hash_link->file= file; hash_link->file= file;
@ -1976,7 +1976,7 @@ restart:
for another file/pos. for another file/pos.
*/ */
thread= my_thread_var; thread= my_thread_var;
thread->opt_info= (void *) hash_link; thread->keycache_link= (void *) hash_link;
link_into_queue(&keycache->waiting_for_block, thread); link_into_queue(&keycache->waiting_for_block, thread);
do do
{ {
@ -1985,7 +1985,7 @@ restart:
keycache_pthread_cond_wait(&thread->suspend, keycache_pthread_cond_wait(&thread->suspend,
&keycache->cache_lock); &keycache->cache_lock);
} while (thread->next); } while (thread->next);
thread->opt_info= NULL; thread->keycache_link= NULL;
/* /*
A block should now be assigned to the hash_link. But it may A block should now be assigned to the hash_link. But it may
still need to be evicted. Anyway, we should re-check the still need to be evicted. Anyway, we should re-check the
@ -2323,7 +2323,7 @@ restart:
*/ */
struct st_my_thread_var *thread= my_thread_var; struct st_my_thread_var *thread= my_thread_var;
thread->opt_info= (void *) hash_link; thread->keycache_link= (void *) hash_link;
link_into_queue(&keycache->waiting_for_block, thread); link_into_queue(&keycache->waiting_for_block, thread);
do do
{ {
@ -2333,7 +2333,7 @@ restart:
&keycache->cache_lock); &keycache->cache_lock);
} }
while (thread->next); while (thread->next);
thread->opt_info= NULL; thread->keycache_link= NULL;
/* Assert that block has a request registered. */ /* Assert that block has a request registered. */
DBUG_ASSERT(hash_link->block->requests); DBUG_ASSERT(hash_link->block->requests);
/* Assert that block is not in LRU ring. */ /* Assert that block is not in LRU ring. */
@ -4588,7 +4588,7 @@ static void keycache_dump(SIMPLE_KEY_CACHE_CB *keycache)
do do
{ {
thread=thread->next; thread=thread->next;
page= (KEYCACHE_PAGE *) thread->opt_info; page= (KEYCACHE_PAGE *) thread->keycache_link;
fprintf(keycache_dump_file, fprintf(keycache_dump_file,
"thread:%u, (file,filepos)=(%u,%lu)\n", "thread:%u, (file,filepos)=(%u,%lu)\n",
thread->id,(uint) page->file,(ulong) page->filepos); thread->id,(uint) page->file,(ulong) page->filepos);
@ -4604,7 +4604,7 @@ static void keycache_dump(SIMPLE_KEY_CACHE_CB *keycache)
do do
{ {
thread=thread->next; thread=thread->next;
hash_link= (HASH_LINK *) thread->opt_info; hash_link= (HASH_LINK *) thread->keycache_link;
fprintf(keycache_dump_file, fprintf(keycache_dump_file,
"thread:%u hash_link:%u (file,filepos)=(%u,%lu)\n", "thread:%u hash_link:%u (file,filepos)=(%u,%lu)\n",
thread->id, (uint) HASH_LINK_NUMBER(hash_link), thread->id, (uint) HASH_LINK_NUMBER(hash_link),

View File

@ -4275,7 +4275,7 @@ fill_schema_table_by_open(THD *thd, bool is_show_fields_or_keys,
Again we don't do this for SHOW COLUMNS/KEYS because Again we don't do this for SHOW COLUMNS/KEYS because
of backward compatibility. of backward compatibility.
*/ */
if (!is_show_fields_or_keys && result && thd->is_error() && if (!is_show_fields_or_keys && result &&
(thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE || (thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE ||
thd->get_stmt_da()->sql_errno() == ER_WRONG_OBJECT)) thd->get_stmt_da()->sql_errno() == ER_WRONG_OBJECT))
{ {
@ -5282,12 +5282,11 @@ err:
column with the error text, and clear the error so that the operation column with the error text, and clear the error so that the operation
can continue. can continue.
*/ */
const char *error= thd->is_error() ? thd->get_stmt_da()->message() : ""; const char *error= thd->get_stmt_da()->message();
table->field[20]->store(error, strlen(error), cs); table->field[20]->store(error, strlen(error), cs);
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->sql_errno(), error);
thd->get_stmt_da()->message());
thd->clear_error(); thd->clear_error();
} }

View File

@ -1314,7 +1314,7 @@ static void link_block(PAGECACHE *pagecache, PAGECACHE_BLOCK_LINK *block,
struct st_my_thread_var *first_thread= last_thread->next; struct st_my_thread_var *first_thread= last_thread->next;
struct st_my_thread_var *next_thread= first_thread; struct st_my_thread_var *next_thread= first_thread;
PAGECACHE_HASH_LINK *hash_link= PAGECACHE_HASH_LINK *hash_link=
(PAGECACHE_HASH_LINK *) first_thread->opt_info; (PAGECACHE_HASH_LINK *) first_thread->keycache_link;
struct st_my_thread_var *thread; struct st_my_thread_var *thread;
DBUG_ASSERT(block->requests + block->wlocks + block->rlocks + DBUG_ASSERT(block->requests + block->wlocks + block->rlocks +
@ -1329,7 +1329,7 @@ static void link_block(PAGECACHE *pagecache, PAGECACHE_BLOCK_LINK *block,
We notify about the event all threads that ask We notify about the event all threads that ask
for the same page as the first thread in the queue for the same page as the first thread in the queue
*/ */
if ((PAGECACHE_HASH_LINK *) thread->opt_info == hash_link) if ((PAGECACHE_HASH_LINK *) thread->keycache_link == hash_link)
{ {
DBUG_PRINT("signal", ("thread: %s %ld", thread->name, thread->id)); DBUG_PRINT("signal", ("thread: %s %ld", thread->name, thread->id));
pagecache_pthread_cond_signal(&thread->suspend); pagecache_pthread_cond_signal(&thread->suspend);
@ -1642,7 +1642,7 @@ static void unlink_hash(PAGECACHE *pagecache, PAGECACHE_HASH_LINK *hash_link)
pagecache->waiting_for_hash_link.last_thread; pagecache->waiting_for_hash_link.last_thread;
struct st_my_thread_var *first_thread= last_thread->next; struct st_my_thread_var *first_thread= last_thread->next;
struct st_my_thread_var *next_thread= first_thread; struct st_my_thread_var *next_thread= first_thread;
PAGECACHE_PAGE *first_page= (PAGECACHE_PAGE *) (first_thread->opt_info); PAGECACHE_PAGE *first_page= (PAGECACHE_PAGE *) (first_thread->keycache_link);
struct st_my_thread_var *thread; struct st_my_thread_var *thread;
hash_link->file= first_page->file; hash_link->file= first_page->file;
@ -1652,7 +1652,7 @@ static void unlink_hash(PAGECACHE *pagecache, PAGECACHE_HASH_LINK *hash_link)
{ {
PAGECACHE_PAGE *page; PAGECACHE_PAGE *page;
thread= next_thread; thread= next_thread;
page= (PAGECACHE_PAGE *) thread->opt_info; page= (PAGECACHE_PAGE *) thread->keycache_link;
next_thread= thread->next; next_thread= thread->next;
/* /*
We notify about the event all threads that ask We notify about the event all threads that ask
@ -1798,13 +1798,13 @@ restart:
PAGECACHE_PAGE page; PAGECACHE_PAGE page;
page.file= *file; page.file= *file;
page.pageno= pageno; page.pageno= pageno;
thread->opt_info= (void *) &page; thread->keycache_link= (void *) &page;
wqueue_link_into_queue(&pagecache->waiting_for_hash_link, thread); wqueue_link_into_queue(&pagecache->waiting_for_hash_link, thread);
DBUG_PRINT("wait", DBUG_PRINT("wait",
("suspend thread %s %ld", thread->name, thread->id)); ("suspend thread %s %ld", thread->name, thread->id));
pagecache_pthread_cond_wait(&thread->suspend, pagecache_pthread_cond_wait(&thread->suspend,
&pagecache->cache_lock); &pagecache->cache_lock);
thread->opt_info= NULL; thread->keycache_link= NULL;
DBUG_PRINT("thread", ("restarting...")); DBUG_PRINT("thread", ("restarting..."));
goto restart; goto restart;
} }
@ -2067,7 +2067,7 @@ restart:
*/ */
struct st_my_thread_var *thread= my_thread_var; struct st_my_thread_var *thread= my_thread_var;
thread->opt_info= (void *) hash_link; thread->keycache_link= (void *) hash_link;
wqueue_link_into_queue(&pagecache->waiting_for_block, thread); wqueue_link_into_queue(&pagecache->waiting_for_block, thread);
do do
{ {
@ -2077,7 +2077,7 @@ restart:
&pagecache->cache_lock); &pagecache->cache_lock);
} }
while (thread->next); while (thread->next);
thread->opt_info= NULL; thread->keycache_link= NULL;
block= hash_link->block; block= hash_link->block;
/* Ensure that the block is registered */ /* Ensure that the block is registered */
DBUG_ASSERT(block->requests >= 1); DBUG_ASSERT(block->requests >= 1);
@ -5057,7 +5057,7 @@ static void pagecache_dump(PAGECACHE *pagecache)
do do
{ {
thread= thread->next; thread= thread->next;
page= (PAGECACHE_PAGE *) thread->opt_info; page= (PAGECACHE_PAGE *) thread->keycache_link;
fprintf(pagecache_dump_file, fprintf(pagecache_dump_file,
"thread: %s %ld, (file,pageno)=(%u,%lu)\n", "thread: %s %ld, (file,pageno)=(%u,%lu)\n",
thread->name, thread->id, thread->name, thread->id,
@ -5074,7 +5074,7 @@ static void pagecache_dump(PAGECACHE *pagecache)
do do
{ {
thread=thread->next; thread=thread->next;
hash_link= (PAGECACHE_HASH_LINK *) thread->opt_info; hash_link= (PAGECACHE_HASH_LINK *) thread->keycache_link;
fprintf(pagecache_dump_file, fprintf(pagecache_dump_file,
"thread: %s %u hash_link:%u (file,pageno)=(%u,%lu)\n", "thread: %s %u hash_link:%u (file,pageno)=(%u,%lu)\n",
thread->name, thread->id, thread->name, thread->id,