Commit graph

210 commits

Author SHA1 Message Date
Sergei Golubchik
4853c7192d discovery using sql CREATE TABLE statement 2013-04-09 16:07:17 +02:00
Sergei Golubchik
6599fd3e9c 5.3 merge 2013-03-27 10:03:28 +01:00
Sergey Petrunya
fb2501e2d4 MDEV-4277: Crash inside mi_killed_in_mariadb() with myisammrg
- Set MI_INFO::external_ref for MyISAM tables that are parts of myisamMRG table.
2013-03-21 11:06:27 +04:00
Michael Widenius
6d4224a31c Merge with 5.2.
no_error handling for select (used by INSERT ... SELECT) still needs to be fixed, but I will do that in a separate commit
2011-12-11 11:34:44 +02:00
Sergei Golubchik
effed09bd7 5.3->5.5 merge 2011-11-27 17:46:20 +01:00
Michael Widenius
a8d03ab235 Initail merge with MySQL 5.1 (XtraDB still needs to be merged)
Fixed up copyright messages.
2011-11-21 19:13:14 +02:00
Igor Babaev
af3d1da31d Made the optimizer switch for index condition pushdown set to 'on' by default. 2011-11-21 05:16:16 -08:00
Sergei Golubchik
0e007344ea mysql-5.5.18 merge 2011-11-03 19:17:05 +01:00
Sergei Golubchik
76f0b94bb0 merge with 5.3
sql/sql_insert.cc:
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
  ******
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
sql/sql_table.cc:
  small cleanup
  ******
  small cleanup
2011-10-19 21:45:18 +02:00
Sergey Vojtovich
a8ee6e48f7 BUG#11763712 - 56458: KILLING A FLUSH TABLE FOR A MERGE/CHILD
CRASHES SERVER

Flushing of MERGE table or one of its child tables, which was
locked by flushing thread using LOCK TABLES, might have caused
crashes or assertion failures if the thread failed to reopen
child or parent table.
Particularly, this might have happened when another connection
killed this FLUSH TABLE statement/connection.
Also this problem might have occurred when we failed to reopen
MERGE table or one of its children when executing DDL statement
under LOCK TABLES.

The problem was caused by the fact that reopen_tables() might
have failed to reopen child table but still tried to reopen,
reattach children for and re-lock its parent. Vice versa it
might have failed to reopen parent but kept references from
children to parent around. Since reopen_tables() closes table
it has failed to reopen and therefore frees all associated
memory such dangling references led to crashes when followed.

This patch solves this problem by ensuring that we always close
parent table and all its children if we fail to reopen this
table or one of its children. Same happens if we fail to reattach
children to parent.

Affects 5.1 only.

mysql-test/r/merge.result:
  A test case for BUG#11763712.
mysql-test/t/merge.test:
  A test case for BUG#11763712.
sql/sql_base.cc:
  When flushing tables under LOCK TABLES, all locked
  and flushed tables are released and then reopened.
  It may happen that we failed to reopen some tables,
  in this case we reopen as much tables as possible.
  
  If it was not possible to reopen MERGE child, MERGE
  parent is unusable and must be removed from thread
  open tables list.
  
  If it was not possible to reopen MERGE parent, all
  MERGE child table objects are unusable as well, at
  least because their locks are handled by MERGE parent.
  They must also be removed from thread open tables
  list.
  
  In other words if it was impossible to reopen any
  object of a MERGE table or reattach child tables,
  all objects of this MERGE table must be considered
  unusable and closed.
2011-08-18 10:38:51 +04:00
Dmitry Lenev
0b5b1dd197 Fix for bug #11754210 - "45777: CHECK TABLE DOESN'T
SHOW ALL PROBLEMS FOR MERGE TABLE COMPLIANCE IN 5.1".

The problem was that CHECK/REPAIR TABLE for a MERGE table which
had several children missing or in wrong engine reported only
issue with the first such table in its result-set. While in 5.0
this statement returned the whole list of problematic tables.

Ability to report problems for all children was lost during
significant refactorings of MERGE code which were done as part
of work on 5.1 and 5.5 releases.

This patch restores status quo ante refactorings by changing
code in such a way that:
1) Failure to open child table due to its absence during CHECK/
   REPAIR TABLE for a MERGE table is not reported immediately
   when its absence is discovered in open_tables(). Instead
   handling/error reporting in such a situation is postponed
   until the moment when children are attached.
2) Code performing attaching of children no longer stops when
   it encounters first problem with one of the children during
   CHECK/REPAIR TABLE. Instead it continues iteration through
   the child list until all problems caused by child absence/
   wrong engine are reported.

Note that even after this change problem with mismatch of
child/parent definition won't be reported if there is also
another child missing, but this is how it was in 5.0 as well.

mysql-test/r/merge.result:
  Added test case for bug #11754210 - "45777: CHECK TABLE DOESN'T
  SHOW ALL PROBLEMS FOR MERGE TABLE COMPLIANCE IN 5.1".
  Adjusted results of existing tests to the fact that CHECK/REPAIR
  TABLE statements now try to report problems about missing table/
  wrong engine for all underlying tables, and to the fact that
  mismatch of parent/child definitions is always reported as an
  error and not a warning.
mysql-test/t/merge.test:
  Added test case for bug #11754210 - "45777: CHECK TABLE DOESN'T
  SHOW ALL PROBLEMS FOR MERGE TABLE COMPLIANCE IN 5.1".
sql/sql_base.cc:
  Changed code responsible for opening tables to ignore the fact
  that underlying tables of a MERGE table are missing, if this
  table is opened for CHECK/REPAIR TABLE.
  The absence of underlying tables in this case is now detected and
  appropriate error is reported at the point when child tables are
  attached. At this point we can produce full list of problematic
  child tables/errors to be returned as part of CHECK/REPAIR TABLE
  result-set.
