Skip to content

Commit

Permalink
Update go/vt/vttablet/tabletmanager/vreplication/vreplicator.go
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Lord <mattalord@gmail.com>
Signed-off-by: Olga Shestopalova <olgash@mit.edu>
  • Loading branch information
olyazavr and mattlord authored Sep 12, 2023
1 parent ff34271 commit f53d052
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions go/vt/vttablet/tabletmanager/vreplication/vreplicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1033,11 +1033,13 @@ func (vr *vreplicator) newClientConnection(ctx context.Context) (*vdbClient, err
return dbClient, nil
}

// setExistingRowsCopied deals with the case where another tablet started the workflow and a reparent occurred,
// and now that we manage the workflow, we need to read the rows_copied that already exists and add them to our
// counter, otherwise it will look like the reparent wiped all the rows_copied.
// So in the event that our CopyRowCount counter is zero, and the existing rows_copied in the vreplication table
// is not, copy the value of vreplication.rows_copied into our CopyRowCount
// setExistingRowsCopied deals with the case where another tablet started
// the workflow and a reparent occurred, and now that we manage the
// workflow, we need to read the rows_copied that already exists and add
// them to our counter, otherwise it will look like the reparent wiped all the
// rows_copied. So in the event that our CopyRowCount counter is zero, and
// the existing rows_copied in the vreplication table is not, copy the value of
// vreplication.rows_copied into our CopyRowCount.
func (vr *vreplicator) setExistingRowsCopied() {
if vr.stats.CopyRowCount.Get() == 0 {
rowsCopiedExisting, err := vr.readExistingRowsCopied(vr.id)
Expand Down

0 comments on commit f53d052

Please sign in to comment.