Skip to content

Commit

Permalink
Log which tablet copy_state GC failed on (#11521)
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>

Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord authored Oct 18, 2022
1 parent 927fc3f commit 8846bab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions go/vt/wrangler/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -739,15 +739,16 @@ func (wr *Wrangler) optimizeCopyStateTable(tablet *topodatapb.Tablet) {
if sqlErr, ok := err.(*mysql.SQLError); ok && sqlErr.Num == mysql.ERNoSuchTable { // the table may not exist
return
}
log.Warningf("Failed to optimize the copy_state table: %v", err)
log.Warningf("Failed to optimize the copy_state table on %q: %v", tablet.Alias.String(), err)
}
// This will automatically set the value to 1 or the current max value in the table, whichever is greater
sqlResetAutoInc := "alter table _vt.copy_state auto_increment = 1"
if _, err := wr.tmc.ExecuteFetchAsAllPrivs(ctx, tablet, &tabletmanagerdatapb.ExecuteFetchAsAllPrivsRequest{
Query: []byte(sqlResetAutoInc),
MaxRows: uint64(0),
}); err != nil {
log.Warningf("Failed to reset the auto_increment value for the copy_state table: %v", err)
log.Warningf("Failed to reset the auto_increment value for the copy_state table on %q: %v",
tablet.Alias.String(), err)
}
}()
}
Expand Down

0 comments on commit 8846bab

Please sign in to comment.