Skip to content

web search done right

more error restitant

Mikkel Denkerfc0a1bd75633
diff --git a/src/kv/rocksdb_store.rs b/src/kv/rocksdb_store.rs
index 27a38ed3..41c7cccf 100644
--- a/src/kv/rocksdb_store.rs
+++ b/src/kv/rocksdb_store.rs
@@ -70,7 +70,12 @@ where
}
fn flush(&self) {
- self.flush().expect("failed to flush");
+ if let Err(err) = self.flush() {
+ match err.kind() {
+ rocksdb::ErrorKind::NotSupported => {}
+ _ => panic!("failed to flush: {:?}", err),
+ }
+ }
}
fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = (K, V)> + 'a> {
diff --git a/src/webgraph/centrality/harmonic.rs b/src/webgraph/centrality/harmonic.rs
index 05fc0c44..fb5797ca 100644
--- a/src/webgraph/centrality/harmonic.rs
+++ b/src/webgraph/centrality/harmonic.rs
@@ -60,17 +60,18 @@ where
let mut new_counters: IntMap<HyperLogLog<16>> = counters.clone();
for edge in graph.edges() {
- let counter_to = new_counters.get_mut(&edge.to).unwrap();
- let counter_from = counters.get(&edge.from).unwrap();
-
- if counter_to
- .registers()
- .iter()
- .zip(counter_from.registers().iter())
- .any(|(to, from)| *from > *to)
+ if let (Some(counter_to), Some(counter_from)) =
+ (new_counters.get_mut(&edge.to), counters.get(&edge.from))
{
- counter_to.merge(counter_from);
- counter_changes += 1;
+ if counter_to
+ .registers()
+ .iter()
+ .zip(counter_from.registers().iter())
+ .any(|(to, from)| *from > *to)
+ {
+ counter_to.merge(counter_from);
+ counter_changes += 1;
+ }
}
}
diff --git a/src/webgraph/graph_store.rs b/src/webgraph/graph_store.rs
index 6c8bacfd..56e59951 100644
--- a/src/webgraph/graph_store.rs
+++ b/src/webgraph/graph_store.rs
@@ -329,12 +329,9 @@ impl Store for RocksDbStore {
}
fn open_read_only<P: AsRef<Path>>(path: P) -> GraphStore<Self> {
- let adjacency = Box::new(
- RocksDbStore::open_read_only(path.as_ref().join("adjacency")).load_in_memory(),
- );
- let reversed_adjacency = Box::new(
- RocksDbStore::open_read_only(path.as_ref().join("reversed_adjacency")).load_in_memory(),
- );
+ let adjacency = RocksDbStore::open_read_only(path.as_ref().join("adjacency"));
+ let reversed_adjacency =
+ RocksDbStore::open_read_only(path.as_ref().join("reversed_adjacency"));
let node2id = RocksDbStore::open_read_only(path.as_ref().join("node2id"));
let id2node = RocksDbStore::open_read_only(path.as_ref().join("id2node"));
let meta = RocksDbStore::open_read_only(path.as_ref().join("meta"));