storage/myisammrg/ha_myisammrg.cc:
  Changed myisammrg_attach_children_callback() to handle new
  situation, when during CHECK/REPAIR TABLE we do not report 
  error about missing child immediately when this fact is 
  discovered during open_tables() but postpone error-reporting
  till the time when children are attached. 
  Also this callback is now responsible for pushing an error
  mentioning problematic child table to the list of errors to 
  be reported by CHECK/REPAIR TABLE statements.
  Finally, since now myrg_attach_children() no longer relies on
  return value from callback to determine the end of the children
  list, callback no longer needs to set my_errno value and can
  be simplified.
  
  Changed myrg_print_wrong_table() to always report a problem
  with child table as an error and not as a warning. This makes
  reporting for different types of issues with child tables
  more consistent and compatible with 5.0 behavior.
storage/myisammrg/myrg_open.c:
  Changed code in myrg_attach_children() not to abort on the
  first problem with a child table when attaching children to
  parent MERGE table during CHECK/REPAIR TABLE statement 
  execution. This allows CHECK/REPAIR TABLE to report problems 
  about absence/wrong engine for all underlying tables as
  part of their result-set.
2011-07-22 16:31:10 +04:00
Sergey Petrunya
1492de8563 Set the default to be mrr=off,mrr_sort_keys=off:
- Set the default
- Adjust the testcases so that 'new' tests are run with optimizations turned on.
- Pull out relevant tests from "irrelevant" tests and run them with optimizations on.
- Run range.test and innodb.test with both mrr=on and mrr=off
2011-07-08 18:46:47 +04:00
Sergei Golubchik
9809f05199 5.5-merge 2011-07-02 22:08:51 +02:00
Sergey Petrunya
997445bc8e Make EXPLAIN better at displaying MRR/BKA:
- "Using MRR" is no longer shown with range access.
- Instead, both range and BKA accesses will show one of the following:
  = "Rowid-ordered scan"
  = "Key-ordered scan"
  = "Key-ordered Rowid-ordered scan"
depending on whether DS-MRR implementation will do scan keys in order, rowids in order,
or both.
- The patch also introduces a way for other storage engines/MRR implementations to
  pass information to EXPLAIN output about the properties of employed MRR scans.
2011-04-02 14:04:45 +04:00
Michael Widenius
139a2b64bf Merge with 5.2 2011-03-09 15:47:59 +02:00
Michael Widenius
58bb0769bd Merge with MySQL 5.1.55
- Fixed some issues with partitions and connection_string, which also fixed lp:716890 "Pre- and post-recovery crash in Aria"
- Fixed wrong assert in Aria

Now need to merge with latest xtradb before pushing 

sql/ha_partition.cc:
  Ensure that m_ordered_rec_buffer is not freed before close.
sql/mysqld.cc:
  Changed to use opt_stack_trace instead of opt_pstack.
  Removed references to pstack
sql/partition_element.h:
  Ensure that connect_string is initialized
storage/maria/ma_key_recover.c:
  Fixed wrong assert
2011-02-20 18:51:43 +02:00
Michael Widenius
b7b25dc666 Merge with 5.1-release.
- Fixed problem with oqgraph and 'make dist'

