Bug #38389 Falcon Storage overflow
Submitted: 26 Jul 2008 13:37 Modified: 27 Jul 2008 20:24
Reporter: Marian Lander Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S3 (Non-critical)
Version:6.0.5-alpha OS:Linux
Assigned to: CPU Architecture:Any

[26 Jul 2008 13:37] Marian Lander
Description:
I was testing Falcon storage tablespace, I create a simple table and save it to a falcon tablespace :

mysql> create table babies( name char(20), lastname char(20)) engine = falcon tablespace = parent;

well, since my objetive was to test falcon read speed, I create a little procedure to fill up my table with lots of rows.

mysql> delimiter $$
mysql> create procedure baby()
begin
declare counter int default 1;
start transaction;
while counter < 10 do
insert into babies values('Jhon','Smith');
end while;
end;
$$

After finished it I execute it ;

mysql> call baby;

Obviusly since the while bucle is infinite I have to stop it, with Ctlr-C :

mysql> call baby;
^CQuery aborted by Ctrl+C
ERROR 1317 (70100): Query execution was interrupted
mysql>

So I flush status; to the mysql server and logout, and login again to select * to babies table, but when I want to select all info from babies I got an error....something about storage engine exhausted or similar.

So I logout, turn off mysql server, and try to turn it on again receiving this message in logs::

080721 17:27:38 mysqld_safe Starting mysqld daemon with databases from /usr/local/var
080721 17:27:39 [ERROR] Falcon : exception 'serial write error on "falcon_master.fl2": Invalid argument (22)'during initialization

So since I can't turn on mysql server I proceed to delete manually the datafile from my falcon tablespace, after I deleted it I try to turn on again mysql server, this time it did work, but when I login to mysql and try to create a new tablespace I got an error telling me that only Myisam was available :/  I try to create a new table with engine = falcon, was imposible another error message about that only Myisam was available....

Reviewing logs again this is what I saw ::

080721 17:27:39 [ERROR] Plugin 'Falcon' init function returned error.
080721 17:27:39 [ERROR] Plugin 'Falcon' registration as a STORAGE ENGINE failed.
080721 17:35:52 [ERROR] Falcon : exception 'serial write error on "falcon_master.fl2": Invalid argument (22)'during initialization
080721 17:35:52 [ERROR] Plugin 'Falcon' init function returned error.
080721 17:35:52 [ERROR] Plugin 'Falcon' registration as a STORAGE ENGINE failed.
080721 17:35:52  InnoDB: Started; log sequence number 0 46419
080721 17:35:52 [ERROR] Unknown/unsupported table type: falcon;
080721 17:35:52 [ERROR] Aborting

I know this below issue happens because I delete manually the datafile.... But the fact is Falcon crash before I delete manually the datafile, when I execute the stored procedure, I said is a Falcon matter, because after I compile again mysql with falcon plugin support, I did create another table this time with 'archive engine' did the same procedure as I state before, execute it, and the archive storage engine didn't crash, I did the same thing with Myisam engine, and nothing critical happen but with Falcon and Falcon tablespace it crashed. 

How to repeat:
Doing the same steps I did in my reclaim.
[27 Jul 2008 10:39] Sveta Smirnova
Thank you for the report.

Could you please change your procedure to:

create procedure baby()
begin
declare counter int default 1;
start transaction;
while 1 < 10 do
insert into babies values('Jhon','Smith');
select counter;
set counter = counter + 1;
end while;
end;
$$

So it will print number of row inserted and we can guess how many rows were in the table when you stop execution.
[27 Jul 2008 18:51] Marian Lander
I did the following:

mysql> create tablespace parent
    -> add datafile 'parent.fts'
    -> engine = falcon;
Query OK, 0 rows affected (0.12 sec)

mysql> create table babies(
    -> name char(20),
    -> lastname char(20)) engine = archive;
Query OK, 0 rows affected (0.10 sec)

mysql> delimiter $$
mysql> create procedure baby()
    -> begin
    -> declare counter int default 1;
    -> start transaction;
    -> while 1 < 10 do
    -> insert into babies values('Jhon','Smith');
    -> select counter;
    -> set counter = counter + 1;
    -> end while;
    -> end;
    -> $$
Query OK, 0 rows affected (0.00 sec)

mysql> delimiter ;
mysql> call baby;
mysql> select count(*) from babies;
+----------+
| count(*) |
+----------+
|   471216 |
+----------+
1 row in set (1.67 sec)
mysql> exit;
bye

Login again and select from babies;
mysql> select count(*) from babies;
+----------+
| count(*) |
+----------+
|   471216 |
+----------+

I drop the table babies, and create it again this time with 'Falcon' as storage engine and 'Parents' as their tablespace.

mysql> show create table babies;
+--------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table  | Create Table                         |
+--------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| babies | CREATE TABLE `babies` (
  `name` char(20) DEFAULT NULL,
  `lastname` char(20) DEFAULT NULL
) /*!50100 TABLESPACE `parent` */ ENGINE=Falcon DEFAULT CHARSET=latin1 |
+--------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

I execute the stored procedure 'baby' and Ctrl-C to cancel the procedure and this time I was able to select results;

mysql> call baby;
^CQuery aborted by Ctrl+C
ERROR 1317 (70100): Query execution was interrupted

mysql> select count(*) from babies;
+----------+
| count(*) |
+----------+
|   535986 |
+----------+
1 row in set (0.00 sec)

But... after log out and log in again the table babies was reset to zero :

mysql> select count(*) from babies;
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)

I run again the stored procedure and fill up some rows;

mysql> call baby;
^CQuery aborted by Ctrl+C
ERROR 1317 (70100): Query execution was interrupted
mysql> select count(*) from babies;                
+----------+                                       
| count(*) |
+----------+
|   240144 |
+----------+
1 row in set (0.26 sec)

mysql> exit
Bye

After log in again, table babies was empty:

Database changed
mysql> select count(*) from babies;
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)

This issue happens with Falcon and InnoDB (Both transactional) even if I set autocommit = 1, this doesn't happen with (Myisam, archive, federated).
[27 Jul 2008 20:24] Sveta Smirnova
Thank you for the feedback.

Different result of count(*) is not a bug: you call start transaction; in the stored procedure. So when you kill its execution transaction doesn't rollback, but rollbacks when you leave mysql command line client.