Bug #38843 Falcon does not start if datadir is located on home directory on Solaris
Submitted: 18 Aug 2008 11:01 Modified: 18 Oct 2008 16:50
Reporter: Olav Sandstaa
Status: Closed
Category:Server: Falcon Severity:S3 (Non-critical)
Version:6.0.6 OS:Sun Solaris
Assigned to: Vladislav Vaintroub Target Version:6.0.7
Triage: D2 (Serious)

[18 Aug 2008 11:01] Olav Sandstaa
Description:
When running mysql_install_db and having specified --datadir to be a directory on my home
partition, e.g. --datadir=/home/os136802/tmp/mysql/mysqldb, mysql_install_db fails with
the following output:

Installing MySQL system tables...
080818 10:38:20 [ERROR] Falcon : exception 'can't create directory "/home/os136802"
'during initialization
080818 10:38:20 [ERROR] Plugin 'Falcon' init function returned error.
080818 10:38:20 [ERROR] Plugin 'Falcon' registration as a STORAGE ENGINE failed.
OK
Filling help tables...
080818 10:38:22 [ERROR] Falcon : exception 'can't create directory "/home/os136802"
'during initialization
080818 10:38:22 [ERROR] Plugin 'Falcon' init function returned error.
080818 10:38:22 [ERROR] Plugin 'Falcon' registration as a STORAGE ENGINE failed.
OK

I see this problem on Solaris 10 (on both x86 and SPARC) but not on Linux even though my
home directory is the same on all these OSs (automounted NFS).

How to repeat:
1. I have only been able to repeat this on Solaris (both x86 and SPARC).

2. It is possible that you need the latest source from mysql-6.0-falcon tree.

3. Run mysql_install_db with --datadir set to something in a home directory. It is
possible (or likely) that the home directory must be a remote and automounted NFS
directory?
[18 Aug 2008 11:09] Olav Sandstaa
It seems that this problem is triggered when we in IO::createPath() line 2785 in
storage/falcon/IO.cpp do the MKDIR call on my home directory, i.e.:

  MKDIR("/home/os136802") 

The existing code expects and handles that this should return error number EEXIST. On
Solaris 10 instead ENOSYS  ("Unsupported file system operation") for this case, probably
due to my home directory is automounted.

Would a better approach than try to create all directories in the path be to first check
if the directory existed and only if it did not already exist, then try to create it?
[18 Aug 2008 11:18] Philip Stoev
Olav,

Maybe the server creates the datadir by the time the Falcon initialization is called? So
Falcon does not have to create anything?
[18 Aug 2008 22:17] 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/51893

2788 Vladislav Vaintroub	2008-08-18
      Bug#38843 Falcon does not start if datadir is located on home directory on Solaris
      
      Problem
      Falcon tries to create all directories recursively before creating a file
      While trying to create a directory structure, IO::createPath runs onto Solaris bug. 
      mkdir returns ENOSYS instead of EEXIST on an existing path, if if it happens to be
NFS 
      automounted root dir.
      
      Fix: 
      1) IO::createPath - Workaround the bug by handling ENOSYS like EEXIST. 
      We do not expect any other OS to return ENOSYS(not supported) for mkdir().
      
      
      2) As Falcon can always rely on datadir to exist, enclose all current 
      occurences of  IO::createPath() into #ifndef FALCONDB. It is possibly 
      needed for Netfrastructure, so the change is safe.
[28 Aug 2008 6:36] Bugs System
Pushed into 6.0.7-alpha  (revid:vvaintroub@mysql.com-20080818201715-rajvo3ragweycolr)
(version source revid:vvaintroub@mysql.com-20080827094944-sh582y3m7duhzrpj) (pib:3)
[13 Sep 2008 23:25] Bugs System
Pushed into 6.0.7-alpha  (revid:vvaintroub@mysql.com-20080818201715-rajvo3ragweycolr)
(version source revid:hakan@mysql.com-20080725175322-8wgujj5xuzrjz3ke) (pib:3)
[18 Oct 2008 16:50] Jon Stephens
Documented in the 6.0.7 changelog as follows:

        On Solaris platforms, when the server was built with Falcon support and
        the data directory set in user's home directory, mysql_install_db
        failed.