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

vreplication: fix vreplication timing metrics #8024

Merged
merged 1 commit into from
May 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions go/vt/vttablet/tabletmanager/vreplication/vcopier.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,7 @@ func (vc *vcopier) copyNext(ctx context.Context, settings binlogplayer.VRSetting
func (vc *vcopier) catchup(ctx context.Context, copyState map[string]*sqltypes.Result) error {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
defer func() {
vc.vr.stats.PhaseTimings.Record("catchup", time.Now())
}()
defer vc.vr.stats.PhaseTimings.Record("catchup", time.Now())

settings, err := binlogplayer.ReadVRSettings(vc.vr.dbClient, vc.vr.id)
if err != nil {
Expand Down Expand Up @@ -198,10 +196,8 @@ func (vc *vcopier) catchup(ctx context.Context, copyState map[string]*sqltypes.R
// committed with the lastpk. This allows for consistent resumability.
func (vc *vcopier) copyTable(ctx context.Context, tableName string, copyState map[string]*sqltypes.Result) error {
defer vc.vr.dbClient.Rollback()
defer func() {
vc.vr.stats.PhaseTimings.Record("copy", time.Now())
vc.vr.stats.CopyLoopCount.Add(1)
}()
defer vc.vr.stats.PhaseTimings.Record("copy", time.Now())
defer vc.vr.stats.CopyLoopCount.Add(1)

log.Infof("Copying table %s, lastpk: %v", tableName, copyState[tableName])

Expand Down Expand Up @@ -334,9 +330,7 @@ func (vc *vcopier) copyTable(ctx context.Context, tableName string, copyState ma
}

func (vc *vcopier) fastForward(ctx context.Context, copyState map[string]*sqltypes.Result, gtid string) error {
defer func() {
vc.vr.stats.PhaseTimings.Record("fastforward", time.Now())
}()
defer vc.vr.stats.PhaseTimings.Record("fastforward", time.Now())
pos, err := mysql.DecodePosition(gtid)
if err != nil {
return err
Expand Down