Bug #36804 Falcon does not detect deleted tablespace files
Submitted: 19 May 2008 17:32 Modified: 13 Dec 2008 10:05
Reporter: Philip Stoev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S3 (Non-critical)
Version:6.0-falcon-team OS:Any
Assigned to: Sergey Vojtovich CPU Architecture:Any
Tags: F_TABLESPACE
Triage: Triaged: D2 (Serious)

[19 May 2008 17:32] Philip Stoev
Description:
The Falcon storage engine does not detect if its tablespace files have gone missing. It will recreate them (and maybe apply the serial log), at which point there will be an inconsistency between the server metadata and the Falcon metadata.

Server will still list the tables in SHOW TABLES, however SHOW TABLE STATUS will report no tables. No error message will be written to the error log.

In contrast, when faced with the same situation, Innodb will report:

080519  4:51:26 [ERROR] Cannot find or open table test/i from
the internal data dictionary of InnoDB though the .frm file for the
table exists. Maybe you have deleted and recreated InnoDB data
files but have forgotten to delete the corresponding .frm files
of InnoDB tables, or you have moved .frm files to another database?
or, the table contains indexes that this version of the engine
doesn't support.
See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html
how you can resolve the problem.

How to repeat:
1. Start server

$ ./mysqld --language=/build/6.0-falcon-team/sql/share/english/ --innodb --datadir=/build/datadir --skip-grant-tables --falcon_debug_mask=65535

2. Create tables
create database test;
create table test.f (f1 integer) engine=falcon;
create table test.i (f1 integer) engine=innodb;

3. Shutdown server

4. Delete Falcon and Innodb files:

rm -f datadir/falcon*
rm -f datadir/ib*

5. Restart server (same as step #1)

6. Run queries:

> SHOW TABLE STATUS; -- returns empty list, Innodb complains vocally in error log
> SELECT * FROM f; -- complains table does not exist, Falcon puts nothing in the log
> SELECT * FROM i; -- complains table does not exist, Innodb complains vocally in error log
> DROP TABLE f; -- succeeds, Falcon log message "Exception: can't find table "TEST.F" in log
> DROP TABLE i; -- complains table does not exist, long message from Innodb in log.

Suggested fix:
If it is not possible to prevent the server from starting altogether, than at least:

* complain in log when metadata is messed up;
* prevent tables that are not there from being dropped sucessfully;
[21 May 2008 16:24] Kevin Lewis
What we need here is an error from Falcon that indicates the tablespace is not found
[6 Nov 2008 13:48] 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/58010

2905 Sergey Vojtovich	2008-11-06
      BUG#36804 - Falcon does not detect deleted tablespace files
      
      Falcon silently recreates it's system data files if it wasn't
      able to open them. With this fix Falcon provides some
      additional information in error log.
      
      When starting mysql server with Falcon and we were unable
      to open Falcon system data files, write a warning to error
      log.
      
      Write an error message to error log when attempting to access
      a table that doesn't exist in Falcon.
[11 Nov 2008 13:02] 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/58455

2905 Sergey Vojtovich	2008-11-11
      BUG#36804 - Falcon does not detect deleted tablespace files
      
      Falcon silently recreates it's system data files if it wasn't
      able to open them. With this fix Falcon provides some
      additional information in error log.
      
      When starting mysql server with Falcon and we were unable
      to open Falcon system data files, write a warning to error
      log.
      
      Write an error message to error log when attempting to access
      a table that doesn't exist in Falcon.
[13 Nov 2008 14:31] 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/58649

2905 Sergey Vojtovich	2008-11-13
      BUG#36804 - Falcon does not detect deleted tablespace files
      
      Falcon silently recreates it's system data files if it wasn't
      able to open them. With this fix Falcon provides some
      additional information in error log.
      
      When starting mysql server with Falcon and we were unable
      to open Falcon system data files, write a warning to error
      log.
      
      Write an error message to error log when attempting to access
      a table that doesn't exist in Falcon.
[14 Nov 2008 12:06] Sergey Vojtovich
Was approved by Kevin.
[20 Nov 2008 12:56] Bugs System
Pushed into 6.0.9-alpha  (revid:svoj@mysql.com-20081113132713-ax39hfodu75yjgzr) (version source revid:svoj@mysql.com-20081114103602-9ka2uls5cck9k1oq) (pib:5)
[13 Dec 2008 10:05] MC Brown
A note has been added to the 6.0.9 changelog: 

The FALCON storage would silently recreate missing tablespace files if they did not exist. Errors are now written to the MySQL error log when the FALCON system tablespace files are found to be missing. Warnings are produce in the log file when attempting to access data tablespace files that do not exist.