7121: Log all errors (except the everyday "not found") encountered during CompareAndT...
authorTom Clegg <tom@curoverse.com>
Tue, 8 Sep 2015 15:23:52 +0000 (11:23 -0400)
committerTom Clegg <tom@curoverse.com>
Tue, 8 Sep 2015 15:23:52 +0000 (11:23 -0400)
services/keepstore/handlers.go

index 8cc7d8b25cffa7d21565a450e5c6a4de1475b240..b3cad7f8fd555e105a220287ade3807e080b0ef1 100644 (file)
@@ -582,9 +582,17 @@ func CompareAndTouch(hash string, buf []byte) error {
                        // to tell which one is wanted if we have
                        // both, so there's no point writing it even
                        // on a different volume.)
+                       log.Printf("%s: Compare(%s): %s", vol, hash, err)
                        return err
+               } else if os.IsNotExist(err) {
+                       // Block does not exist. This is the only
+                       // "normal" error: we don't log anything.
+                       continue
                } else if err != nil {
-                       // Couldn't find, couldn't open, etc.: try next volume.
+                       // Couldn't open file, data is corrupt on
+                       // disk, etc.: log this abnormal condition,
+                       // and try the next volume.
+                       log.Printf("%s: Compare(%s): %s", vol, hash, err)
                        continue
                }
                if err := vol.Touch(hash); err != nil {