Merge pull request #145 from percona/remove-data-dir

Added --remove-data-dir feature
This commit is contained in:
Carlos Salguero
2016-11-03 10:35:57 -03:00
committed by GitHub

View File

@@ -10108,7 +10108,7 @@ sub create_new_table {
if ( $o->get('default-engine') ) {
$sql =~ s/\s+ENGINE=\S+//;
}
if ( $o->get('data-dir') ) {
if ( $o->get('data-dir') && !$o->get('remove-data-dir') ) {
if ( (-d $o->get('data-dir')) && (-w $o->get('data-dir')) ){
$sql =~ s/DATA DIRECTORY='.*?'//;
$sql .= sprintf(" DATA DIRECTORY='%s' ",$o->get('data-dir'));
@@ -10116,6 +10116,9 @@ sub create_new_table {
die $o->get('data-dir') . " is not a directory or it is not writable";
}
}
if ( $o->get('remove-data-dir') ) {
$sql =~ s/DATA DIRECTORY='.*?'//;
}
PTDEBUG && _d($sql);
eval {
$cxn->dbh()->do($sql);
@@ -11572,7 +11575,13 @@ created with the system's default engine.
type: string
Create the new table on a different partition using the DATA DIRECTORY feature.
Only available on 5.6+
Only available on 5.6+. This parameter is ignored if it is used at the same time
than remove-data-dir.
=item --remove-data-dir
If the original table was created using the DATA DIRECTORY feature, remove it and create
the new table in MySQL default directory without creating a new isl file.
=item --defaults-file