Bug #28026 Falcon: crash if partitions and select for update
Submitted: 23 Apr 2007 14:43 Modified: 9 Jul 2007 12:29
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S3 (Non-critical)
Version:5.1,6.0.0-alpha-debug OS:Linux (SUSE 10 64-bit)
Assigned to: Sergey Vojtovich CPU Architecture:Any
Tags: falcon

[23 Apr 2007 14:43] Peter Gulutzan
Description:
I create a Falcon table with two partitions.
I insert two rows.
On two connections, I do SELECT FOR UPDATEs.
The hanging is different than for non-partitioned tables.
I say INSERT on the connect that isn't hung.
Crash.

ChangeSet@1.2638, 2007-04-22

How to repeat:
There are two mysql client connections. Call them T1 and T2.

On T1, say:
create table t1 (s1 int)
engine=falcon
partition by list (s1)
(partition p8 values in (8), partition p9 values in (9));
set @@autocommit=0;
insert into t1 values (8);
insert into t1 values (9);
commit;
select * from t1 where s1 = 8 for update;

On T2, say:
set @@autocommit=0;
select * from t1 where s1 = 9 for update;

On T1, say:
select * from t1 where s1 = 9 for update; /* hangs */

On T2, say:
select * from t1 where s1 = 8 for update;
update t1 set s1 = 7 where s1 = 8;
[23 Apr 2007 15:19] Miguel Solorzano
Thank you for the bug report. Verfied as described on FC 6 32-bit.

[New Thread -1267901552 (LWP 30062)]
070423 12:14:53 [Note] /home/miguel/dbs/5.1f/libexec/mysqld: ready for connections.
Version: '6.0.0-alpha-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
070423 12:14:53 [Note] Event Scheduler: Loaded 0 events
[New Thread -1268102256 (LWP 30085)]
<cut>
mysqld: handler.h:1100: int handler::ha_rnd_init(bool): Assertion `inited==NONE || (inited==RND && scan)' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread -1268302960 (LWP 30144)]
0x00f9d402 in __kernel_vsyscall ()
(gdb) bt full
#0  0x00f9d402 in __kernel_vsyscall ()
No symbol table info available.
#1  0x0093bd40 in raise () from /lib/libc.so.6
No symbol table info available.
#2  0x0093d591 in abort () from /lib/libc.so.6
No symbol table info available.
#3  0x0093538b in __assert_fail () from /lib/libc.so.6
No symbol table info available.
#4  0x081e99fd in handler::ha_rnd_init (this=0xa63c6d8, scan=false) at handler.h:1100

<cut>
[25 Apr 2007 13:42] Hakan Küçükyılmaz
Added test case falcon_bug_28026.test. I could verify the backtrace:

(gdb) f 3
#3  0x000000000058b4c1 in handler::ha_rnd_init (this=0x1070868, scan=false)
    at handler.h:1100
1100        DBUG_ASSERT(inited==NONE || (inited==RND && scan));
(gdb) p inited
$2 = handler::RND
(gdb) p scan
$3 = false
(gdb) 

[New Thread 1158465888 (LWP 32200)]
mysqld: handler.h:1100: int handler::ha_rnd_init(bool): Assertion `inited==NONE || (inited==RND && scan)' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread 1158465888 (LWP 32200)]
0x00002b689de9d07b in raise () from /lib/libc.so.6
(gdb) bt
#0  0x00002b689de9d07b in raise () from /lib/libc.so.6
#1  0x00002b689de9e84e in abort () from /lib/libc.so.6
#2  0x00002b689de96af4 in __assert_fail () from /lib/libc.so.6
#3  0x000000000058b4c1 in handler::ha_rnd_init (this=0x1070868, scan=false)
    at handler.h:1100
#4  0x000000000078c55b in ha_partition::rnd_init (this=0x1070468, scan=false)
    at ha_partition.cc:2983
#5  0x000000000058b4fd in handler::ha_rnd_init (this=0x1070468, scan=false)
    at handler.h:1102
#6  0x00000000007795b5 in init_read_record (info=0x450ca7b0, thd=0x105f6c8, 
    table=0x106fb98, select=0x106a410, use_record_cache=0, print_error=true)
    at records.cc:185
[14 Jun 2007 21:40] Jim Starkey
There was a bug that caused Falcon to map partition references to different connections, hence different transaction, leading to a dead lock.  That is
now fixed.

However, although Falcon is correctly returning errors for both the select for update and the subsequent update, partition is ignoring the error for select and crashing for the update.

This bug is *not* closed and should be referred to the partition guys.
[20 Jun 2007 8:55] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/29162

ChangeSet@1.2582, 2007-06-20 12:58:43+05:00, svoj@mysql.com +1 -0
  BUG#28026 - Falcon: crash if partitions and select for update
  
  Assertion failure may happen with falcon + partition + select for
  update.
  
  Though assertion failure is fixed with this patch, falcon still
  deadlocks when running falcon_bug_28026.test.
[25 Jun 2007 10:42] Sergey Vojtovich
Queued to 5.1-engines, 5.1-falcon.
[25 Jun 2007 18:06] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/29547

ChangeSet@1.2520, 2007-06-25 14:42:35+05:00, svoj@mysql.com +1 -0
  BUG#28026 - Falcon: crash if partitions and select for update
  
  Assertion failure may happen with falcon + partition + select for
  update. This may affect other engines as well.
  
  Though assertion failure is fixed with this patch, falcon still
  deadlocks when running falcon_bug_28026.test.
[7 Jul 2007 16:34] Bugs System
Pushed into 5.1.21-beta
[7 Jul 2007 18:56] Paul Dubois
Noted in 5.1.21 changelog.

SELECT ... FOR UPDATE with partitioned tables could cause a server crash.
[9 Jul 2007 8:34] Hakan Küçükyılmaz
falcon_bug_28026.test passes with InnoDB but hangs with Falcon.
[9 Jul 2007 12:29] Sergey Vojtovich
Hakan,

assertion failure was fixed within the scope of this bug. With this fix falcon still deadlocks, so I reported another bug:
BUG#29332 - falcon deadlocks when running falcon_bug_28026.test.