Skip to content

Commit

Permalink
do not report error if node exists
Browse files Browse the repository at this point in the history
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
  • Loading branch information
shlomi-noach committed Oct 4, 2020
1 parent fe9341e commit c305450
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions go/vt/vtctld/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,22 +162,22 @@ func reviewMigrationRequests(ctx context.Context, ts *topo.Server, tmClient tmcl
func onMigrationCheckTick(ctx context.Context, ts *topo.Server, tmClient tmclient.TabletManagerClient) {
conn, err := ts.ConnForCell(ctx, topo.GlobalCell)
if err != nil {
log.Errorf("Executor.checkMigrations ConnForCell error: %s", err.Error())
log.Errorf("vtctld.onMigrationCheckTick ConnForCell error: %s", err.Error())
return
}

onlineDDLOnce.Do(func() {
// This creates the directory schema.MigrationRequestsPath(), once.
// From now on, we can ListDir() n that directory without errors, even if no migration has ever been created.
_, err = conn.Create(ctx, fmt.Sprintf("%s/sentry", schema.MigrationRequestsPath()), []byte{})
if err != nil {
log.Errorf("Executor.onlineDDLOnce Create sentry error: %s", err.Error())
_, err := conn.Create(ctx, fmt.Sprintf("%s/sentry", schema.MigrationRequestsPath()), []byte{})
if err != nil && !topo.IsErrType(err, topo.NodeExists) {
log.Errorf("vtctld.onMigrationCheckTick Create sentry error: %s", err.Error())
}
})

lockDescriptor, err := conn.Lock(ctx, schema.MigrationRequestsPath(), "cvtctld.checkMigrationRequests")
lockDescriptor, err := conn.Lock(ctx, schema.MigrationRequestsPath(), "vtctld.onMigrationCheckTick")
if err != nil {
log.Errorf("Executor.checkMigrations ConnForCell error: %s", err.Error())
log.Errorf("vtctld.onMigrationCheckTick ConnForCell error: %s", err.Error())
return
}
defer lockDescriptor.Unlock(ctx)
Expand Down

0 comments on commit c305450

Please sign in to comment.