From 109c927dada8627800b971448f17d95c0d520ee8 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 13 Dec 2021 17:45:06 -0800 Subject: [PATCH] docs/debug: log any corruption and continue debug tool --- docs/debugging/s3-check-md5/main.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/debugging/s3-check-md5/main.go b/docs/debugging/s3-check-md5/main.go index 43ebfe565..2c2109052 100644 --- a/docs/debugging/s3-check-md5/main.go +++ b/docs/debugging/s3-check-md5/main.go @@ -121,11 +121,12 @@ func main() { if p, err := strconv.Atoi(s[1]); err == nil { parts = p } else { - log.Fatalln("ETAG: wrong format:", err) + log.Println("ETAG: wrong format:", err) continue } default: - log.Fatalln("Unexpected ETAG format", object.ETag) + log.Println("Unexpected ETAG format", object.ETag) + continue } var partsMD5Sum [][]byte @@ -134,12 +135,12 @@ func main() { obj, err := s3Client.GetObject(context.Background(), bucket, object.Key, minio.GetObjectOptions{VersionID: object.VersionID, PartNumber: p}) if err != nil { - log.Fatalln("GET", bucket, object.Key, object.VersionID, "=>", err) + log.Println("GET", bucket, object.Key, object.VersionID, "=>", err) continue } h := md5.New() if _, err := io.Copy(h, obj); err != nil { - log.Fatalln("MD5 calculation error:", bucket, object.Key, object.VersionID, "=>", err) + log.Println("MD5 calculation error:", bucket, object.Key, object.VersionID, "=>", err) continue } partsMD5Sum = append(partsMD5Sum, h.Sum(nil)) @@ -165,10 +166,10 @@ func main() { } if corrupted { - log.Fatalln("CORRUPTED object:", bucket, object.Key, object.VersionID) + log.Println("CORRUPTED object:", bucket, object.Key, object.VersionID) + } else { + log.Println("INTACT", bucket, object.Key, object.VersionID) } - - log.Println("INTACT", bucket, object.Key, object.VersionID) } } }