Bug #78624 Fabric cannot create files in daemonized mode
Submitted: 29 Sep 2015 14:59 Modified: 14 Dec 2015 23:44
Reporter: Ingo Strüwing Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Fabric: Sharding Severity:S3 (Non-critical)
Version:1.6.2 OS:Any
Assigned to: CPU Architecture:Any

[29 Sep 2015 14:59] Ingo Strüwing
Description:
Since 1.6.2, Fabric runs in deamonized mode by default. In this mode, it changes its directory to / (the root directory). When trying to clone a server, or move or split a shard, the origin server is backed up, and the backup restored on the target server. In the current implementation, the backup is written into a file. This file is opened without a directory path. That is, it is created in the current directory. If Fabric does not run as root, and it changed to /, no files can be created and no clone, move or split is possible.

Workaround: Use the --foreground option with the mysqlfabric manage start command.

How to repeat:
Run Fabric 1.6.2 without a --foreground option. Try to clone a server, move or split a shard.
[10 Dec 2015 9:14] Alfranio Tavares Correia Junior
Posted by developer:
 
The current directory remains open and cannot be unmounted while a process
is running. In order to release the current directory, any code that turns
a process into a daemon changes it to "/" by default.

However, not all users have permission to write to "/" and this was making
operations that require write access to it such as the resharding operation
fail.

In this patch, we have introduced a working directory option so that users
can specify the directory that MySQL Fabric will use by default:

    . section = executor
    . option = working_directory
    
If the option is not found, the working directory will be the directory
from where the process was launched.
[14 Dec 2015 23:44] Philip Olson
Posted by developer:
 
The following documentation was added to the executor section of the 1.5 and 1.6 Fabric docs:

  working_directory

    The directory Fabric uses by default to store files. If the
    option is not found, the working directory will be the
    directory from where the process was launched.

    This option was added in Fabric 1.5.7 / 1.6.3

Also, the following changelog entry was added:

  A new working_directory option was added to the executor section. It 
  defines the Fabric working directory, and if not defined or found, the
  directory where the process was launched is defined as the working directory.
  
  Before, running Fabric in deamonized mode used "/" as the
  working directory, which could result in permission errors when
  attempting to create files, such as backup files.

Thank you for the bug report.