Skip to content

Commit

Permalink
Continue listing upon error during diff and mirror (#2988)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored and kannappanr committed Dec 8, 2019
1 parent c5112d4 commit 69bea2e
Show file tree
Hide file tree
Showing 11 changed files with 275 additions and 174 deletions.
20 changes: 7 additions & 13 deletions cmd/client-s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ func (c *s3Client) listIncompleteInRoutine(contentCh chan *clientContent) {
contentCh <- &clientContent{
Err: probe.NewError(object.Err),
}
continue
return
}
content := &clientContent{}
url := *c.targetURL
Expand Down Expand Up @@ -1525,7 +1525,7 @@ func (c *s3Client) listIncompleteInRoutine(contentCh chan *clientContent) {
contentCh <- &clientContent{
Err: probe.NewError(object.Err),
}
continue
return
}
content := &clientContent{}
url := *c.targetURL
Expand Down Expand Up @@ -1568,7 +1568,7 @@ func (c *s3Client) listIncompleteRecursiveInRoutine(contentCh chan *clientConten
contentCh <- &clientContent{
Err: probe.NewError(object.Err),
}
continue
return
}
url := *c.targetURL
url.Path = c.joinPath(bucket.Name, object.Key)
Expand All @@ -1587,7 +1587,7 @@ func (c *s3Client) listIncompleteRecursiveInRoutine(contentCh chan *clientConten
contentCh <- &clientContent{
Err: probe.NewError(object.Err),
}
continue
return
}
url := *c.targetURL
// Join bucket and incoming object key.
Expand Down Expand Up @@ -1943,23 +1943,17 @@ func (c *s3Client) listRecursiveInRoutine(contentCh chan *clientContent, metadat
for _, bucket := range buckets {
isRecursive := true
for object := range c.listObjectWrapper(bucket.Name, o, isRecursive, nil, metadata) {
// Return error if we encountered glacier object and continue.
if object.StorageClass == s3StorageClassGlacier {
contentCh <- &clientContent{
Err: probe.NewError(ObjectOnGlacier{object.Key}),
}
continue
}
if object.Err != nil {
contentCh <- &clientContent{
Err: probe.NewError(object.Err),
}
continue
return
}
content := &clientContent{}
objectURL := *c.targetURL
objectURL.Path = c.joinPath(bucket.Name, object.Key)
content.URL = objectURL
content.StorageClass = object.StorageClass
content.Size = object.Size
content.ETag = object.ETag
content.Time = object.LastModified
Expand All @@ -1974,7 +1968,7 @@ func (c *s3Client) listRecursiveInRoutine(contentCh chan *clientContent, metadat
contentCh <- &clientContent{
Err: probe.NewError(object.Err),
}
continue
return
}
content := &clientContent{}
url := *c.targetURL
Expand Down
1 change: 1 addition & 0 deletions cmd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ type clientContent struct {
Time time.Time
Size int64
Type os.FileMode
StorageClass string
Metadata map[string]string
UserMetadata map[string]string
ETag string
Expand Down
2 changes: 0 additions & 2 deletions cmd/diff-main.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ func (d diffMessage) String() string {
msg = console.Colorize("DiffType", "! "+d.SecondURL)
case differInSize:
msg = console.Colorize("DiffSize", "! "+d.SecondURL)
case differInTime:
msg = console.Colorize("DiffTime", "! "+d.SecondURL)
case differInMetadata:
msg = console.Colorize("DiffMetadata", "! "+d.SecondURL)
default:
Expand Down
Loading

0 comments on commit 69bea2e

Please sign in to comment.