Note that after this merge we have a problem show in join_outer where we examine too many rows in one specific case (related to BUG#57024).
This will be fixed when mwl#128 is merged into 5.3.
2010-12-06 10:25:44 +02:00
Christopher Powers
8f3d884dd2 Bug#35333, "If Federated table can't connect to remote host, can't retrieve
metadata"

Improved error handling such that queries against Information_Schema.Tables won't
fail if a federated table can't make a remote connection.

mysql-test/r/lock_multi.result:
  Updated with warnings that were previously masked.
mysql-test/r/mdl_sync.result:
  Updated with warnings that were previously masked.
mysql-test/r/merge.result:
  Updated with warnings that were previously masked.
mysql-test/r/show_check.result:
  Updated with warnings that were previously masked.
mysql-test/r/view.result:
  Updated with warnings that were previously masked.
mysql-test/suite/federated/federated_bug_35333.result:
  New test results for bug#35333
mysql-test/suite/federated/federated_bug_35333.test:
  New test or bug#35333
sql/sql_show.cc:
  If get_schema_tables_record() encounters an error, push a warning,
  set the TABLE COMMENT column with the error text, and clear the
  error so that the operation can continue.
2010-11-30 11:20:56 -06:00
Christopher Powers
4edea18f8d Bug#35333, "If Federated table can't connect to remote host, can't retrieve
metadata"
            
Improved error handling such that queries against Information_Schema.Tables won't
fail if a federated table can't make a remote connection.

mysql-test/r/merge.result:
  Updated with warnings that were previously masked.
mysql-test/r/show_check.result:
  Updated with warnings that were previously masked.
mysql-test/r/view.result:
  Updated with warnings that were previously masked.
sql/sql_show.cc:
  If get_schema_tables_record() encounters an error, push a warning,
  set the TABLE COMMENT column with the error text, and clear the
  error so that the operation can continue.
2010-11-29 22:46:43 -06:00
Sergei Golubchik
65ca700def merge.
checkpoint.
does not compile.
2010-11-25 18:17:28 +01:00
Michael Widenius
b52020221e Merge with MySQL 5.1.52 2010-11-23 23:39:59 +02:00
Michael Widenius
c670b9021e Automerge with 5.2 2010-11-05 12:37:51 +02:00
Michael Widenius
20acfbf30d Fix for: LP #634955: Assert in _ma_update_at_original_place()
Added locking of lock mutex when updating status in external_unlock() for Aria and MyISAM tables.
Fixed that 'source' command doesn't cause mysql command line tool to exit on error.
DEBUG_EXECUTE() and DEBUG_EVALUATE_IF() should not execute things based on wildcards. (Allows one to run --debug with mysql-test-run scripts that uses @debug)
Fixed several core dump, deadlock and crashed table bugs in handling of LOCK TABLE with MERGE tables:
- Added priority of locks to avoid crashes with MERGE tables.
- Added thr_lock_merge() to allow one to merge two results of thr_lock().
Fixed 'not found row' bug in REPLACE with Aria tables.
Mark MyISAM tables that are part of MERGE with HA_OPEN_MERGE_TABLE and set the locks to have priority THR_LOCK_MERGE_PRIV.
- By sorting MERGE tables last in thr_multi_unlock() it's safer to release and relock them many times (can happen when TRIGGERS are created)
Avoid printing (null) in debug file (to easier find out wrong NULL pointer usage with %s).



client/mysql.cc:
  Fixed that 'source' command doesn't cause mysql command line tool to exit on error.
client/mysqltest.cc:
  Don't send NULL to fn_format(). (Can cause crash on Solaris when using --debug)
dbug/dbug.c:
  DEBUG_EXECUTE() and DEBUG_EVALUATE_IF() should not execute things based on wildcards.
include/my_base.h:
  Added flag to signal if one opens a MERGE table.
  Added extra() command to signal that one is not part of a MERGE table anymore.
include/thr_lock.h:
  Added priority for locks (needed to fix bug in thr_lock when using MERGE tables)
  Added option to thr_unlock() if get_status() should be called.
  Added prototype for thr_merge_locks().
mysql-test/mysql-test-run.pl:
  Ignore crashed table warnings for tables named 'crashed'.
mysql-test/r/merge.result:
  Renamed triggers to make debugging easier.
  Added some CHECK TABLES to catch errors earlier.
  Additional tests.
mysql-test/r/merge_debug.result:
  Test of error handling when reopening MERGE tables.
mysql-test/r/udf_query_cache.result:
  Added missing flush status
mysql-test/suite/parts/r/partition_repair_myisam.result:
  Update results
mysql-test/t/merge.test:
  Renamed triggers to make debugging easier.
  Added some CHECK TABLES to catch errors earlier.
  Additional tests.
mysql-test/t/merge_debug.test:
  Test of error handling when reopening MERGE tables.
mysql-test/t/udf_query_cache.test:
  Added missing flush status
mysys/my_getopt.c:
  Removed not used variable
mysys/my_symlink2.c:
  Changed (null) to (NULL) to make it easier to find NULL arguments to DBUG_PRINT() functions.
  (On linux, NULL to sprintf is printed 'null')
mysys/thr_lock.c:
  Added priority of locks to avoid crashes with MERGE tables.
  Added thr_lock_merge() to allow one to merge two results of thr_lock().
  - This is needed for MyISAM as all locked table must share the same status. If not, you will not see newly inserted rows in other instances of the table.
  If calling thr_unlock() with THR_UNLOCK_UPDATE_STATUS, call update_status() and restore_status() for the locks. This is needed in some rare cases where we call thr_unlock() followed by thr_lock() without calling external_unlock/external_lock in between.
  Simplify loop in thr_multi_lock().
  Added 'start_trans', which is called at end of thr_multi_lock() when all locks are taken.
  - This was needed by Aria to ensure that transaction is started when we got all locks, not at get_status(). Without this, some rows could not be visible when we lock two tables at the same time, causing REPLACE using two tables to fail unexpectedly.
sql/handler.cc:
  Add an assert() in handler::print_error() for "impossible errors" (like table is crashed) when --debug-assert-if-crashed-table is used.
sql/lock.cc:
  Simplify mysql_lock_tables() code if get_lock_data() returns 0 locks.
  Added new parameter to thr_multi_unlock()
  In mysql_unlock_read_tables(), call first externa_unlock(), then thr_multi_unlock();  This is same order as we do in mysql_unlock_tables().
  Don't abort locks in mysql_lock_abort() for merged tables when a MERGE table is deleted; Would cause a spin lock.
  Added call to thr_merge_locks() in mysql_lock_merge() to ensure consistency in thr_locks().
  - New locks of same type and table is stored after the old lock to ensure that we get the status from the original lock.
sql/mysql_priv.h:
  Added debug_assert_if_crashed_table
sql/mysqld.cc:
  Added --debug-assert-if-crashed-table
sql/parse_file.cc:
  Don't print '(null)' in DBUG_PRINT of no dir given
sql/set_var.cc:
  Increase default size of buffer for @debug variable.
sql/sql_base.cc:
  In case of error from reopen_table() in reopen_tables(), call unlock_open_table() and restart loop.
  - This fixed bug when we twice deleted same table from open_cache.
  Don't take name lock for already name locked table in open_unireg_entry().
  - Fixed bug when doing repair in reopen_table().
  - In detach_merge_children(), always detach if 'clear_refs' is given. We can't trust parent->children_attached as this function can be called twice, first time with clear_refs set to 0.
sql/sql_class.cc:
  Changed printing of (null) to "" in set_thd_proc_info()
sql/sql_parse.cc:
  Added DBUG
sql/sql_trigger.cc:
  Don't call unlink_open_table() if reopen_table() fails as the table may already be freed.
storage/maria/ma_bitmap.c:
  Fixed DBUG_ASSERT() in allocate_tail()
storage/maria/ma_blockrec.c:
  Fixed wrong calculation of row length for very small rows in undo_row_update().
  - Fixes ASSERT() when doing undo.
storage/maria/ma_blockrec.h:
  Added _ma_block_start_trans() and _ma_block_start_trans_no_versioning()
storage/maria/ma_locking.c:
  Call _ma_update_status_with_lock() when releasing write locks.
  - Fixes potential problem with updating status without the proper lock.
storage/maria/ma_open.c:
  Changed to use start_trans() instead of get_status() to ensure that we see all rows in all locked tables when we got the locks.
  - Fixed 'not found row' bug in REPLACE with Aria tables.
storage/maria/ma_state.c:
  Added _ma_update_status_with_lock() and _ma_block_start_trans().
  This is to ensure that we see all rows in all locked tables when we got the locks.
storage/maria/ma_state.h:
  Added _ma_update_status_with_lock()
storage/maria/ma_write.c:
  More DBUG_PRINT
storage/myisam/mi_check.c:
  Fixed error message
storage/myisam/mi_extra.c:
  Added HA_EXTRA_DETACH_CHILD:
  - Detach MyISAM table to not be part of MERGE table (remove flag & lock priority).
storage/myisam/mi_locking.c:
  Call mi_update_status_with_lock() when releasing write locks.
  - Fixes potential problem with updating status without the proper lock.
  Change to use new HA_OPEN_MERGE_TABLE flag to test if MERGE table.
  Added mi_fix_status(), called by thr_merge().
storage/myisam/mi_open.c:
  Added marker if part of MERGE table.
  Call mi_fix_status() in thr_lock() for transactional tables.
storage/myisam/myisamdef.h:
  Change my_once_flag to uint, as it stored different values than just 0/1
  Added 'open_flag' to store state given to mi_open()
storage/myisammrg/ha_myisammrg.cc:
  Add THR_LOCK_MERGE_PRIV to THR_LOCK_DATA to get MERGE locks sorted after other types of locks.
storage/myisammrg/myrg_locking.c:
  Remove windows specific code.
storage/myisammrg/myrg_open.c:
  Use HA_OPEN_MERGE_TABLE to mi_open().
  Set HA_OPEN_MERGE_TABLE for linked MyISAM tables.
storage/xtradb/buf/buf0buf.c:
  Fixed compiler warning
storage/xtradb/buf/buf0lru.c:
  Initialize variable that could be used not initialized.
2010-11-02 17:22:57 +02:00
Jon Olav Hauglid
e53e16a885 Bug #57002 Assert in upgrade_shared_lock_to_exclusive()
for ALTER TABLE + MERGE tables

The patch for Bug#56292 changed how metadata locks are taken for MERGE
tables. After the patch, locking the MERGE table will also lock the
children tables with the same metadata lock type. This means that 
LOCK TABLES on a MERGE table also will implicitly do LOCK TABLES on
the children tables.

A consequence of this change, is that it is possible to do LOCK TABLES
on a child table both explicitly and implicitly with the same statement
and that these two locks can be of different strength. For example,
LOCK TABLES child READ, merge WRITE.

In LOCK TABLES mode, we are not allowed to take new locks and each
statement must therefore try to find an existing TABLE instance with
a suitable lock. The code that searched for a suitable TABLE instance,
only considered table level locks. If a child table was locked twice,
it was therefore possible for this code to find a TABLE instance with
suitable table level locks but without suitable metadata lock.

This problem caused the assert in upgrade_shared_lock_to_exclusive()
to be triggered as it tried to upgrade a MDL_SHARED lock to
EXCLUSIVE. The problem was a regression caused by the patch for
Bug#56292.

This patch fixes the problem by partially reverting the changes
done by Bug#56292. Now, the children tables will only use the
same metadata lock as the MERGE table for MDL_SHARED_NO_WRITE
when not in locked tables mode. This means that LOCK TABLE
on a MERGE table will not implicitly lock the children tables.
This still fixes the original problem in Bug#56292 without
causing a regression.

Test case added to merge.test.
2010-10-06 09:56:29 +02:00
Jon Olav Hauglid
e14934d26d Bug #56494 Segfault in upgrade_shared_lock_to_exclusive() for
REPAIR of merge table
Bug #56422 CHECK TABLE run when the table is locked reports
           corruption along with timeout

The crash happened if a table maintenance statement (ANALYZE TABLE,
REPAIR TABLE, etc.) was executed on a MERGE table and opening and 
locking a child table failed. This could for example happen if a child
table did not exist or if a lock timeout happened while waiting for
a conflicting metadata lock to disappear.

Since opening and locking the MERGE table and its children failed,
the tables would be closed and the metadata locks released.
However, TABLE_LIST::table for the MERGE table would still be set,
with its value invalid since the tables had been closed.
This caused the table maintenance statement to try to continue
and upgrade the metadata lock on the MERGE table. But since the lock
already had been released, this caused a segfault.

This patch fixes the problem by setting TABLE_LIST::table to NULL 
if open_and_lock_tables() fails. This prevents maintenance
statements from continuing and trying to upgrade the metadata lock.

The patch includes a 5.5 version of the fix for
Bug #46339 crash on REPAIR TABLE merge table USE_FRM.
This bug caused REPAIR TABLE ... USE_FRM to give an assert 
when used on merge tables.

The patch also enables the CHECK TABLE statement for log tables.
Before, CHECK TABLE for log tables gave ER_CANT_LOCK_LOG_TABLE,
yet still counted the statement as successfully executed.
With the changes to table maintenance statement error handling
in this patch, CHECK TABLE would no longer be considered as
successful in this case. This would have caused upgrade scripts
to mistakenly think that the general and slow logs are corrupted
and have to be repaired. Enabling CHECK TABLES for log tables
prevents this from happening.

Finally, the patch changes the error message from "Corrupt" to
"Operation failed" for a number of issues not related to table
corruption. For example "Lock wait timeout exceeded" and 
"Deadlock found trying to get lock".

Test cases added to merge.test and check.test.
2010-09-22 10:15:41 +02:00
Dmitry Lenev
be2061c051 Fix for merge.test failures in mysql-5.5-runtime
tree for embedded server

Test case for bug #56251 "Deadlock with INSERT
DELAYED and MERGE tables" can't be run against
embedded server. Embedded server converts all
DELAYED INSERTs into ordinary INSERTs and this
test can't work properly if such conversion
happens.

Moved this test from merge.test to delayed.test
which is skipped if test suite is run with
--embedded-server option.
2010-09-16 18:06:46 +04:00
Dmitry Lenev
e86bbbda55 Fix for bug #56251 "Deadlock with INSERT DELAYED and MERGE
tables".

Attempting to issue an INSERT DELAYED statement for a MERGE
table might have caused a deadlock if it happened as part of
a transaction or under LOCK TABLES, and there was a concurrent
DDL or LOCK TABLES ... WRITE statement which tried to lock one
of its underlying tables.

The problem occurred when a delayed insert handler thread tried
to open a MERGE table and discovered that to do this it had also
to open all underlying tables and hence acquire metadata
locks on them. Since metadata locks on the underlying tables were
not pre-acquired by the connection thread executing INSERT DELAYED,
attempts to do so might lead to waiting. In this case the
connection thread had to wait for the delayed insert thread.
If the thread which was preventing the lock on the underlying table
from being acquired had to wait for the connection thread (due to
this or other metadata locks), a deadlock occurred. 
This deadlock was not detected by the MDL deadlock detector since 
waiting for the handler thread by the connection thread is not
represented in the wait-for graph.

This patch solves the problem by ensuring that the delayed
insert handler thread never tries to open underlying tables 
of a MERGE table. Instead open_tables() is aborted right after
the parent table is opened and a ER_DELAYED_NOT_SUPPORTED 
error is emitted (which is passed to the connection thread and
ultimately to the user).

mysql-test/r/merge.result:
  Added test for bug #56251 "Deadlock with INSERT DELAYED and
  MERGE tables".
mysql-test/t/merge.test:
  Added test for bug #56251 "Deadlock with INSERT DELAYED and
  MERGE tables".
sql/sql_base.cc:
  Changed open_n_lock_single_table() to take prelocking strategy
  as an argument instead of always using DML_prelocking_strategy.
sql/sql_base.h:
  Changed open_n_lock_single_table() to take prelocking strategy
  as an argument instead of always using DML_prelocking_strategy.
  Added a version of this function which is compatible with old
  signature.
sql/sql_insert.cc:
  When opening MERGE table in delayed insert thread stop and emit
  ER_DELAYED_NOT_SUPPORTED right after opening main table and
  before opening underlying tables. This ensures that we won't
  try to acquire metadata lock on underlying tables which might
  lead to a deadlock.
  This is achieved by using special prelocking strategy which
  abort open_tables() process as soon as we discover that we
  have opened table with engine which doesn't support delayed
  inserts.
2010-09-15 18:15:31 +04:00
Jon Olav Hauglid
51a81b6faf Bug #56292 Deadlock with ALTER TABLE and MERGE tables
ALTER TABLE on a MERGE table could cause a deadlock with two
other connections if we reached a situation where:

1) A connection doing ALTER TABLE can't upgrade to MDL_EXCLUSIVE on the
parent table, but holds TL_READ_NO_INSERT on the child tables.
2) A connection doing DELETE on a child table can't get TL_WRITE on it
since ALTER TABLE holds TL_READ_NO_INSERT.
3) A connection doing SELECT on the parent table can't get TL_READ on 
the child tables since TL_WRITE is ahead in the lock queue, but holds
MDL_SHARED_READ on the parent table preventing ALTER TABLE from upgrading.

