Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion bin/pt-online-schema-change
Original file line number Diff line number Diff line change
Expand Up @@ -2293,7 +2293,7 @@ sub get_cxn_params {
$dsn = 'DBI:mysql:' . ( $info->{D} || '' ) . ';'
. join(';', map { "$opts{$_}->{dsn}=$info->{$_}" }
grep { defined $info->{$_} }
qw(F h P S A s))
qw(F h P S A s o))
. ';mysql_read_default_group=client'
. ($info->{L} ? ';mysql_local_infile=1' : '');
}
Expand Down Expand Up @@ -13439,6 +13439,12 @@ short form: -s; type: int

Create SSL MySQL connection.

=item --mysql_ssl_optional

short form: -o; type: int

Disables strict SSL enforcement and makes SSL connection optional.

=item --preserve-triggers

Preserves old triggers when specified.
Expand Down Expand Up @@ -14161,6 +14167,12 @@ dsn: mysql_ssl; copy: yes

Create SSL connection

=item * o

dsn: mysql_ssl_optional; copy: yes

Disables strict SSL enforcement and makes SSL connection optional

=back

=head1 ENVIRONMENT
Expand Down
2 changes: 1 addition & 1 deletion lib/DSNParser.pm
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ sub get_cxn_params {
$dsn = 'DBI:mysql:' . ( $info->{D} || '' ) . ';'
. join(';', map { "$opts{$_}->{dsn}=$info->{$_}" }
grep { defined $info->{$_} }
qw(F h P S A s))
qw(F h P S A s o))
. ';mysql_read_default_group=client'
. ($info->{L} ? ';mysql_local_infile=1' : '');
}
Expand Down
7 changes: 7 additions & 0 deletions t/pt-online-schema-change/option_sanity.t
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ like(
"Validates --critical-load"
);

$output = `$cmd --help`;
like(
$output,
qr/--mysql_ssl_optional/,
"--mysql_ssl_optional option exists in help"
);

# #############################################################################
# Done.
# #############################################################################
Expand Down
51 changes: 51 additions & 0 deletions t/pt-online-schema-change/ssl.t
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,57 @@ like(
'SSL connection error with incorrect SSL options in the configuration file'
) or diag($output);

# #############################################################################
# Test mysql_ssl_optional option
# #############################################################################

# Restoring environment for the new test
$sb->load_file('source', "$sample/del-trg-bug-1103672.sql");

($output, $exit_code) = full_output(
sub { pt_online_schema_change::main(@args,
"$source_dsn,D=test,t=t1,u=sha256_user,p=sha256_user%password,o=1",
"--alter", "drop primary key, add column _id int unsigned not null primary key auto_increment FIRST",
qw(--execute --no-check-alter)),
},
);

is(
$exit_code,
0,
"No error when using mysql_ssl_optional DSN parameter (o=1)"
) or diag($output);

like(
$output,
qr/Successfully altered `test`.`t1`/,
"DROP PRIMARY KEY with mysql_ssl_optional DSN parameter"
);

# Restoring environment for the new test
$sb->load_file('source', "$sample/del-trg-bug-1103672.sql");

($output, $exit_code) = full_output(
sub { pt_online_schema_change::main(@args,
"$source_dsn,D=test,t=t1",
qw(--user sha256_user --password sha256_user%password --mysql_ssl_optional 1),
"--alter", "drop primary key, add column _id int unsigned not null primary key auto_increment FIRST",
qw(--execute --no-check-alter)),
},
);

is(
$exit_code,
0,
"No error when using --mysql_ssl_optional option"
) or diag($output);

like(
$output,
qr/Successfully altered `test`.`t1`/,
"DROP PRIMARY KEY with --mysql_ssl_optional option"
);

# #############################################################################
# Done.
# #############################################################################
Expand Down