|
36 | 36 | # load_balance_hosts=disable should always choose the first one.
|
37 | 37 | $node1->connect_ok("host=$hostlist port=$portlist load_balance_hosts=disable",
|
38 | 38 | "load_balance_hosts=disable connects to the first node",
|
39 |
| - sql => "SELECT 'connect2'", |
40 |
| - log_like => [qr/statement: SELECT 'connect2'/]); |
| 39 | + sql => "SELECT 'connect1'", |
| 40 | + log_like => [qr/statement: SELECT 'connect1'/]); |
41 | 41 |
|
42 | 42 | # Statistically the following loop with load_balance_hosts=random will almost
|
43 | 43 | # certainly connect at least once to each of the nodes. The chance of that not
|
44 | 44 | # happening is so small that it's negligible: (2/3)^50 = 1.56832855e-9
|
45 | 45 | foreach my $i (1 .. 50) {
|
46 | 46 | $node1->connect_ok("host=$hostlist port=$portlist load_balance_hosts=random",
|
47 | 47 | "repeated connections with random load balancing",
|
48 |
| - sql => "SELECT 'connect1'"); |
| 48 | + sql => "SELECT 'connect2'"); |
49 | 49 | }
|
50 | 50 |
|
51 |
| -my $node1_occurences = () = $node1->log_content() =~ /statement: SELECT 'connect1'/g; |
52 |
| -my $node2_occurences = () = $node2->log_content() =~ /statement: SELECT 'connect1'/g; |
53 |
| -my $node3_occurences = () = $node3->log_content() =~ /statement: SELECT 'connect1'/g; |
| 51 | +my $node1_occurences = () = $node1->log_content() =~ /statement: SELECT 'connect2'/g; |
| 52 | +my $node2_occurences = () = $node2->log_content() =~ /statement: SELECT 'connect2'/g; |
| 53 | +my $node3_occurences = () = $node3->log_content() =~ /statement: SELECT 'connect2'/g; |
54 | 54 |
|
55 | 55 | my $total_occurences = $node1_occurences + $node2_occurences + $node3_occurences;
|
56 | 56 |
|
|
0 commit comments