Do not print an error when hitting 'not found' with a the MockVolume
authorWard Vandewege <ward@curoverse.com>
Wed, 2 Jul 2014 02:12:34 +0000 (22:12 -0400)
committerWard Vandewege <ward@curoverse.com>
Wed, 2 Jul 2014 02:15:30 +0000 (22:15 -0400)
backend.

services/keep/src/keep/keep.go

index 7d86202301ce27337c1076e8c89e4ccb72c7c90b..c9047b070f857d9cb6beeb1e6be096842a7b2f94 100644 (file)
@@ -575,12 +575,13 @@ func GetBlock(hash string) ([]byte, error) {
        for _, vol := range KeepVM.Volumes() {
                if buf, err := vol.Get(hash); err != nil {
                        // IsNotExist is an expected error and may be ignored.
+                       // "not found" is the equivalent for the MockVolume backend.
                        // (If all volumes report IsNotExist, we return a NotFoundError)
                        // A CorruptError should be returned immediately.
                        // Any other errors should be logged but we continue trying to
                        // read.
                        switch {
-                       case os.IsNotExist(err):
+                       case (os.IsNotExist(err) || err.Error() == "not found"):
                                continue
                        default:
                                log.Printf("GetBlock: reading %s: %s\n", hash, err)