Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slack-15.0: reset semi-sync in setReplicationSourceRepairReplication #442

Merged
1 change: 1 addition & 0 deletions .github/workflows/codeql_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ jobs:
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo apt-get install -y gnupg2
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release enable-only pxb-24
sudo apt-get update
sudo apt-get install -y percona-xtrabackup-24

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/upgrade_downgrade_test_backups_e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ jobs:
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo apt-get install -y gnupg2
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release enable-only pxb-24
sudo apt-get update
sudo apt-get install -y percona-xtrabackup-24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ jobs:
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo apt-get install -y gnupg2
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release enable-only pxb-24
sudo apt-get update
sudo apt-get install -y percona-xtrabackup-24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ jobs:
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo apt-get install -y gnupg2
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release enable-only pxb-24
sudo apt-get update
sudo apt-get install -y percona-xtrabackup-24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ jobs:
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo apt-get install -y gnupg2
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release enable-only pxb-24
sudo apt-get update
sudo apt-get install -y percona-xtrabackup-24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ jobs:
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo apt-get install -y gnupg2
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release enable-only pxb-24
sudo apt-get update
sudo apt-get install -y percona-xtrabackup-24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ jobs:
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo apt-get install -y gnupg2
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release enable-only pxb-24
sudo apt-get update
sudo apt-get install -y percona-xtrabackup-24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ jobs:
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo apt-get install -y gnupg2
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release enable-only pxb-24
sudo apt-get update
sudo apt-get install -y percona-xtrabackup-24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ jobs:
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo apt-get install -y gnupg2
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release enable-only pxb-24
sudo apt-get update
sudo apt-get install -y percona-xtrabackup-24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ jobs:
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo apt-get install -y gnupg2
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release enable-only pxb-24
sudo apt-get update
sudo apt-get install -y percona-xtrabackup-24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ jobs:
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo apt-get install -y gnupg2
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release enable-only pxb-24
sudo apt-get update
sudo apt-get install -y percona-xtrabackup-24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ jobs:
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo apt-get install -y gnupg2
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release enable-only pxb-24
sudo apt-get update
sudo apt-get install -y percona-xtrabackup-24

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ jobs:
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo apt-get install -y gnupg2
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo percona-release enable-only pxb-24
sudo apt-get update
sudo apt-get install -y percona-xtrabackup-24

Expand Down
25 changes: 24 additions & 1 deletion go/vt/vttablet/tabletmanager/rpc_replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"vitess.io/vitess/go/vt/mysqlctl"
"vitess.io/vitess/go/vt/servenv"
"vitess.io/vitess/go/vt/topo/topoproto"
"vitess.io/vitess/go/vt/vtctl/reparentutil"
"vitess.io/vitess/go/vt/vterrors"

replicationdatapb "vitess.io/vitess/go/vt/proto/replicationdata"
Expand Down Expand Up @@ -706,14 +707,36 @@ func (tm *TabletManager) setReplicationSourceRepairReplication(ctx context.Conte
return err
}

currentPrimary, err := tm.TopoServer.GetTablet(ctx, parentAlias)
timvaillancourt marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return vterrors.Wrapf(err, "cannot read primary tablet %v", parentAlias)
}

durabilityName, err := tm.TopoServer.GetKeyspaceDurability(ctx, tm.Tablet().Keyspace)
if err != nil {
return vterrors.Wrapf(err, "cannot read keyspace durability policy %v", tm.Tablet().Keyspace)
}
log.Infof("Getting a new durability policy for %v", durabilityName)
durability, err := reparentutil.GetDurabilityPolicy(durabilityName)
if err != nil {
return vterrors.Wrapf(err, "cannot get durability policy %v", durabilityName)
}

// If using semi-sync, we need to enable it before connecting to primary.
// We should set the correct type, since it is used in replica semi-sync.
semiSyncAction, err := tm.convertBoolToSemiSyncAction(reparentutil.IsReplicaSemiSync(durability, currentPrimary.Tablet, tm.Tablet()))
if err != nil {
return err
}

ctx, unlock, lockErr := tm.TopoServer.LockShard(ctx, parent.Tablet.GetKeyspace(), parent.Tablet.GetShard(), fmt.Sprintf("repairReplication to %v as parent)", topoproto.TabletAliasString(parentAlias)))
if lockErr != nil {
return lockErr
}

defer unlock(&err)

return tm.setReplicationSourceLocked(ctx, parentAlias, timeCreatedNS, waitPosition, forceStartReplication, SemiSyncActionNone)
return tm.setReplicationSourceLocked(ctx, parentAlias, timeCreatedNS, waitPosition, forceStartReplication, semiSyncAction)
}

func (tm *TabletManager) setReplicationSourceSemiSyncNoAction(ctx context.Context, parentAlias *topodatapb.TabletAlias, timeCreatedNS int64, waitPosition string, forceStartReplication bool) error {
Expand Down
1 change: 1 addition & 0 deletions test/templates/cluster_endtoend_test_mysql57.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ jobs:
wget "https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb"
sudo apt-get install -y gnupg2
sudo dpkg -i "percona-release_latest.$(lsb_release -sc)_all.deb"
sudo percona-release enable-only pxb-24
sudo apt-get update
if [[ -n $XTRABACKUP_VERSION ]]; then
debfile="percona-xtrabackup-24_$XTRABACKUP_VERSION.$(lsb_release -sc)_amd64.deb"
Expand Down
1 change: 1 addition & 0 deletions test/templates/dockerfile.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ RUN wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_
RUN apt-get update
RUN apt-get install -y gnupg2
RUN dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
RUN percona-release enable-only pxb-24
RUN apt-get update
RUN apt-get install -y percona-xtrabackup-24
{{end}}
Expand Down
Loading