Skip to content

Commit

Permalink
slack-15.0: reset semi-sync in `setReplicationSourceRepairReplicati…
Browse files Browse the repository at this point in the history
…on` (#442)

* `slack-15.0`: reset semi-sync in `setReplicationSourceRepairReplication`

Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>

* reorder shard lock

Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>

* try 100% percona-xtrabackup-80

Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>

* Revert "try 100% percona-xtrabackup-80"

This reverts commit e67be76.

* percona-xtrabackup-24 problem fix attempt 2

Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>

* remove currentPrimary

Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>

* empty commit to fix CI

---------

Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
  • Loading branch information
timvaillancourt authored Jul 29, 2024
1 parent 106be4c commit 1b333db
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 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,31 @@ func (tm *TabletManager) setReplicationSourceRepairReplication(ctx context.Conte
return err
}

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, parent.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

0 comments on commit 1b333db

Please sign in to comment.