add consensus configuration + lower log level + fix flickering test

This commit is contained in:
Andrey Vasnetsov
2022-06-06 21:44:03 +02:00
parent c21855551f
commit 8e52c255ab
4 changed files with 24 additions and 6 deletions

View File

@@ -102,3 +102,20 @@ service:
# More info: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
# Default: true
enable_cors: true
cluster:
# Use `enabled: true` to run Qdrant in distributed deployment mode
enabled: true
# Configuration of the inter-cluster communication
p2p:
# Port for internal communication between peers
port: 6335
# Configuration related to distributed consensus algorithm
consensus:
# How frequently peers should ping each other.
# Setting this parameter to lower value will allow consensus
# to detect disconnected nodes earlier, but too frequent
# tick period may create significant network and CPU overhead.
tick_period_ms: 300

View File

@@ -107,8 +107,9 @@ mod tests {
}
let expected_blocks = num_vectors as usize / indexing_threshold * 2;
eprintln!("blocks.len() = {:#?}", blocks.len());
assert!(
(blocks.len() as i64 - expected_blocks as i64).abs() < 3,
(blocks.len() as i64 - expected_blocks as i64).abs() <= 3,
"real number of payload blocks is too far from expected"
);

View File

@@ -82,13 +82,13 @@ impl Persistent {
) -> Result<Self, StorageError> {
let path = storage_path.as_ref().join(STATE_FILE_NAME);
let state = if path.exists() {
log::info!("Loading raft state from {}", path.display());
log::debug!("Loading raft state from {}", path.display());
Self::load(path)?
} else {
log::info!("Initializing new raft state at {}", path.display());
log::debug!("Initializing new raft state at {}", path.display());
Self::init(path, first_peer)?
};
log::info!("State: {:?}", state.state());
log::debug!("State: {:?}", state.state());
Ok(state)
}

View File

@@ -76,9 +76,9 @@ impl Consensus {
)?;
} else {
if bootstrap_peer.is_some() || uri.is_some() {
log::warn!("Local raft state found - bootstrap and uri cli arguments were ignored")
log::info!("Local raft state found - bootstrap and uri cli arguments were ignored")
}
log::info!("Local raft state found - skipping initialization");
log::debug!("Local raft state found - skipping initialization");
};
let mut node = Node::new(&raft_config, toc_ref.clone(), logger)?;
// Before consensus has started apply any unapplied committed entries