Bug #38606 delete in lock write concurrent
Submitted: 6 Aug 2008 15:36 Modified: 9 Jan 2009 14:53
Reporter: Sergei Golubchik Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Maria storage engine Severity:S3 (Non-critical)
Version:5.1 maria, 6.0.6 OS:Any
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[6 Aug 2008 15:36] Sergei Golubchik
Description:
lock table t1 write concurrent;
delete from t1;

causes

mysqld: ha_maria.cc:1974: virtual int ha_maria::delete_row(const uchar*): Assertion `file->lock.type != TL_WRITE_CONCURRENT_INSERT' failed.

How to repeat:
.
[12 Aug 2008 12:15] Oleksandr Byelkin
=== modified file 'mysql-test/r/maria.result'
--- mysql-test/r/maria.result	2008-07-10 14:51:59 +0000
+++ mysql-test/r/maria.result	2008-08-12 10:51:42 +0000
@@ -1900,3 +1900,9 @@ check table t2 extended;
 Table	Op	Msg_type	Msg_text
 test.t2	check	status	OK
 drop table t2;
+create table t1 (a int) engine=maria transactional=1;
+insert into t1 values (1);
+lock table t1 write concurrent;
+delete from t1;
+ERROR 42000: The storage engine for the table doesn't support DELETE in WRITE CONCURRENT
+drop table t1;

=== modified file 'mysql-test/t/maria.test'
--- mysql-test/t/maria.test	2008-07-10 14:51:59 +0000
+++ mysql-test/t/maria.test	2008-08-12 10:51:27 +0000
@@ -1186,6 +1186,17 @@ insert into t2 values (repeat('x',28)), 
 check table t2 extended;
 drop table t2;
 
+#
+# BUG#38606  test suite
+#
+create table t1 (a int) engine=maria transactional=1;
+insert into t1 values (1);
+lock table t1 write concurrent;
+# should be fixed with fully implemented versioning
+--error ER_CHECK_NOT_IMPLEMENTED
+delete from t1;
+drop table t1;
+
 --disable_result_log
 --disable_query_log
 eval set global storage_engine=$default_engine, maria_page_checksum=$default_checksum;

=== modified file 'storage/maria/ha_maria.cc'
--- storage/maria/ha_maria.cc	2008-07-11 14:33:47 +0000
+++ storage/maria/ha_maria.cc	2008-08-12 10:46:55 +0000
@@ -1958,10 +1958,18 @@ bool ha_maria::is_crashed() const
           (my_disable_locking && file->s->state.open_count));
 }
 
+#define CHECK_UNTIL_WE_FULLY_IMPLEMENTED_VERSIONING(msg) \
+  do { \
+    if (file->lock.type == TL_WRITE_CONCURRENT_INSERT) \
+    { \
+      my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), msg); \
+      return 1; \
+    } \
+  } while(0)
 
 int ha_maria::update_row(const uchar * old_data, uchar * new_data)
 {
-  DBUG_ASSERT(file->lock.type != TL_WRITE_CONCURRENT_INSERT);
+  CHECK_UNTIL_WE_FULLY_IMPLEMENTED_VERSIONING("UPDATE in WRITE CONCURRENT");
   ha_statistic_increment(&SSV::ha_update_count);
   if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
     table->timestamp_field->set_time();
@@ -1971,7 +1979,7 @@ int ha_maria::update_row(const uchar * o
 
 int ha_maria::delete_row(const uchar * buf)
 {
-  DBUG_ASSERT(file->lock.type != TL_WRITE_CONCURRENT_INSERT);
+  CHECK_UNTIL_WE_FULLY_IMPLEMENTED_VERSIONING("DELETE in WRITE CONCURRENT");
   ha_statistic_increment(&SSV::ha_delete_count);
   return maria_delete(file, buf);
 }
[25 Aug 2008 8:29] Sergei Golubchik
pushed on behalf of sanja
[14 Sep 2008 0:37] Bugs System
Pushed into 6.0.7-alpha  (revid:serg@mysql.com-20080825083525-k3z80rwdrnx3j34r) (version source revid:vvaintroub@mysql.com-20080804094710-jb2qpqxpf2ir2gf3) (pib:3)
[9 Jan 2009 14:53] MC Brown
A note has been added to the 6.0.7 changelog: 

Performing a DELETE on a Maria table where the table has been locked using LOCK TABLE ... WRITE CONCURRENT would result in an assertion failure.