From: Ward Vandewege Date: Wed, 2 Jul 2014 01:27:34 +0000 (-0400) Subject: Move error logging for block-not-found from GetBlock to GetBlockHandler. X-Git-Tag: 1.1.0~2483^2~5 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/7b23dea6aaf66492ddb0e204cf0eae4b159f2a1c Move error logging for block-not-found from GetBlock to GetBlockHandler. It doesn't belong in GetBlock because GetBlock is also called from PutBlock, which checks to see if a block exists before it writes it again. In other words, in the most common scenario (a PUT of a new block), Keep should not print a bogus error message. --- diff --git a/services/keep/src/keep/keep.go b/services/keep/src/keep/keep.go index 429a7e01b2..7d86202301 100644 --- a/services/keep/src/keep/keep.go +++ b/services/keep/src/keep/keep.go @@ -413,6 +413,9 @@ func GetBlockHandler(resp http.ResponseWriter, req *http.Request) { if err != nil { // This type assertion is safe because the only errors // GetBlock can return are CorruptError or NotFoundError. + if err == NotFoundError { + log.Printf("%s: not found, giving up\n", hash) + } http.Error(resp, err.Error(), err.(*KeepError).HTTPCode) return } @@ -601,7 +604,6 @@ func GetBlock(hash string) ([]byte, error) { } } - log.Printf("%s: not found on any volumes, giving up\n", hash) return nil, NotFoundError }