mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
fixed server crash on moving query block with pointers to same table in it (BUG#988)
removed server options BitKeeper/deleted/.del-query_cache-master.opt~c4daeaa5e40881: Delete: mysql-test/t/query_cache-master.opt mysql-test/r/query_cache.result: test for BUG#988 mysql-test/t/query_cache.test: test for BUG#988 removed server options sql/sql_cache.cc: fixed moving query block with pointers to same table in it
This commit is contained in:
@ -2666,11 +2666,33 @@ my_bool Query_cache::move_by_type(byte **border,
|
||||
relink(block, new_block, next, prev, pnext, pprev);
|
||||
if (queries_blocks == block)
|
||||
queries_blocks = new_block;
|
||||
Query_cache_block_table *beg_of_table_table= block->table(0),
|
||||
*end_of_table_table= block->table(n_tables);
|
||||
byte *beg_of_new_table_table= (byte*) new_block->table(0);
|
||||
|
||||
for (TABLE_COUNTER_TYPE j=0; j < n_tables; j++)
|
||||
{
|
||||
Query_cache_block_table *block_table = new_block->table(j);
|
||||
block_table->next->prev = block_table;
|
||||
block_table->prev->next = block_table;
|
||||
|
||||
// use aligment from begining of table if 'next' is in same block
|
||||
if ((beg_of_table_table <= block_table->next) &&
|
||||
(block_table->next < end_of_table_table))
|
||||
((Query_cache_block_table *)(beg_of_new_table_table +
|
||||
(((byte*)block_table->next) -
|
||||
((byte*)beg_of_table_table))))->prev=
|
||||
block_table;
|
||||
else
|
||||
block_table->next->prev= block_table;
|
||||
|
||||
// use aligment from begining of table if 'prev' is in same block
|
||||
if ((beg_of_table_table <= block_table->prev) &&
|
||||
(block_table->prev < end_of_table_table))
|
||||
((Query_cache_block_table *)(beg_of_new_table_table +
|
||||
(((byte*)block_table->prev) -
|
||||
((byte*)beg_of_table_table))))->next=
|
||||
block_table;
|
||||
else
|
||||
block_table->prev->next = block_table;
|
||||
}
|
||||
DBUG_PRINT("qcache", ("after circle tt"));
|
||||
*border += len;
|
||||
|
Reference in New Issue
Block a user