58
60
'valgrind' => REPLMYSQLD_VALGRIND,
59
61
'valgrind_options', REPLMYSQLD_VALGRIND_OPTIONS},@_);
61
if (not defined $self->[REPLMYSQLD_MASTER_PORT]) {
62
$self->[REPLMYSQLD_MASTER_PORT] = GenTest::Server::MySQLd::MYSQLD_DEFAULT_PORT;
65
if (not defined $self->[REPLMYSQLD_SLAVE_PORT]) {
66
$self->[REPLMYSQLD_SLAVE_PORT] = $self->[REPLMYSQLD_MASTER_PORT] + 2;
69
if (not defined $self->[REPLMYSQLD_MODE]) {
70
$self->[REPLMYSQLD_MODE] = 'default';
73
if (not defined $self->[REPLMYSQLD_MASTER_VARDIR]) {
74
$self->[REPLMYSQLD_MASTER_VARDIR] = "mysql-test/var";
76
if (not defined $self->[REPLMYSQLD_SLAVE_VARDIR]) {
77
my $varbase = $self->[REPLMYSQLD_MASTER_VARDIR];
78
$varbase =~ s/(.*)\/$/\1/;
79
$self->[REPLMYSQLD_SLAVE_VARDIR] = $varbase.'_slave';
85
"--log-bin=mysql-bin",
86
"--report-host=127.0.0.1",
87
"--report_port=".$self->[REPLMYSQLD_MASTER_PORT]);
88
if (defined $self->[REPLMYSQLD_SERVER_OPTIONS]) {
63
if (defined $self->master || defined $self->slave) {
64
## Repl pair defined from two predefined servers
66
if (not (defined $self->master && defined $self->slave)) {
67
croak("Both master and slave must be defined");
69
$self->master->addServerOptions(["--server_id=1",
70
"--log-bin=mysql-bin",
71
"--report-host=127.0.0.1",
72
"--report_port=".$self->master->port]);
73
$self->slave->addServerOptions(["--server_id=2",
74
"--report-host=127.0.0.1",
75
"--report_port=".$self->slave->port]);
77
## Repl pair defined from parameters. The servers have the same basedir (is of the same version)
78
if (not defined $self->[REPLMYSQLD_MASTER_PORT]) {
79
$self->[REPLMYSQLD_MASTER_PORT] = GenTest::Server::MySQLd::MYSQLD_DEFAULT_PORT;
82
if (not defined $self->[REPLMYSQLD_SLAVE_PORT]) {
83
$self->[REPLMYSQLD_SLAVE_PORT] = $self->[REPLMYSQLD_MASTER_PORT] + 2;
86
if (not defined $self->[REPLMYSQLD_MODE]) {
87
$self->[REPLMYSQLD_MODE] = 'default';
90
if (not defined $self->[REPLMYSQLD_MASTER_VARDIR]) {
91
$self->[REPLMYSQLD_MASTER_VARDIR] = "mysql-test/var";
93
if (not defined $self->[REPLMYSQLD_SLAVE_VARDIR]) {
94
my $varbase = $self->[REPLMYSQLD_MASTER_VARDIR];
95
$varbase =~ s/(.*)\/$/\1/;
96
$self->[REPLMYSQLD_SLAVE_VARDIR] = $varbase.'_slave';
89
100
push(@master_options,
90
@{$self->[REPLMYSQLD_SERVER_OPTIONS]});
94
$self->[REPLMYSQLD_MASTER] =
95
GenTest::Server::MySQLd->new(basedir => $self->basedir,
96
vardir => $self->[REPLMYSQLD_MASTER_VARDIR],
97
port => $self->[REPLMYSQLD_MASTER_PORT],
98
server_options => \@master_options,
99
start_dirty => $self->[REPLMYSQLD_START_DIRTY],
100
valgrind => $self->[REPLMYSQLD_VALGRIND],
101
valgrind_options => $self->[REPLMYSQLD_VALGRIND_OPTIONS]);
103
if (not defined $self->master) {
104
croak("Could not create master");
110
"--report-host=127.0.0.1",
111
"--report_port=".$self->[REPLMYSQLD_SLAVE_PORT]);
112
if (defined $self->[REPLMYSQLD_SERVER_OPTIONS]) {
102
"--log-bin=mysql-bin",
103
"--report-host=127.0.0.1",
104
"--report_port=".$self->[REPLMYSQLD_MASTER_PORT]);
105
if (defined $self->[REPLMYSQLD_SERVER_OPTIONS]) {
106
push(@master_options,
107
@{$self->[REPLMYSQLD_SERVER_OPTIONS]});
111
$self->[REPLMYSQLD_MASTER] =
112
GenTest::Server::MySQLd->new(basedir => $self->[REPLMYSQLD_BASEDIR],
113
vardir => $self->[REPLMYSQLD_MASTER_VARDIR],
114
port => $self->[REPLMYSQLD_MASTER_PORT],
115
server_options => \@master_options,
116
start_dirty => $self->[REPLMYSQLD_START_DIRTY],
117
valgrind => $self->[REPLMYSQLD_VALGRIND],
118
valgrind_options => $self->[REPLMYSQLD_VALGRIND_OPTIONS]);
120
if (not defined $self->master) {
121
croak("Could not create master");
113
125
push(@slave_options,
114
@{$self->[REPLMYSQLD_SERVER_OPTIONS]});
118
$self->[REPLMYSQLD_SLAVE] =
119
GenTest::Server::MySQLd->new(basedir => $self->basedir,
120
vardir => $self->[REPLMYSQLD_SLAVE_VARDIR],
121
port => $self->[REPLMYSQLD_SLAVE_PORT],
122
server_options => \@slave_options,
123
start_dirty => $self->[REPLMYSQLD_START_DIRTY],
124
valgrind => $self->[REPLMYSQLD_VALGRIND],
125
valgrind_options => $self->[REPLMYSQLD_VALGRIND_OPTIONS]);
127
if (not defined $self->slave) {
128
$self->master->stopServer;
129
croak("Could not create slave");
127
"--report-host=127.0.0.1",
128
"--report_port=".$self->[REPLMYSQLD_SLAVE_PORT]);
129
if (defined $self->[REPLMYSQLD_SERVER_OPTIONS]) {
131
@{$self->[REPLMYSQLD_SERVER_OPTIONS]});
135
$self->[REPLMYSQLD_SLAVE] =
136
GenTest::Server::MySQLd->new(basedir => $self->[REPLMYSQLD_BASEDIR],
137
vardir => $self->[REPLMYSQLD_SLAVE_VARDIR],
138
port => $self->[REPLMYSQLD_SLAVE_PORT],
139
server_options => \@slave_options,
140
start_dirty => $self->[REPLMYSQLD_START_DIRTY],
141
valgrind => $self->[REPLMYSQLD_VALGRIND],
142
valgrind_options => $self->[REPLMYSQLD_VALGRIND_OPTIONS]);
144
if (not defined $self->slave) {
145
$self->master->stopServer;
146
croak("Could not create slave");
136
return $_[0]->[REPLMYSQLD_BASEDIR];
140
154
return $_[0]->[REPLMYSQLD_MASTER];