@@ -11396,6 +11396,9 @@ sub get_cxn_from_dsn_table {
1139611396 my $sql = "SELECT dsn FROM $dsn_table ORDER BY id";
1139711397 PTDEBUG && _d($sql);
1139811398 my @cxn;
11399+ my $o = $self->{OptionParser};
11400+ my $my_dsn;
11401+ my $lcxn;
1139911402 use Data::Dumper;
1140011403 DSN:
1140111404 do {
@@ -11404,21 +11407,33 @@ sub get_cxn_from_dsn_table {
1140411407 if ( $dsn_strings ) {
1140511408 foreach my $dsn_string ( @$dsn_strings ) {
1140611409 PTDEBUG && _d('DSN from DSN table:', $dsn_string);
11407- if ($args{wait_no_die}) {
11408- my $lcxn;
11409- eval {
11410- $lcxn = $make_cxn->(dsn_string => $dsn_string);
11411- };
11412- if ( $EVAL_ERROR && ($dsn_tbl_cxn->lost_connection($EVAL_ERROR)
11413- || $EVAL_ERROR =~ m/Can't connect to MySQL server/)) {
11410+
11411+ my $raw_dsn = $dp->parse($dsn_string);
11412+ my $dsn_defaults = $dp->parse_options($o);
11413+ $my_dsn = $dp->parse($dsn_string, undef, $dsn_defaults);
11414+
11415+ if ( $o->got('replica-user') && !defined $raw_dsn->{u} ) {
11416+ PTDEBUG && _d('DSN - username set from --replica-user');
11417+ $my_dsn->{u} = $o->get('replica-user');
11418+ }
11419+ if ( $o->got('replica-password') && !defined $raw_dsn->{p} ) {
11420+ PTDEBUG && _d('DSN - password set from --replica-password');
11421+ $my_dsn->{p} = $o->get('replica-password');
11422+ }
11423+
11424+ eval {
11425+ $lcxn = $make_cxn->(dsn => $my_dsn, parent => $parent);
11426+ };
11427+ if ( $EVAL_ERROR ) {
11428+ if ( $args{wait_no_die} && ($dsn_tbl_cxn->lost_connection($EVAL_ERROR)
11429+ || $EVAL_ERROR =~ m/Can't connect to MySQL server/) ) {
1141411430 PTDEBUG && _d("Server is not accessible, waiting when it is online again");
1141511431 sleep(1);
1141611432 goto DSN;
1141711433 }
11418- push @cxn, $lcxn;
11419- } else {
11420- push @cxn, $make_cxn->(dsn_string => $dsn_string, parent => $parent);
11434+ die $EVAL_ERROR;
1142111435 }
11436+ push @cxn, $lcxn;
1142211437 }
1142311438 }
1142411439 $done = 1;
0 commit comments