Skip to content

Commit

Permalink
storage: teach scatter to use the allocator and zone config
Browse files Browse the repository at this point in the history
Replace the existing "toy" implementation of scatter with a real
implementation that uses the zone configuration and the allocator's
recommendations.
  • Loading branch information
benesch committed Jul 13, 2017
1 parent 27870fa commit 24ae61e
Show file tree
Hide file tree
Showing 9 changed files with 668 additions and 625 deletions.
17 changes: 3 additions & 14 deletions pkg/ccl/sqlccl/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -756,23 +756,12 @@ func Restore(
req := &roachpb.AdminScatterRequest{
Span: roachpb.Span{Key: span.Key, EndKey: span.EndKey},
}
res, pErr := client.SendWrapped(scatterCtx, db.GetSender(), req)
if pErr != nil {
return pErr.GoError()
}
// Scatter is best-effort, so log why any individual ranges
// didn't get scattered.
for _, r := range res.(*roachpb.AdminScatterResponse).Ranges {
if r.Error != nil {
log.Warningf(scatterCtx, "error scattering range [%s,%s): %+v",
r.Span.Key, r.Span.EndKey, r.Error.GoError())
}
}
return nil
_, pErr := client.SendWrapped(scatterCtx, db.GetSender(), req)
return pErr.GoError()
})
}
if err := g.Wait(); err != nil {
return failed, errors.Wrapf(err, "scattering %d ranges", len(importRequests))
log.Errorf(ctx, "failed scattering %d ranges: %s", len(importRequests), err)
}
log.Eventf(ctx, "scattered lease holders for %d key spans", len(newSpans))
}
Expand Down
Loading

0 comments on commit 24ae61e

Please sign in to comment.