For regular tables, this deadlock is avoided by having ALTER TABLE
take a MDL_SHARED_NO_WRITE metadata lock on the table. This prevents
DELETE from acquiring MDL_SHARED_WRITE on the table before ALTER TABLE
tries to upgrade to MDL_EXCLUSIVE. In the example above, SELECT would
therefore not be blocked by the pending DELETE as DELETE would not be
able to enter TL_WRITE in the table lock queue.

This patch fixes the problem for merge tables by using the same metadata
lock type for child tables as for the parent table. The child tables will
in this case therefore be locked with MDL_SHARED_NO_WRITE, preventing
DELETE from acquiring a metadata lock and enter into the table lock queue.

Change in behavior: By taking the same metadata lock for child tables
as for the parent table, LOCK TABLE on the parent table will now also
implicitly lock the child tables. Since LOCK TABLE on the parent table
now takes more than one metadata lock, it is possible for LOCK TABLE
... WRITE on the parent table or child tables to give ER_LOCK_DEADLOCK
error.

Test case added to mdl_sync.test.
Merge.test/.result has been updated to reflect the change to LOCK TABLE.
2010-09-08 10:25:37 +02:00
unknown
d0d8bbed5e WL#5370 Keep forward-compatibility when changing
'CREATE TABLE IF NOT EXISTS ... SELECT' behaviour
BUG#47132, BUG#47442, BUG49494, BUG#23992 and BUG#48814 will disappear
automatically after the this patch.
BUG#55617 is fixed by this patch too.
            
