|
| 1 | +// Assumptions: smart deployment rountines available |
| 2 | +//@ Initialization |
| 3 | +var deployed_here = reset_or_deploy_sandboxes(); |
| 4 | + |
| 5 | +//@ Create single-primary cluster |
| 6 | +shell.connect({scheme: 'mysql', host: localhost, port: __mysql_sandbox_port1, user: 'root', password: 'root'}); |
| 7 | +var singleSession = session; |
| 8 | + |
| 9 | +if (__have_ssl) |
| 10 | + var single = dba.createCluster('single', {memberSslMode:'REQUIRED'}); |
| 11 | +else |
| 12 | + var single = dba.createCluster('single'); |
| 13 | + |
| 14 | +//@ Success adding instance 2 |
| 15 | +add_instance_to_cluster(single, __mysql_sandbox_port2); |
| 16 | + |
| 17 | +// Waiting for the added instance to become online |
| 18 | +wait_slave_state(single, uri2, "ONLINE"); |
| 19 | + |
| 20 | +// Wait for the second added instance to fetch all the replication data |
| 21 | +wait_sandbox_in_metadata(__mysql_sandbox_port2); |
| 22 | + |
| 23 | +//@ Success adding instance 3 |
| 24 | +add_instance_to_cluster(single, __mysql_sandbox_port3); |
| 25 | + |
| 26 | +// Waiting for the added instance to become online |
| 27 | +wait_slave_state(single, uri3, "ONLINE"); |
| 28 | + |
| 29 | +// Wait for the third added instance to fetch all the replication data |
| 30 | +wait_sandbox_in_metadata(__mysql_sandbox_port3); |
| 31 | + |
| 32 | +//@ Cluster.dissolve no force error |
| 33 | +single.dissolve(); |
| 34 | + |
| 35 | +//@ Success dissolving single-primary cluster |
| 36 | +single.dissolve({force: true}); |
| 37 | + |
| 38 | +//@ Cluster.dissolve already dissolved |
| 39 | +single.dissolve(); |
| 40 | + |
| 41 | +shell.connect({scheme: 'mysql', host: localhost, port: __mysql_sandbox_port1, user: 'root', password: 'root'}); |
| 42 | +var multiSession = session; |
| 43 | + |
| 44 | +//@ Create multi-primary cluster |
| 45 | +if (__have_ssl) |
| 46 | + var multi = dba.createCluster('multi', {multiMaster: true, memberSslMode:'REQUIRED', clearReadOnly: true, force: true}); |
| 47 | +else |
| 48 | + var multi = dba.createCluster('multi', {multiMaster: true, clearReadOnly: true, force: true}); |
| 49 | + |
| 50 | +//@ Success adding instance 2 mp |
| 51 | +add_instance_to_cluster(multi, __mysql_sandbox_port2); |
| 52 | + |
| 53 | +// Waiting for the added instance to become online |
| 54 | +wait_slave_state(multi, uri2, "ONLINE"); |
| 55 | + |
| 56 | +// Wait for the second added instance to fetch all the replication data |
| 57 | +wait_sandbox_in_metadata(__mysql_sandbox_port2); |
| 58 | + |
| 59 | +//@ Success adding instance 3 mp |
| 60 | +add_instance_to_cluster(multi, __mysql_sandbox_port3); |
| 61 | + |
| 62 | +// Waiting for the added instance to become online |
| 63 | +wait_slave_state(multi, uri3, "ONLINE"); |
| 64 | + |
| 65 | +// Wait for the third added instance to fetch all the replication data |
| 66 | +wait_sandbox_in_metadata(__mysql_sandbox_port3); |
| 67 | + |
| 68 | +//@ Success dissolving multi-primary cluster |
| 69 | +multi.dissolve({force: true}); |
| 70 | + |
| 71 | +//@ Create single-primary cluster 2 |
| 72 | +shell.connect({scheme: 'mysql', host: localhost, port: __mysql_sandbox_port1, user: 'root', password: 'root'}); |
| 73 | +var singleSession2 = session; |
| 74 | + |
| 75 | +if (__have_ssl) |
| 76 | + var single2 = dba.createCluster('single2', {memberSslMode:'REQUIRED', clearReadOnly: true}); |
| 77 | +else |
| 78 | + var single2 = dba.createCluster('single2', {clearReadOnly: true}); |
| 79 | + |
| 80 | +//@ Success adding instance 2 2 |
| 81 | +add_instance_to_cluster(single2, __mysql_sandbox_port2); |
| 82 | + |
| 83 | +// Waiting for the added instance to become online |
| 84 | +wait_slave_state(single2, uri2, "ONLINE"); |
| 85 | + |
| 86 | +// Wait for the second added instance to fetch all the replication data |
| 87 | +wait_sandbox_in_metadata(__mysql_sandbox_port2); |
| 88 | + |
| 89 | +//@ Success adding instance 3 2 |
| 90 | +add_instance_to_cluster(single2, __mysql_sandbox_port3); |
| 91 | + |
| 92 | +// Waiting for the added instance to become online |
| 93 | +wait_slave_state(single2, uri3, "ONLINE"); |
| 94 | + |
| 95 | +// Wait for the third added instance to fetch all the replication data |
| 96 | +wait_sandbox_in_metadata(__mysql_sandbox_port3); |
| 97 | + |
| 98 | +// stop instance 3 |
| 99 | +// Use stop sandbox instance to make sure the instance is gone before restarting it |
| 100 | +if (__sandbox_dir) |
| 101 | + dba.stopSandboxInstance(__mysql_sandbox_port3, {sandboxDir:__sandbox_dir, password: 'root'}); |
| 102 | +else |
| 103 | + dba.stopSandboxInstance(__mysql_sandbox_port3, {password: 'root'}); |
| 104 | + |
| 105 | +wait_slave_state(single2, uri3, ["(MISSING)"]); |
| 106 | + |
| 107 | +// Regression test for BUG#26001653 |
| 108 | +//@ Success dissolving cluster 2 |
| 109 | +single2.dissolve({force: true}); |
| 110 | + |
| 111 | +// start instance 3 |
| 112 | +try_restart_sandbox(__mysql_sandbox_port3); |
| 113 | + |
| 114 | +//@ Create multi-primary cluster 2 |
| 115 | +shell.connect({scheme: 'mysql', host: localhost, port: __mysql_sandbox_port1, user: 'root', password: 'root'}); |
| 116 | +var multiSession2 = session; |
| 117 | + |
| 118 | +if (__have_ssl) |
| 119 | + var multi2 = dba.createCluster('multi2', {memberSslMode:'REQUIRED', clearReadOnly: true, multiMaster: true, force: true}); |
| 120 | +else |
| 121 | + var multi2 = dba.createCluster('multi2', {clearReadOnly: true, multiMaster: true, force: true}); |
| 122 | + |
| 123 | +//@ Success adding instance 2 mp 2 |
| 124 | +add_instance_to_cluster(multi2, __mysql_sandbox_port2); |
| 125 | + |
| 126 | +// Waiting for the added instance to become online |
| 127 | +wait_slave_state(multi2, uri2, "ONLINE"); |
| 128 | + |
| 129 | +// Wait for the second added instance to fetch all the replication data |
| 130 | +wait_sandbox_in_metadata(__mysql_sandbox_port2); |
| 131 | + |
| 132 | +//@ Success adding instance 3 mp 2 |
| 133 | +add_instance_to_cluster(multi2, __mysql_sandbox_port3); |
| 134 | + |
| 135 | +// Waiting for the added instance to become online |
| 136 | +wait_slave_state(multi2, uri3, "ONLINE"); |
| 137 | + |
| 138 | +// Wait for the third added instance to fetch all the replication data |
| 139 | +wait_sandbox_in_metadata(__mysql_sandbox_port3); |
| 140 | + |
| 141 | +// stop instance 3 |
| 142 | +// Use stop sandbox instance to make sure the instance is gone before restarting it |
| 143 | +if (__sandbox_dir) |
| 144 | + dba.stopSandboxInstance(__mysql_sandbox_port3, {sandboxDir:__sandbox_dir, password: 'root'}); |
| 145 | +else |
| 146 | + dba.stopSandboxInstance(__mysql_sandbox_port3, {password: 'root'}); |
| 147 | + |
| 148 | +wait_slave_state(multi2, uri3, ["(MISSING)"]); |
| 149 | + |
| 150 | +// Regression test for BUG#26001653 |
| 151 | +//@ Success dissolving multi-primary cluster 2 |
| 152 | +multi2.dissolve({force: true}); |
| 153 | + |
| 154 | +//@ Finalization |
| 155 | +// Will close opened sessions and delete the sandboxes ONLY if this test was executed standalone |
| 156 | +singleSession.close(); |
| 157 | +multiSession.close(); |
| 158 | +singleSession2.close(); |
| 159 | +multiSession2.close(); |
| 160 | +if (deployed_here) |
| 161 | + cleanup_sandboxes(true); |
0 commit comments