List:Maria Storage Engine« Previous MessageNext Message »
From:Guilhem Bichot Date:November 21 2008 9:22am
Subject:Re: inserting into a being-created table?
View as plain text  

Guilhem Bichot a écrit, Le 10/16/2008 03:08 PM:
> Hi Serg,
> I'm writing to you as Monty is on the plane.
> Running some multi-threaded tests from QA, which create Maria 
> transactional tables and do changes to them (I was tracking down 
> BUG#39710), I got an assertion (in thread 1 at the bottom of the traces 
> below).
> But the interesting thing is that:
> - thread 3 is creating table b, and in theory hasn't thr_unlocked it 
> (see its trace below: it's in external_lock() so not yet in 
> thr_multi_unlock()), so it should own an exclusive lock on b at that moment
> - but thread 1 asserts while inserting into table b (see its trace 
> below: maria_write()) which means it is not blocked by thread 3
> (it's sure it's the same table, there is only one database).
> How can this be? Does this ring a bell about a known old bug in CREATE 
> SELECT (I remember there was one that we first create the table and then 
> lock it, it was not atomic, but I don't see how that would explain the 
> problem here).
> Note, this is 5.1-maria.
<cut long trace>

Today Sanja found that this is indeed the cause of
"Maria: assertion in page cache in check_and_set_lsn()"

In my reasoning above, this was wrong:
"in theory hasn't thr_unlocked it (it's in external_lock() so not yet in 
thr_multi_unlock())". Indeed, the truth is that one can be in 
external_lock(F_UNLCK) without even having owned any thr_lock at all. 
The scenario is that thr_lock() decided to abort locks (*), then called 

(*) piece of stack trace:

#10 0x08230cde in unlock_external (thd=0x92f7848, table=<value optimized 
out>, count=2) at
#11 0x08230ee2 in mysql_unlock_tables (thd=dwarf2_read_address: 
Corrupted DWARF expression.
) at
#12 0x082320bd in mysql_lock_tables (thd=0x92f7848, tables=0x9247570, 
count=2, flags=<value optimized out>, need_reopen=0xb682552b) at
#13 0x08283478 in lock_tables (thd=0x92f7848, tables=0x925d860, count=2, 
need_reopen=0xb682552b) at
#14 0x0828ffb1 in open_and_lock_tables_derived (thd=0x92f7848, 
tables=0x925d860, derived=<value optimized out>) at
inserting into a being-created table?Guilhem Bichot16 Oct
  • Re: inserting into a being-created table?Guilhem Bichot21 Nov