This is the 5.5 part.
It implements:
- 'CREATE TABLE IF NOT EXISTS ... SELECT' statement will not insert
  anything and binlog anything if the table already exists.
  It only generate a warning that table already exists.
- A couple of test cases for the behavior changing.
2010-08-18 17:35:41 +08:00
Konstantin Osipov
05617af025 A fix and a test case for Bug#36171 "CREATE TEMPORARY TABLE and
MERGE engine".
Backport the patch from 6.0 by Ingo Struewing:
revid:ingo.struewing@sun.com-20091028183659-6kmv1k3gdq6cpg4d
Bug#36171 - CREATE TEMPORARY TABLE and MERGE engine

In former MySQL versions, up to 5.1.23/6.0.4 it was possible to create
temporary MERGE tables with non-temporary MyISAM tables.
        
This has been changed in the mentioned version due to Bug 19627
(temporary merge table locking). MERGE children were locked through
the parent table. If the parent was temporary, it was not locked and
so the children were not locked either. Parallel use of the MyISAM
tables corrupted them.
       
Since 6.0.6 (WL 4144 - Lock MERGE engine children), the children are
locked independently from the parent. Now it is possible to allow
non-temporary children with a temporary parent. Even though the
temporary MERGE table itself is not locked, each non-temporary
MyISAM table is locked anyway.
        
NOTE: Behavior change: In 5.1.23/6.0.4 we prohibited non-temporary
children with a temporary MERGE table. Now we re-allow it.
An important side-effect is that temporary tables, which overlay
non-temporary MERGE children, overlay the children in the MERGE table.


