fix tests

This commit is contained in:
tamo
2021-05-05 18:03:21 +02:00
parent efca63f9ce
commit 24192fc550
6 changed files with 7 additions and 9 deletions

View File

@ -241,7 +241,7 @@ where
tokio::task::spawn_blocking(move || -> anyhow::Result<()> {
update_store.dump(&uuids, path.to_path_buf())?;
// Perform the snapshot of each index concurently. Only a third of the capabilities of
// Perform the dump of each index concurently. Only a third of the capabilities of
// the index actor at a time not to put too much pressure on the index actor
let path = &path;
let handle = &index_handle;

View File

@ -11,6 +11,7 @@ use arc_swap::ArcSwap;
use heed::types::{ByteSlice, OwnedType, SerdeJson};
use heed::zerocopy::U64;
use heed::{BytesDecode, BytesEncode, CompactionOption, Database, Env, EnvOpenOptions};
use log::error;
use parking_lot::{Mutex, MutexGuard};
use tokio::runtime::Handle;
use tokio::sync::mpsc;
@ -77,6 +78,7 @@ pub enum State {
Idle,
Processing(Uuid, Processing),
Snapshoting,
Dumping,
}
impl<'a> BytesEncode<'a> for NextIdCodec {
@ -227,7 +229,7 @@ impl UpdateStore {
match res {
Ok(Some(_)) => (),
Ok(None) => break,
Err(e) => eprintln!("error while processing update: {}", e),
Err(e) => error!("error while processing update: {}", e),
}
}
// the ownership on the arc has been taken, we need to exit.
@ -520,7 +522,7 @@ impl UpdateStore {
pub fn dump(&self, uuids: &HashSet<(String, Uuid)>, path: PathBuf) -> anyhow::Result<()> {
use std::io::prelude::*;
let state_lock = self.state.write();
state_lock.swap(State::Snapshoting); // TODO: TAMO rename the state somehow
state_lock.swap(State::Dumping);
let txn = self.env.write_txn()?;