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)
}
}
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)
}
}
// 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
}
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)
// 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)
}
}
// 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 {
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())