Skip to content

Commit 7128bf9

Browse files
egeguneshors
andauthored
K8SPS-239: Bootstrap GR with mysql-shell (#316)
* K8SPS-239: Bootstrap GR with mysql-shell * Add rebooting from full cluster outage * Fix the need of cluster.rescan() * fix cluster name * improve bootstrap * separate sysbench manifests * fix rejoin of unreachable node * mask sensitive info in logs * fix bootstrap if new instance is missing purged transactions * fix limits test * fix deprecated methods * detect split brain in liveness probe * hopefully fix short write error * fix limits test * fix tests * review comments * fix short write * add gr-bootstrap test --------- Co-authored-by: Viacheslav Sarzhan <[email protected]>
1 parent 26cf0ff commit 7128bf9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+949
-377
lines changed

api/v1alpha1/groupversion_info.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ limitations under the License.
1515
*/
1616

1717
// Package v1alpha1 contains API Schema definitions for the ps v1alpha1 API group
18-
//+kubebuilder:object:generate=true
19-
//+groupName=ps.percona.com
18+
// +kubebuilder:object:generate=true
19+
// +groupName=ps.percona.com
2020
package v1alpha1
2121

2222
import (

build/ps-entrypoint.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,6 @@ load_group_replication_plugin() {
184184
POD_IP=$(hostname -I | awk '{print $1}')
185185

186186
sed -i "/\[mysqld\]/a plugin_load_add=group_replication.so" $CFG
187-
sed -i "/\[mysqld\]/a group_replication_bootstrap_group=OFF" $CFG
188-
sed -i "/\[mysqld\]/a group_replication_start_on_boot=OFF" $CFG
189-
sed -i "/\[mysqld\]/a group_replication_consistency=EVENTUAL" $CFG
190-
sed -i "/\[mysqld\]/a group_replication_exit_state_action=READ_ONLY" $CFG
191-
sed -i "/\[mysqld\]/a group_replication_communication_stack=XCOM" $CFG
192-
sed -i "/\[mysqld\]/a group_replication_ip_allowlist=${POD_IP}/16" $CFG
193-
sed -i "/\[mysqld\]/a group_replication_ssl_mode=REQUIRED" $CFG
194-
sed -i "/\[mysqld\]/a group_replication_recovery_use_ssl=ON" $CFG
195187
}
196188

197189
MYSQL_VERSION=$(mysqld -V | awk '{print $3}' | awk -F'.' '{print $1"."$2}')

cmd/bootstrap/async_replication.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func bootstrapAsyncReplication() error {
3333
if err != nil {
3434
return errors.Wrap(err, "lookup")
3535
}
36-
log.Printf("Peers: %v", peers.List())
36+
log.Printf("Peers: %v", sets.List(peers))
3737

3838
exists, err := lockExists()
3939
if err != nil {
@@ -193,16 +193,16 @@ func bootstrapAsyncReplication() error {
193193
return nil
194194
}
195195

196-
func getTopology(peers sets.String) (string, []string, error) {
197-
replicas := sets.NewString()
196+
func getTopology(peers sets.Set[string]) (string, []string, error) {
197+
replicas := sets.New[string]()
198198
primary := ""
199199

200200
operatorPass, err := getSecret(apiv1alpha1.UserOperator)
201201
if err != nil {
202202
return "", nil, errors.Wrapf(err, "get %s password", apiv1alpha1.UserOperator)
203203
}
204204

205-
for _, peer := range peers.List() {
205+
for _, peer := range sets.List(peers) {
206206
db, err := replicator.NewReplicator("operator", operatorPass, peer, mysql.DefaultAdminPort)
207207
if err != nil {
208208
return "", nil, errors.Wrapf(err, "connect to %s", peer)
@@ -229,16 +229,16 @@ func getTopology(peers sets.String) (string, []string, error) {
229229
}
230230

231231
if primary == "" && peers.Len() == 1 {
232-
primary = peers.List()[0]
232+
primary = sets.List(peers)[0]
233233
} else if primary == "" {
234-
primary = replicas.List()[0]
234+
primary = sets.List(replicas)[0]
235235
}
236236

237237
if replicas.Len() > 0 {
238238
replicas.Delete(primary)
239239
}
240240

241-
return primary, replicas.List(), nil
241+
return primary, sets.List(replicas), nil
242242
}
243243

244244
func selectDonor(fqdn, primary string, replicas []string) (string, error) {

0 commit comments

Comments
 (0)