Skip to content

Commit

Permalink
Fix checker display output
Browse files Browse the repository at this point in the history
Among other small bits and bobs

```
intentionally empty
```
  • Loading branch information
AhmedSoliman committed Feb 8, 2025
1 parent db8b732 commit 9ebcceb
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,18 @@ impl<Attr: Debug> Debug for NodeSetChecker<Attr> {

impl<Attr: Display> Display for NodeSetChecker<Attr> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
use itertools::Position;
write!(f, "[")?;
for (node, attr) in self.node_to_attr.iter() {
write!(f, "{node} => {attr}, ")?;
for (pos, (node_id, attr)) in self
.node_to_attr
.iter()
.sorted_by_key(|v| v.0)
.with_position()
{
match pos {
Position::Only | Position::Last => write!(f, "{node_id}({attr})")?,
Position::First | Position::Middle => write!(f, "{node_id}({attr}), ")?,
}
}
write!(f, "]")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use std::sync::Weak;
use std::time::Duration;

use restate_types::retries::with_jitter;
use tokio::time::Instant;
use tracing::instrument;
use tracing::{debug, trace};
Expand Down Expand Up @@ -89,7 +90,7 @@ impl PeriodicTailChecker {
);
}
}
tokio::time::sleep(duration).await;
tokio::time::sleep(with_jitter(duration, 0.5)).await;
}
}
}
17 changes: 12 additions & 5 deletions crates/types/src/nodes_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0.

use std::collections::HashMap;

use enumset::{EnumSet, EnumSetType};
use serde_with::serde_as;
use xxhash_rust::xxh3::Xxh3DefaultBuilder;

use crate::locality::NodeLocation;
use crate::net::AdvertisedAddress;
use crate::{flexbuffers_storage_encode_decode, GenerationalNodeId, NodeId, PlainNodeId};
use crate::{Version, Versioned};
use ahash::HashMap;

#[derive(Debug, thiserror::Error)]
pub enum NodesConfigError {
Expand Down Expand Up @@ -57,14 +55,15 @@ pub enum Role {
}

#[serde_as]
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
#[derive(derive_more::Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct NodesConfiguration {
version: Version,
cluster_name: String,
// flexbuffers only supports string-keyed maps :-( --> so we store it as vector of kv pairs
#[serde_as(as = "serde_with::Seq<(_, _)>")]
nodes: HashMap<PlainNodeId, MaybeNode>,
name_lookup: HashMap<String, PlainNodeId, Xxh3DefaultBuilder>,
#[debug(skip)]
name_lookup: HashMap<String, PlainNodeId>,
}

impl Default for NodesConfiguration {
Expand Down Expand Up @@ -134,6 +133,14 @@ impl NodesConfiguration {
}
}

pub fn len(&self) -> usize {
self.name_lookup.len()
}

pub fn is_empty(&self) -> bool {
self.name_lookup.is_empty()
}

pub fn cluster_name(&self) -> &str {
&self.cluster_name
}
Expand Down
2 changes: 1 addition & 1 deletion crates/worker/src/partition/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ where
debug!(
last_applied_lsn = %last_applied_lsn,
current_log_tail = %current_tail,
"PartitionProcessor creating log reader",
"Partition creating log reader",
);
if current_tail.offset() == last_applied_lsn.next() {
if self.status.replay_status != ReplayStatus::Active {
Expand Down

0 comments on commit 9ebcceb

Please sign in to comment.