sync: fix bug in prefix enumeration. could send one extra item.

Depending on timing, could lead to ListMissingDestinationBlobs getting out
of sync and causing a lot of blobs to be replicated that were fine and already
on the server.

Change-Id: I3710e59088f1fe4e526f8f11bc9d1837a727e512
This commit is contained in:
Brad Fitzpatrick 2014-03-17 23:02:01 -07:00
parent bf88f5f06c
commit bf8f4b2423
1 changed files with 5 additions and 5 deletions

View File

@ -740,13 +740,13 @@ func (sh *SyncHandler) startValidatePrefix(ctx *context.Context, pfx string, doD
go func() {
defer close(c)
err := blobserver.EnumerateAllFrom(ctx, e, pfx, func(sb blob.SizedRef) error {
// TODO: could add a more efficient method on blob.Ref to do this,
// that doesn't involve call String().
if !strings.HasPrefix(sb.Ref.String(), pfx) {
return errNotPrefix
}
select {
case c <- sb:
// TODO: could add a more efficient method on blob.Ref to do this,
// that doesn't involve call String().
if !strings.HasPrefix(sb.Ref.String(), pfx) {
return errNotPrefix
}
sh.mu.Lock()
if doDest {
sh.vdestCount++