mysql-test/r/merge.result:
  Update results (Bug#36171).
mysql-test/r/merge_mmap.result:
  Update results (Bug#36171).
mysql-test/t/merge.test:
  Add tests for Bug#36171
mysql-test/t/merge_mmap.test:
  Add tests for Bug#36171.
storage/myisammrg/ha_myisammrg.cc:
  Changed constraint for temporary state of tables.
2010-07-02 20:07:57 +04:00
Jon Olav Hauglid
83920a72fd merge from mysql-trunk-bugfixing 2010-06-30 08:47:49 +02:00
Konstantin Osipov
52f361ecb8 A fix for Bug#54811 "Assert in mysql_lock_have_duplicate()".
Remove mysql_lock_have_duplicate(), since now we always
have TABLE_LIST objects for MyISAMMRG children
in lex->query_tables and keep it till the end of the
statement (sub-statement).


mysql-test/r/merge.result:
  Update results (Bug#54811).
mysql-test/t/merge-big.test:
  Update to new wait state.
mysql-test/t/merge.test:
  Add a test case for Bug#54811.
sql/lock.cc:
  Remove a function that is now unused.
sql/lock.h:
  Remove a function that is now unused.
sql/sql_base.cc:
  Don't try to search for duplicate table among THR_LOCK objects, TABLE_LIST list contains all used tables.
2010-06-29 18:01:33 +04:00
Sergey Petrunya
27f9fc063c MariaDB 5.2 -> MariaDB 5.3 merge 2010-06-26 14:05:41 +04:00
Alexander Nozdrin
8f521b41ba Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
 
   The server crashed on an attempt to optimize a MERGE table with
   non-existent child table.
 
   mysql_admin_table() relied on the table to be successfully open
   if a table object had been allocated.
 
   Changed code to check return value of the open function before
   calling a handler:: function on it.

mysql-test/r/merge.result:
  Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
      Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
      Updated result file.
mysql-test/t/merge.test:
  Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
      Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
      Changed tests to respect changed TEMPORARY MERGE locking (unrelated).
      Changed tests to respect changed CREATE TABLE ... LIKE (unrelated).
      Changed tests to respect that no new tables can be created
      under LOCK TABLE (unrelated).
      Added test for Bug#47633.
  Changed error numbers to symbolic names.
  Added test for child locking for ALTER under LOCK TABLE.
  
  Since Bug 36171 is not pushed yet, not the whole patch has been backported.
mysys/my_delete.c:
  Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
      Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
      Fixed error reporting.
      Fixed indentation.
mysys/my_mmap.c:
  Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
      Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
      Added DBUG.
sql/item_func.cc:
  Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
  Added Debug Sync point, required by merge_sync.test.
sql/sql_table.cc:
  Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
      Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
      Do not call handler:: functions if the table was not opened
      successfully.
  Added Debug Sync point, required by merge_sync.test.
storage/myisam/mi_check.c:
  Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
      Bug#47633 - assert in ha_myisammrg::info during OPTIMIZE
      Unmap memory before exchanging data files. Needed on Windows.
storage/myisammrg/ha_myisammrg.cc:
  Backport of revid:ingo.struewing@sun.com-20091223200354-r2uzbdkj2v6yv111
  Added Debug Sync point, required by merge_sync.test.
  
  merge_sync.test will be introduced by a patch for Bug 36171,
  which is not pushed yet.
2010-06-25 19:32:59 +04:00
Jon Olav Hauglid
262bf59a2d This patch backports test coverage for:
Bug #22909 Using CREATE ... LIKE is possible to create
           field with invalid default value
Bug #35935 CREATE TABLE under LOCK TABLES ignores FLUSH
           TABLES WITH READ LOCK
Bug #37371 CREATE TABLE LIKE merge loses UNION parameter

These bugs were originally fixed in the 6.1-fk tree and the fixes
were backported as part of the fix for Bug #42546 "Backup: RESTORE
fails, thinking it finds an existing table". This patch backports
test coverage missing in the original backport. The patch contains
no code changes.
2010-06-11 10:14:38 +02:00
Alexander Nozdrin
fe5bcb475c Backport of
- revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461
  - revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866

  BUG#35274 - merge table doesn't need any base tables, gives
              error 124 when key accessed

  SELECT queries that use index against a merge table with empty
  underlying tables list may return with error "Got error 124 from
  storage engine".

  The problem was that wrong error being returned.

mysql-test/r/merge.result:
  Backport of
    - revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461
    - revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866
  
    A test case for BUG#35274.
  
    Modified a test case according to fix for BUG#35274. Key based
    reads are now allowed for merge tables with no underlying tables
    defined.
mysql-test/t/merge.test:
  Backport of
    - revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461
    - revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866
  
    A test case for BUG#35274.
  
    Modified a test case according to fix for BUG#35274. Key based
    reads are now allowed for merge tables with no underlying tables
    defined.
storage/myisammrg/myrg_queue.c:
  Backport of
    - revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461
    - revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866
  
    Return "end of file" error instead of "wrong index" error when
    we got a merge table with empty underlying tables list.
  
    In 5.1 we cannot rely on info->open_tables value when checking
    if a merge table has no underlying tables defined.
    Use info->tables instead.
2010-05-31 17:38:02 +04:00
unknown
b1e00b6be8 Merge MySQL 5.1.46 into MariaDB.
Still two test failures to be solved: main.myisam and main.subselect.
2010-04-28 14:52:24 +02:00
Ingo Struewing
e1418b14ec Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
REPAIR TABLE ... USE_FRM crashed debug servers.

A wrong assert assumed that this operation would not be executed
for MERGE tables.

Removed the assert.


mysql-test/r/merge.result:
  Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
  Added test result.
mysql-test/t/merge.test:
  Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
  Added test.
sql/sql_table.cc:
  Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
  Removed false assert.
2010-04-26 15:44:10 +02:00
Alexey Kopytov
d95c1e3b47 Manual merge of mysql-trunk into mysql-trunk-merge.
Conflicts:

Text conflict in client/mysqlbinlog.cc
Text conflict in mysql-test/Makefile.am
Text conflict in mysql-test/collections/default.daily
Text conflict in mysql-test/r/mysqlbinlog_row_innodb.result
Text conflict in mysql-test/suite/rpl/r/rpl_typeconv_innodb.result
Text conflict in mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test
Text conflict in mysql-test/suite/rpl/t/rpl_row_create_table.test
Text conflict in mysql-test/suite/rpl/t/rpl_slave_skip.test
Text conflict in mysql-test/suite/rpl/t/rpl_typeconv_innodb.test
Text conflict in mysys/charset.c
Text conflict in sql/field.cc
Text conflict in sql/field.h
Text conflict in sql/item.h
Text conflict in sql/item_func.cc
Text conflict in sql/log.cc
Text conflict in sql/log_event.cc
Text conflict in sql/log_event_old.cc
Text conflict in sql/mysqld.cc
Text conflict in sql/rpl_utility.cc
Text conflict in sql/rpl_utility.h
Text conflict in sql/set_var.cc
Text conflict in sql/share/Makefile.am
Text conflict in sql/sql_delete.cc
Text conflict in sql/sql_plugin.cc
Text conflict in sql/sql_select.cc
Text conflict in sql/sql_table.cc
Text conflict in storage/example/ha_example.h
Text conflict in storage/federated/ha_federated.cc
Text conflict in storage/myisammrg/ha_myisammrg.cc
Text conflict in storage/myisammrg/myrg_open.c
2010-03-24 18:03:44 +03:00
Alexey Kopytov
5d407d0c1a Manual merge of mysql-5.1-bugteam to mysql-trunk-merge.
Conflicts:

Text conflict in mysql-test/r/partition_innodb.result
Text conflict in sql/field.h
Text conflict in sql/item.h
Text conflict in sql/item_cmpfunc.h
Text conflict in sql/item_sum.h
Text conflict in sql/log_event_old.cc
Text conflict in sql/protocol.cc
Text conflict in sql/sql_select.cc
Text conflict in sql/sql_yacc.yy
2010-03-20 23:23:42 +03:00
Sergey Glukhov
caa1ccb0c3 Bug#51494 crash with join, explain and 'sounds like' operator
The crash happens because of discrepancy between values of
conts_tables and join->const_table_map(make_join_statisctics).
Calculation of conts_tables used condition with
HA_STATS_RECORDS_IS_EXACT flag check. Calculation of
join->const_table_map does not use this flag check.
In case of MERGE table without union with index
the table does not become const table and
thus join_read_const_table() is not called
for the table. join->const_table_map supposes
this table is const and later in make_join_select
this table is used for making&calculation const
condition. As table record buffer is not populated
it leads to crash.
The fix is adding a check if an engine supports
HA_STATS_RECORDS_IS_EXACT flag before updating
join->const_table_map.


mysql-test/r/merge.result:
  test result
mysql-test/t/merge.test:
  test case
sql/sql_select.cc:
  adding a check if an engine supports
  HA_STATS_RECORDS_IS_EXACT flag before updating
  join->const_table_map.
2010-03-19 10:01:02 +04:00
Alexey Kopytov
dbbdc4b196 Manual merge of mysql-5.1-bugteam to mysql-trunk-merge.
Conflicts:

Text conflict in client/mysqlbinlog.cc
Text conflict in mysql-test/r/explain.result
Text conflict in mysql-test/r/subselect.result
Text conflict in mysql-test/r/subselect3.result
Text conflict in mysql-test/r/type_datetime.result
Text conflict in sql/share/Makefile.am
2010-03-12 12:51:53 +03:00
Sergey Vojtovich
1d2aeb3da2 BUG#48265 - MRG_MYISAM problem (works in 5.0.85, does't
work in 5.1.40)

MERGE engine fails to open child table from a different
database if child table/database name contains characters
that are subject for table name to filename encoding
(WL1324).

Another problem is that MERGE engine didn't properly open
child table from the same database if child table name
contains characters like '/', '#'.

The problem was that table name to file name encoding was
applied inconsistently:
* On CREATE: encode table name + database name if child
  table is in different database; do not encode table
  name if child table is in the same database;
* No decoding on open.

With this fix child table/database names are always
encoded on CREATE and decoded on open. Compatibility
with older tables preserved.

Along with this patch comes fix for SHOW CREATE TABLE,
which used to show child table/database path instead
of child table/database names.

mysql-test/r/merge.result:
  A test case for BUG#48265.
mysql-test/std_data/bug48265.frm:
  MERGE table from 5.0 to test fix for BUG#48265 compatibility.
mysql-test/t/merge.test:
  A test case for BUG#48265.
storage/myisammrg/ha_myisammrg.cc:
  On CREATE always write child table/database name encoded
  by table name to filename encoding to dot-MRG file.
  
  On open decode child table/database name.
  Compatibilty with previous versions preserved.
  
  Fixed ::append_create_info() to return child
  table/database name instead of path.
storage/myisammrg/myrg_open.c:
  Move if (has_path) branch from myrg_parent_open() to
  myisammrg_parent_open_callback. The callback function
  needs to know if child table was written along with
  database name to dot-MRG file. Needed for compatibility
  reasons.
2010-03-03 14:49:03 +04:00
Jon Olav Hauglid
7fd30bf610 Bug #51240 ALTER TABLE of a locked MERGE table fails
The problem was that ALTER TABLE on a merge table which was locked 
using LOCK TABLE ... WRITE, by mistake gave 
ER_TABLE_NOT_LOCKED_FOR_WRITE.

During opening of the table to be ALTERed, open_table() tried to
get an upgradable metadata lock. In LOCK TABLEs mode, this lock
must already exist (i.e. taken by LOCK TABLE) as new locks of this
type cannot be acquired for fear of deadlock. So in LOCK TABLEs
mode, open_table() tried to find an existing upgradable lock for
the table to be altered.

The problem was that open_table() also tried to find upgradable
metadata locks for children of merge tables even if no such
locks are needed to execute ALTER TABLE on merge tables.

This patch fixes the problem by making sure that open tables code
only searches for upgradable metadata locks for the merge table
and not for the merge children tables. 

The patch also fixes a related bug where an upgradable metadata
lock was aquired outside of LOCK TABLEs mode even if the table in
question was temporary. This bug meant that LOCK TABLES or DDL on
temporary tables by mistake could be blocked/aborted by locks held
on base tables with the same table name by other connections.

Test cases added to merge.test and lock_multi.test.
2010-02-26 13:40:25 +01:00
Alexander Nozdrin
d1ad316a59 Patch for WL#3736: Extended Table, Column and Index Comments.
The task is to 
  (a) add a comment on indexes and 
  (b) increase the maximum length of column, table and the new index comments.

The patch committed on behalf of Yoshinori Matsunobu (Yoshinori.Matsunobu@Sun.COM).
2010-02-20 13:07:32 +03:00
Konstantin Osipov
3a856d4425 A fix and a test case for Bug#47648 "main.merge fails sporadically".
If a prepared statement used both a MyISAMMRG table and a stored 
function or trigger, execution could fail with "No such table"
error or crash. 
The error would come from a failure of the MyISAMMRG engine
to meet the expectations of the prelocking algorithm, 
in particular maintain lex->query_tables_own_last pointer
in sync with lex->query_tables_last pointer/the contents
of lex->query_tables. When adding merge children, the merge
engine would extend the table list. Then, when adding 
prelocked tables, the prelocking algorithm would use a pointer
to the last merge child to assign to lex->query_tables_own_last.
Then, when merge children were removed at the end of
open_tables(), lex->query_tables_own_last
was not updated, and kept pointing
to a removed merge child.

The fix ensures that query_tables_own_last is always in
sync with lex->query_tables_last.

This is a regression introduced by WL#4144 and present only
in next-4284 tree and 6.0.

mysql-test/r/merge.result:
  Update results (Bug#47648).
mysql-test/t/merge.test:
  Add a test case for Bug#47648.
  Update the result file to reflect a fix of another bug
  in MyISAMMRG code: not maintaining lex->query_tables_own_last
  allowed a stored function or trigger to modify a merge table
  which was already updated by the main statement.
  It is not allowed for other storage engines, and should
  not be allowed for MyISAMMRG.
storage/myisammrg/ha_myisammrg.cc:
  When adding children to the list of tables to open,
  make sure that we properly set lex->query_tables_own_last.
  When removing the children, update lex->query_tables_own_last
  if necessary.
2010-02-15 19:35:53 +03:00
Sergey Petrunya
96e092dc73 Backport into MariaDB-5.2 the following:
WL#2474 "Multi Range Read: Change the default MRR implementation to implement new MRR interface"
WL#2475 "Batched range read functions for MyISAM/InnoDb"
        "Index condition pushdown for MyISAM/InnoDB"
Igor's fix from sp1r-igor@olga.mysql.com-20080330055902-07614:
  There could be observed the following problems:
  1. EXPLAIN did not mention pushdown conditions from on expressions in the 
  'extra' column.  As a result if a query had no where conditions pushed 
  down to a table, but had on conditions pushed to this table the 'extra' 
  column in the EXPLAIN for the table missed 'using where'.
  2. Conditions for ref access were not eliminated from on expressions 
  though such conditions were eliminated from the where condition.
2009-12-15 10:16:46 +03:00
Konstantin Osipov
5a4f8e214c Backport of:
------------------------------------------------------------
 2599.161.3 Ingo Struewing      2009-07-21
 Bug#20667 - Truncate table fails for a write locked table

 TRUNCATE TABLE was not allowed under LOCK TABLES.

 The patch removes this restriction. mysql_truncate()
 does now handle that case.


mysql-test/r/merge.result:
  Bug#20667 - Truncate table fails for a write locked table
  Updated test result.
mysql-test/r/truncate.result:
  Bug#20667 - Truncate table fails for a write locked table
  Updated test result.
mysql-test/r/truncate_coverage.result:
  Bug#20667 - Truncate table fails for a write locked table
  New test result.
mysql-test/t/merge.test:
  Bug#20667 - Truncate table fails for a write locked table
  Updated test case due to now working TRUNCATE under LOCK TABLES.
  Added some SELECTs to show that child tables are truncated.
mysql-test/t/truncate.test:
  Bug#20667 - Truncate table fails for a write locked table
  Added test cases for TRUNCATE under LOCK TABLE.
mysql-test/t/truncate_coverage.test:
  Bug#20667 - Truncate table fails for a write locked table
  New test file. Coverage tests for TRUNCATE.
sql/sql_delete.cc:
  Bug#20667 - Truncate table fails for a write locked table
  Added branches for thd->locked_tables_mode.
sql/sql_parse.cc:
  Bug#20667 - Truncate table fails for a write locked table
  Deleted rejection of TRUNCATE in case of LOCK TABLES.
2009-12-11 15:24:23 +03:00
Jon Olav Hauglid
5e1dfa4c06 Backport of revno: 2617.71.1
Bug#42546 Backup: RESTORE fails, thinking it finds an existing table

The problem occured when a MDL locking conflict happened for a non-existent 
table between a CREATE and a INSERT statement. The code for CREATE 
interpreted this lock conflict to mean that the table existed, 
which meant that the statement failed when it should not have.
The problem could occur for CREATE TABLE, CREATE TABLE LIKE and
ALTER TABLE RENAME.

This patch fixes the problem for CREATE TABLE and CREATE TABLE LIKE.
It is based on code backported from the mysql-6.1-fk tree written
by Dmitry Lenev. CREATE now uses normal open_and_lock_tables() code 
to acquire exclusive locks. This means that for the test case in the bug 
description, CREATE will wait until INSERT completes so that it can 
get the exclusive lock. This resolves the reported bug.

The patch also prohibits CREATE TABLE and CREATE TABLE LIKE under 
LOCK TABLES. Note that this is an incompatible change and must 
be reflected in the documentation. Affected test cases have been
updated.

mdl_sync.test contains tests for CREATE TABLE and CREATE TABLE LIKE.

Fixing the issue for ALTER TABLE RENAME is beyond the scope of this
patch. ALTER TABLE cannot be prohibited from working under LOCK TABLES
as this could seriously impact customers and a proper fix would require
a significant rewrite.
2009-12-10 11:53:20 +01:00
unknown
832ad46641 Backport of revno: 2617.68.36
---------------------------------------------

This is a patch for bug#47098 assert in MDL_context::destroy on
HANDLER <damaged merge table> OPEN.
      
The assert occurs in MDL_context::destroy when the connection is terminated,
because all mdl_tickets have not been released.
MERGE tables do not support being opened using the HANDLER ... OPEN command,
and trying to do so will result in an error. In the event of an error, all
tables that are opened, should be closed again. The fix for bug#45781 made
sure that this also works for MERGE tables, which causes multiple tables to
be opened.
This fix extends the fix for bug#45781, by ensuring that also all locks are
released, when MERGE tables are involved.

mysql-test/r/merge.result:
  The result of the test.
mysql-test/t/merge.test:
  Added a test based on the bug report, as well as a test of the more general
  scenario.
sql/sql_handler.cc:
  Added code to release all the locks.
2009-12-09 14:41:56 +01:00