~giuseppe-maxia/mysql-sandbox/mysql-sandbox-3

« back to all changes in this revision

Viewing changes to bin/make_replication_sandbox

  • Committer: g.maxia at gmail
  • Date: 2015-08-02 15:15:16 UTC
  • Revision ID: g.maxia@gmail.com-20150802151516-3blys2q56v788sc1
- Added default name for relay log files.
- Added 'show_binlog' script in each sandbox
- improved tests by getting all the version components from a single function call
- Added GTID initialization options for MySQL 5.6, 5.7, and MariaDB 10
- Added GTID enabling test for MySQL 5.6 and 5.7
- added and improved more tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
124
124
my $base_version ;
125
125
my $release_no;
126
126
my $create_gtid_script=0;
 
127
my $master_use_gtid=0;
127
128
my $dashed_version ;
128
129
my $replication_port = 0;
129
130
my $prefix='';
150
151
    if ($create_gtid_script && ($major == 10))
151
152
    {
152
153
        $create_gtid_script =0;
 
154
        $master_use_gtid=1;
153
155
    }
154
156
}
155
157
else {
273
275
    --remote_access=$msb->{options}{remote_access} \\
274
276
    --load_grants \\
275
277
    --prompt_prefix=master \\
 
278
    -c relay-log-index=mysql-relay \\
 
279
    -c relay-log=mysql-relay \\
276
280
    -c log-bin=mysql-bin \\
277
281
    -c server-id=1 $additional_master_options
278
282
    );
312
316
    -c server-id=$slave_id \\
313
317
    -c report-host=SBslave$slave \\
314
318
    -c report-port=$slave_port \\
 
319
    -c relay-log-index=mysql-relay \\
 
320
    -c relay-log=mysql-relay \\
315
321
    -c log-bin=mysql-bin $additional_slave_options $this_slave_options
316
322
    );
317
323
    my $install_slave ='';
460
466
           . qq( master_host="127.0.0.1", )
461
467
           . qq( master_port=$replication_port, )
462
468
           . qq( master_user="$MySQL::Sandbox::default_users{'repl_user'}", )
463
 
           . qq( master_password="$MySQL::Sandbox::default_users{'repl_password'}" )
464
 
           . qq(' | $replication_directory/node$slave/use -u root  ) );
 
469
           . qq( master_password="$MySQL::Sandbox::default_users{'repl_password'}" ));
 
470
    if ($master_use_gtid)
 
471
    {
 
472
        $msb->write_to('initialize_slaves', '>>',  
 
473
             qq(, master_use_gtid=current_pos) );
 
474
     }
 
475
    $msb->write_to('initialize_slaves', '>>',  
 
476
             qq(' | $replication_directory/node$slave/use -u root  ) );
465
477
 
466
478
    $msb->write_to('initialize_slaves', '>>', 
467
479
            qq( echo 'START SLAVE' )
569
581
if [ -n "$CHANGED" ]
570
582
then
571
583
    ./restart_all
 
584
    for NODE in _NODE_LIST_
 
585
    do
 
586
        if [ "$NODE" != "master" ]
 
587
        then
 
588
            $NODE/use -e 'stop slave'
 
589
            $NODE/use -e 'CHANGE MASTER TO MASTER_AUTO_POSITION=1'
 
590
            $NODE/use -e 'start slave'
 
591
        fi
 
592
    done
572
593
fi
573
594
END_TEMPLATE
574
595
 
587
608
    if ($create_gtid_script)
588
609
    {
589
610
        $gtid_script_template =~ s/_REPLICATION_DIR_/$replication_directory/;
590
 
        $gtid_script_template =~ s/_NODE_LIST_/$node_list_text/;
 
611
        $gtid_script_template =~ s/_NODE_LIST_/$node_list_text/g;
591
612
        $msb->write_to('enable_gtid', '>', $gtid_script_template);
592
613
        chmod 0755, 'enable_gtid';
593
614
    }