~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to lib/GenTest/Server/ReplMySQLd.pm

  • Committer: Bernt M. Johnsen
  • Date: 2010-03-03 13:41:57 UTC
  • mto: (0.101.22 lp-randgen-xml)
  • mto: This revision was merged to the branch mainline in revision 2435.
  • Revision ID: bernt.johnsen@sun.com-20100303134157-an7zz9p726g3bnfo
More replication fixes + someother stuff

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2010 Sun Microsystems, Inc. All rights reserved.
 
1
# Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
2
2
# Use is subject to license terms.
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
41
41
use constant REPLMYSQLD_SERVER_OPTIONS => 7;
42
42
use constant REPLMYSQLD_MASTER => 8;
43
43
use constant REPLMYSQLD_SLAVE => 9;
 
44
use constant REPLMYSQLD_VALGRIND => 10;
 
45
use constant REPLMYSQLD_VALGRIND_OPTIONS => 11;
44
46
 
45
47
sub new {
46
48
    my $class = shift;
52
54
                                   'slave_port' => REPLMYSQLD_SLAVE_PORT,
53
55
                                   'mode' => REPLMYSQLD_MODE,
54
56
                                   'server_options' => REPLMYSQLD_SERVER_OPTIONS,
55
 
                                   'start_dirty' => REPLMYSQLD_START_DIRTY},@_);
 
57
                                   'start_dirty' => REPLMYSQLD_START_DIRTY,
 
58
                                   'valgrind' => REPLMYSQLD_VALGRIND,
 
59
                                   'valgrind_options', REPLMYSQLD_VALGRIND_OPTIONS},@_);
56
60
    
57
61
    if (not defined $self->[REPLMYSQLD_MASTER_PORT]) {
58
62
        $self->[REPLMYSQLD_MASTER_PORT] = GenTest::Server::MySQLd::MYSQLD_DEFAULT_PORT;
66
70
        $self->[REPLMYSQLD_MODE] = 'default';
67
71
    }
68
72
    
 
73
    if (not defined $self->[REPLMYSQLD_MASTER_VARDIR]) {
 
74
        $self->[REPLMYSQLD_MASTER_VARDIR] = "mysql-test/var";
 
75
    }
 
76
    
 
77
    if (not defined $self->[REPLMYSQLD_SLAVE_VARDIR]) {
 
78
        $self->[REPLMYSQLD_SLAVE_VARDIR] = "mysql-test/var_slave";
 
79
    }
 
80
    
69
81
    my @master_options;
70
82
    push(@master_options, 
71
83
         "--server_id=1",
78
90
    }
79
91
 
80
92
 
81
 
    $self->[REPLMYSQLD_MASTER] = GenTest::Server::MySQLd->new(basedir => $self->basedir,
82
 
                                                              vardir => $self->[REPLMYSQLD_MASTER_VARDIR],
83
 
                                                              port => $self->[REPLMYSQLD_MASTER_PORT],
84
 
                                                              server_options => \@master_options,
85
 
                                                              start_dirty => $self->[REPLMYSQLD_START_DIRTY]);
 
93
    $self->[REPLMYSQLD_MASTER] = 
 
94
        GenTest::Server::MySQLd->new(basedir => $self->basedir,
 
95
                                     vardir => $self->[REPLMYSQLD_MASTER_VARDIR],
 
96
                                     port => $self->[REPLMYSQLD_MASTER_PORT],
 
97
                                     server_options => \@master_options,
 
98
                                     start_dirty => $self->[REPLMYSQLD_START_DIRTY],
 
99
                                     valgrind => $self->[REPLMYSQLD_VALGRIND],
 
100
                                     valgrind_options => $self->[REPLMYSQLD_VALGRIND_OPTIONS]);
86
101
    
87
102
    if (not defined $self->master) {
88
103
        croak("Could not create master");
99
114
    }
100
115
    
101
116
    
102
 
    $self->[REPLMYSQLD_SLAVE] = GenTest::Server::MySQLd->new(basedir => $self->basedir,
103
 
                                                             vardir => $self->[REPLMYSQLD_SLAVE_VARDIR],
104
 
                                                             port => $self->[REPLMYSQLD_SLAVE_PORT],
105
 
                                                             server_options => \@slave_options,
106
 
                                                             start_dirty => $self->[REPLMYSQLD_START_DIRTY]);
 
117
    $self->[REPLMYSQLD_SLAVE] = 
 
118
        GenTest::Server::MySQLd->new(basedir => $self->basedir,
 
119
                                     vardir => $self->[REPLMYSQLD_SLAVE_VARDIR],
 
120
                                     port => $self->[REPLMYSQLD_SLAVE_PORT],
 
121
                                     server_options => \@slave_options,
 
122
                                     start_dirty => $self->[REPLMYSQLD_START_DIRTY],
 
123
                                     valgrind => $self->[REPLMYSQLD_VALGRIND],
 
124
                                     valgrind_options => $self->[REPLMYSQLD_VALGRIND_OPTIONS]);
107
125
    
108
126
    if (not defined $self->slave) {
 
127
        $self->master->stopServer;
109
128
        croak("Could not create slave");
110
129
    }
111
130