Add file path to disk map write/read warnings (#10911)

This commit is contained in:
Vladyslav Lupashevskyi 2019-07-24 13:26:43 +03:00 committed by Andronik Ordian
parent d1b28bf57e
commit cc796a232a

View File

@ -130,7 +130,7 @@ impl<K: hash::Hash + Eq, V> DiskMap<K, V> {
trace!(target: "diskmap", "revert {:?}", self.path); trace!(target: "diskmap", "revert {:?}", self.path);
let _ = fs::File::open(self.path.clone()) let _ = fs::File::open(self.path.clone())
.map_err(|e| trace!(target: "diskmap", "Couldn't open disk map: {}", e)) .map_err(|e| trace!(target: "diskmap", "Couldn't open disk map: {}", e))
.and_then(|f| read(f).map_err(|e| warn!(target: "diskmap", "Couldn't read disk map: {}", e))) .and_then(|f| read(f).map_err(|e| warn!(target: "diskmap", "Couldn't read disk map at: {:?} {}", self.path, e)))
.and_then(|m| { .and_then(|m| {
self.cache = m; self.cache = m;
Ok(()) Ok(())
@ -144,9 +144,9 @@ impl<K: hash::Hash + Eq, V> DiskMap<K, V> {
if self.transient { return; } if self.transient { return; }
trace!(target: "diskmap", "save {:?}", self.path); trace!(target: "diskmap", "save {:?}", self.path);
let _ = fs::File::create(self.path.clone()) let _ = fs::File::create(self.path.clone())
.map_err(|e| warn!(target: "diskmap", "Couldn't open disk map for writing: {}", e)) .map_err(|e| warn!(target: "diskmap", "Couldn't open disk map for writing at: {:?} {}", self.path, e))
.and_then(|mut f| { .and_then(|mut f| {
write(&self.cache, &mut f).map_err(|e| warn!(target: "diskmap", "Couldn't write to disk map: {}", e)) write(&self.cache, &mut f).map_err(|e| warn!(target: "diskmap", "Couldn't write to disk map at: {:?} {}", self.path, e))
}); });
} }
} }