diff --git a/bin/pt-online-schema-change b/bin/pt-online-schema-change index e5ad2a68..0511bd01 100755 --- a/bin/pt-online-schema-change +++ b/bin/pt-online-schema-change @@ -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