Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve ReplicaSetQuorumMode debugging #94

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/libs/core/src/runtime/stateful.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use mssf_com::FabricRuntime::IFabricStatefulServicePartition;
use crate::sync::CancellationToken;
use crate::types::{LoadMetric, LoadMetricListRef, ReplicaRole};

use crate::types::{Epoch, OpenMode, ReplicaInformation, ReplicaSetConfig, ReplicaSetQuarumMode};
use crate::types::{Epoch, OpenMode, ReplicaInformation, ReplicaSetConfig, ReplicaSetQuorumMode};

/// Represents a stateful service factory that is responsible for creating replicas
/// of a specific type of stateful service. Stateful service factories are registered with
Expand Down Expand Up @@ -135,7 +135,7 @@ pub trait LocalPrimaryReplicator: Replicator {
) -> crate::Result<()>;
async fn wait_for_catch_up_quorum(
&self,
catchupmode: ReplicaSetQuarumMode,
catchupmode: ReplicaSetQuorumMode,
cancellation_token: CancellationToken,
) -> crate::Result<()>;
fn update_current_replica_set_configuration(
Expand Down
7 changes: 3 additions & 4 deletions crates/libs/core/src/runtime/stateful_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,16 +429,15 @@ where
catchupmode: FABRIC_REPLICA_SET_QUORUM_MODE,
callback: ::core::option::Option<&super::IFabricAsyncOperationCallback>,
) -> crate::Result<super::IFabricAsyncOperationContext> {
let catchupmode = catchupmode.into();
info!(
"IFabricPrimaryReplicatorBridge::BeginWaitForCatchUpQuorum: mode {:?}",
catchupmode
);
let inner = self.inner.clone();
let (ctx, token) = BridgeContext3::make(callback);
ctx.spawn(&self.rt, async move {
inner
.wait_for_catch_up_quorum(catchupmode.into(), token)
.await
inner.wait_for_catch_up_quorum(catchupmode, token).await
})
}

Expand Down Expand Up @@ -488,7 +487,7 @@ where
}

fn RemoveReplica(&self, replicaid: i64) -> crate::Result<()> {
info!("IFabricPrimaryReplicatorBridge::RemoveReplica");
info!("IFabricPrimaryReplicatorBridge::RemoveReplica: replicaid {replicaid}");
self.inner.remove_replica(replicaid)
}
}
Expand Down
6 changes: 3 additions & 3 deletions crates/libs/core/src/runtime/stateful_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::{
use super::stateful::{
PrimaryReplicator, Replicator, StatefulServicePartition, StatefulServiceReplica,
};
use crate::types::{Epoch, OpenMode, ReplicaInformation, ReplicaSetConfig, ReplicaSetQuarumMode};
use crate::types::{Epoch, OpenMode, ReplicaInformation, ReplicaSetConfig, ReplicaSetQuorumMode};

pub struct StatefulServiceReplicaProxy {
com_impl: IFabricStatefulServiceReplica,
Expand Down Expand Up @@ -259,10 +259,10 @@ impl PrimaryReplicator for PrimaryReplicatorProxy {
}
async fn wait_for_catch_up_quorum(
&self,
catchupmode: ReplicaSetQuarumMode,
catchupmode: ReplicaSetQuorumMode,
cancellation_token: CancellationToken,
) -> crate::Result<()> {
info!("PrimaryReplicatorProxy::wait_for_catch_up_quorum");
info!("PrimaryReplicatorProxy::wait_for_catch_up_quorum: catchupmode {catchupmode:?}");
let com1 = &self.com_impl;
let com2 = self.com_impl.clone();
let rx = fabric_begin_end_proxy2(
Expand Down
23 changes: 12 additions & 11 deletions crates/libs/core/src/types/runtime/stateful.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,29 +259,30 @@ impl ReplicaInformation {
}

// FABRIC_REPLICA_SET_QUORUM_MODE
pub enum ReplicaSetQuarumMode {
#[derive(Debug, Clone, PartialEq)]
pub enum ReplicaSetQuorumMode {
All,
Invalid,
Write,
}

impl From<FABRIC_REPLICA_SET_QUORUM_MODE> for ReplicaSetQuarumMode {
impl From<FABRIC_REPLICA_SET_QUORUM_MODE> for ReplicaSetQuorumMode {
fn from(r: FABRIC_REPLICA_SET_QUORUM_MODE) -> Self {
match r {
FABRIC_REPLICA_SET_QUORUM_ALL => ReplicaSetQuarumMode::All,
FABRIC_REPLICA_SET_QUORUM_INVALID => ReplicaSetQuarumMode::Invalid,
FABRIC_REPLICA_SET_WRITE_QUORUM => ReplicaSetQuarumMode::Write,
_ => ReplicaSetQuarumMode::Invalid,
FABRIC_REPLICA_SET_QUORUM_ALL => ReplicaSetQuorumMode::All,
FABRIC_REPLICA_SET_QUORUM_INVALID => ReplicaSetQuorumMode::Invalid,
FABRIC_REPLICA_SET_WRITE_QUORUM => ReplicaSetQuorumMode::Write,
_ => ReplicaSetQuorumMode::Invalid,
}
}
}

impl From<ReplicaSetQuarumMode> for FABRIC_REPLICA_SET_QUORUM_MODE {
fn from(val: ReplicaSetQuarumMode) -> Self {
impl From<ReplicaSetQuorumMode> for FABRIC_REPLICA_SET_QUORUM_MODE {
fn from(val: ReplicaSetQuorumMode) -> Self {
match val {
ReplicaSetQuarumMode::All => FABRIC_REPLICA_SET_QUORUM_ALL,
ReplicaSetQuarumMode::Invalid => FABRIC_REPLICA_SET_QUORUM_INVALID,
ReplicaSetQuarumMode::Write => FABRIC_REPLICA_SET_WRITE_QUORUM,
ReplicaSetQuorumMode::All => FABRIC_REPLICA_SET_QUORUM_ALL,
ReplicaSetQuorumMode::Invalid => FABRIC_REPLICA_SET_QUORUM_INVALID,
ReplicaSetQuorumMode::Write => FABRIC_REPLICA_SET_WRITE_QUORUM,
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/samples/echomain-stateful2/src/statefulstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use mssf_core::{
},
},
types::{
Epoch, OpenMode, ReplicaInformation, ReplicaRole, ReplicaSetConfig, ReplicaSetQuarumMode,
Epoch, OpenMode, ReplicaInformation, ReplicaRole, ReplicaSetConfig, ReplicaSetQuorumMode,
},
};
use mssf_core::{Error, HSTRING};
Expand Down Expand Up @@ -122,7 +122,7 @@ impl PrimaryReplicator for AppFabricReplicator {

async fn wait_for_catch_up_quorum(
&self,
_catchupmode: ReplicaSetQuarumMode,
_catchupmode: ReplicaSetQuorumMode,
_: CancellationToken,
) -> mssf_core::Result<()> {
info!("AppFabricReplicator2::PrimaryReplicator::wait_for_catch_up_quorum");
Expand Down
Loading