Bug #2627 RAID dirs created in hex, contradicts doc and prevents DROP DATABASE
Submitted: 3 Feb 2004 9:58 Modified: 4 Feb 2004 23:51
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S3 (Non-critical)
Version:4.0 OS:Any (all)
Assigned to: Michael Widenius CPU Architecture:Any

[3 Feb 2004 9:58] Guilhem Bichot
Description:
Manual says (in CREATE TABLE section):
"If you specify RAID_TYPE=STRIPED for a MyISAM table, MyISAM will create RAID_CHUNKS subdirectories named 00, 01, 02 in the database directory. "
and also (in DROP DATABASE section):
"All subdirectories that consists of 2 digits (RAID directories) are also removed."
But experience shows that numbering is done in hex:
drwx------    2 guilhem  qq           4096 Feb  3 18:45 00/
drwx------    2 guilhem  qq           4096 Feb  3 18:45 01/
drwx------    2 guilhem  qq           4096 Feb  3 18:45 02/
drwx------    2 guilhem  qq           4096 Feb  3 18:45 03/
drwx------    2 guilhem  qq           4096 Feb  3 18:45 04/
drwx------    2 guilhem  qq           4096 Feb  3 18:45 05/
drwx------    2 guilhem  qq           4096 Feb  3 18:45 06/
drwx------    2 guilhem  qq           4096 Feb  3 18:45 07/
drwx------    2 guilhem  qq           4096 Feb  3 18:45 08/
drwx------    2 guilhem  qq           4096 Feb  3 18:45 09/
drwx------    2 guilhem  qq           4096 Feb  3 18:45 0a/
drwx------    2 guilhem  qq           4096 Feb  3 18:45 0b/
drwx------    2 guilhem  qq           4096 Feb  3 18:45 0c/
drwx------    2 guilhem  qq           4096 Feb  3 18:45 0d/
drwx------    2 guilhem  qq           4096 Feb  3 18:45 0e/
And as a consequence, DROP DATABASE on this db silently fails (I mean that some RAID dirs remain:
[guilhem@gbichot2 mydbraid]$ ll
total 20
drwx------    2 guilhem  qq           4096 Feb  3 18:45 0a/
drwx------    2 guilhem  qq           4096 Feb  3 18:45 0b/
drwx------    2 guilhem  qq           4096 Feb  3 18:45 0c/
drwx------    2 guilhem  qq           4096 Feb  3 18:45 0d/
drwx------    2 guilhem  qq           4096 Feb  3 18:45 0e/
and so database's directory is not removed.
This is unexpected because looking at the SQL shown in "how-to-repeat" (CREATE DATABASE + CREATE TABLE + DROP DATABASE) one predicts that everything will be deleted.

How to repeat:
MASTER> create database mydbraid;
Query OK, 1 row affected (0.00 sec)

MASTER> use mydbraid;
Database changed
MASTER> create table mytableraid (a int) raid_type=1 raid_chunks=15 raid_chunksize=1;
Query OK, 0 rows affected (0.07 sec)

MASTER> drop database mydbraid;
Query OK, 1 row affected (0.00 sec)

Some files remain in directory mydbraid and this one is not removed.

Suggested fix:
Decide if numbering must be done in decimal or hexadecimal.
If it's in hex, change manual and fix DROP DATABASE.
If it's in decimal, fix mysys/raid.cc (RaidFd::Create() function), but first ensure that such change (from hex to decimal) will not break existing setups (those which are numbered in hex): will MyISAM still be able to handle existing hex numbering, even if it creates them in decimal??
Advantage of hex is that it allows 256 chunks.
[4 Feb 2004 23:51] Michael Widenius
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

I have now changed 'drop database' to work with RAID directories that are in hex.