Commit 70ad7908 authored by unknown's avatar unknown

BUG#5390 - problems with merge tables

After-fix optimizations proposed and finally
implemented by Monty.


mysql-test/r/lock.result:
  BUG#5390 - problems with merge tables
  After-fix optimizations proposed and finally
  implemented by Monty.
  Additional test results.
mysql-test/t/lock.test:
  BUG#5390 - problems with merge tables
  After-fix optimizations proposed and finally
  implemented by Monty.
  Additional tests.
sql/lock.cc:
  BUG#5390 - problems with merge tables
  After-fix optimizations proposed and finally
  implemented by Monty.
  get_lock_data() gets a flag for storing the lock
  positions in the new TABLE elements.
  mysql_lock_remove() can now remove a lock faster
  and more precisely as it has needed info in TABLE now.
  mysql_unlock_read_tables() and mysql_lock_merge() must 
  now adjust the new elements of TABLE when modifying locks.
  mysql_lock_have_duplicate() can now work faster on
  the existing lock as the positions in the lock
  arrays are known for each table.
  get_lock_data() assigns the new TABLE elements 
  on request of the new flag.
sql/table.h:
  BUG#5390 - problems with merge tables
  After-fix optimizations proposed and finally
  implemented by Monty.
  Additional elements of TABLE.
parent 3fd653b7
...@@ -47,3 +47,14 @@ unlock tables; ...@@ -47,3 +47,14 @@ unlock tables;
lock tables t1 write, t1 as t1_alias read; lock tables t1 write, t1 as t1_alias read;
insert into t1 select index1,nr from t1 as t1_alias; insert into t1 select index1,nr from t1 as t1_alias;
drop table t1,t2; drop table t1,t2;
create table t1 (c1 int);
create table t2 (c1 int);
create table t3 (c1 int);
lock tables t1 write, t2 write, t3 write;
drop table t2, t3, t1;
create table t1 (c1 int);
create table t2 (c1 int);
create table t3 (c1 int);
lock tables t1 write, t2 write, t3 write, t1 as t4 read;
alter table t2 add column c2 int;
drop table t1, t2, t3;
...@@ -57,3 +57,23 @@ unlock tables; ...@@ -57,3 +57,23 @@ unlock tables;
lock tables t1 write, t1 as t1_alias read; lock tables t1 write, t1 as t1_alias read;
insert into t1 select index1,nr from t1 as t1_alias; insert into t1 select index1,nr from t1 as t1_alias;
drop table t1,t2; drop table t1,t2;
#
# BUG#5390 - problems with merge tables
# Supplement test for the after-fix optimization
# Check that a dropped table is correctly removed from a lock.
create table t1 (c1 int);
create table t2 (c1 int);
create table t3 (c1 int);
lock tables t1 write, t2 write, t3 write;
# This removes one table after the other from the lock.
drop table t2, t3, t1;
#
# Check that a lock merge works.
create table t1 (c1 int);
create table t2 (c1 int);
create table t3 (c1 int);
lock tables t1 write, t2 write, t3 write, t1 as t4 read;
alter table t2 add column c2 int;
drop table t1, t2, t3;
This diff is collapsed.
...@@ -86,6 +86,9 @@ struct st_table { ...@@ -86,6 +86,9 @@ struct st_table {
uint next_number_index; uint next_number_index;
uint blob_ptr_size; /* 4 or 8 */ uint blob_ptr_size; /* 4 or 8 */
uint next_number_key_offset; uint next_number_key_offset;
uint lock_position; /* Position in MYSQL_LOCK.table */
uint lock_data_start; /* Start pos. in MYSQL_LOCK.locks */
uint lock_count; /* Number of locks */
int current_lock; /* Type of lock on table */ int current_lock; /* Type of lock on table */
enum tmp_table_type tmp_table; enum tmp_table_type tmp_table;
my_bool copy_blobs; /* copy_blobs when storing */ my_bool copy_blobs; /* copy_blobs when storing */
......
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