X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7930d7abaabf2fd1f3432eca10f26b821e0ef94f..9a34f5ed292fb8d2f262e4c23e758cd689d81db7:/services/keepstore/handlers.go diff --git a/services/keepstore/handlers.go b/services/keepstore/handlers.go index 8cc7d8b25c..e6129a7376 100644 --- a/services/keepstore/handlers.go +++ b/services/keepstore/handlers.go @@ -210,8 +210,8 @@ func StatusHandler(resp http.ResponseWriter, req *http.Request) { if err == nil { resp.Write(jstat) } else { - log.Printf("json.Marshal: %s\n", err) - log.Printf("NodeStatus = %v\n", &st) + log.Printf("json.Marshal: %s", err) + log.Printf("NodeStatus = %v", &st) http.Error(resp, err.Error(), 500) } } @@ -321,7 +321,7 @@ func DeleteHandler(resp http.ResponseWriter, req *http.Request) { if body, err := json.Marshal(result); err == nil { resp.Write(body) } else { - log.Printf("json.Marshal: %s (result = %v)\n", err, result) + log.Printf("json.Marshal: %s (result = %v)", err, result) http.Error(resp, err.Error(), 500) } } @@ -465,7 +465,7 @@ func GetBlock(hash string) ([]byte, error) { // volumes. If all volumes report IsNotExist, // we return a NotFoundError. if !os.IsNotExist(err) { - log.Printf("GetBlock: reading %s: %s\n", hash, err) + log.Printf("%s: Get(%s): %s", vol, hash, err) } continue } @@ -475,7 +475,7 @@ func GetBlock(hash string) ([]byte, error) { if filehash != hash { // TODO: Try harder to tell a sysadmin about // this. - log.Printf("%s: checksum mismatch for request %s (actual %s)\n", + log.Printf("%s: checksum mismatch for request %s (actual %s)", vol, hash, filehash) error_to_caller = DiskHashError bufs.Put(buf) @@ -556,7 +556,7 @@ func PutBlock(block []byte, hash string) error { // write did not succeed. Report the // error and continue trying. allFull = false - log.Printf("%s: Write(%s): %s\n", vol, hash, err) + log.Printf("%s: Write(%s): %s", vol, hash, err) } } @@ -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 { @@ -629,7 +637,7 @@ func GetApiToken(req *http.Request) string { func IsExpired(timestamp_hex string) bool { ts, err := strconv.ParseInt(timestamp_hex, 16, 0) if err != nil { - log.Printf("IsExpired: %s\n", err) + log.Printf("IsExpired: %s", err) return true } return time.Unix(ts, 0).Before(time.Now())