Struct tikv::server::lock_manager::deadlock::Detector[][src]

pub struct Detector<S, P> where
    S: StoreAddrResolver + 'static,
    P: PdClient + 'static, 
{ store_id: u64, env: Arc<Environment>, leader_info: Option<(u64, String)>, leader_client: Option<Client>, pd_client: Arc<P>, resolver: S, security_mgr: Arc<SecurityManager>, waiter_mgr_scheduler: WaiterMgrScheduler, inner: Rc<RefCell<Inner>>, }

Detector is used to detect deadlocks between transactions. There is a leader in the cluster which collects all wait_for_entry from other followers.

Fields

store_id: u64

The store id of the node.

env: Arc<Environment>

Used to create clients to the leader.

leader_info: Option<(u64, String)>

The leader’s id and address if exists.

leader_client: Option<Client>

The connection to the leader.

pd_client: Arc<P>

Used to get the leader of leader region from PD.

resolver: S

Used to resolve store address.

security_mgr: Arc<SecurityManager>

Used to connect other nodes.

waiter_mgr_scheduler: WaiterMgrScheduler

Used to schedule Deadlock msgs to the waiter manager.

inner: Rc<RefCell<Inner>>

Implementations

impl<S, P> Detector<S, P> where
    S: StoreAddrResolver + 'static,
    P: PdClient + 'static, 
[src]

pub fn new(
    store_id: u64,
    pd_client: Arc<P>,
    resolver: S,
    security_mgr: Arc<SecurityManager>,
    waiter_mgr_scheduler: WaiterMgrScheduler,
    cfg: &Config
) -> Self
[src]

fn is_leader(&self) -> bool[src]

Returns true if it is the leader of the deadlock detector.

fn reset(&mut self, role: Role)[src]

Resets to the initial state.

fn refresh_leader_info(&mut self) -> bool[src]

Refreshes the leader info. Returns true if the leader exists.

fn get_leader_info(&self) -> Result<Option<(u64, String)>>[src]

Gets leader info from PD.

fn resolve_store_address(&self, store_id: u64) -> Result<String>[src]

Resolves store address.

fn update_leader_info(&mut self, leader_id: u64, leader_addr: String)[src]

Updates the leader info.

fn change_role(&mut self, role: Role)[src]

Resets state if role changes.

fn reconnect_leader(&mut self)[src]

Reconnects the leader. The leader info must exist.

fn send_request_to_leader(
    &mut self,
    tp: DetectType,
    txn_ts: TimeStamp,
    lock: Lock,
    diag_ctx: DiagnosticContext
) -> bool
[src]

Returns true if sends successfully.

If the client is None, reconnects the leader first, then sends the request to the leader. If sends failed, sets the client to None for retry.

fn handle_detect_locally(
    &self,
    tp: DetectType,
    txn_ts: TimeStamp,
    lock: Lock,
    diag_ctx: DiagnosticContext
)
[src]

fn handle_detect(
    &mut self,
    tp: DetectType,
    txn_ts: TimeStamp,
    lock: Lock,
    diag_ctx: DiagnosticContext
)
[src]

Handles detect requests of itself.

fn handle_detect_rpc(
    &self,
    stream: RequestStream<DeadlockRequest>,
    sink: DuplexSink<DeadlockResponse>
)
[src]

Handles detect requests of other nodes.

fn handle_change_role(&mut self, role: Role)[src]

fn handle_change_ttl(&mut self, ttl: Duration)[src]

Trait Implementations

impl<S, P> Runnable<Task> for Detector<S, P> where
    S: StoreAddrResolver + 'static,
    P: PdClient + 'static, 
[src]

impl<S, P> Send for Detector<S, P> where
    S: StoreAddrResolver + 'static,
    P: PdClient + 'static, 
[src]

Auto Trait Implementations

impl<S, P> !RefUnwindSafe for Detector<S, P>

impl<S, P> !Sync for Detector<S, P>

impl<S, P> Unpin for Detector<S, P> where
    S: Unpin

impl<S, P> !UnwindSafe for Detector<S, P>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<V, W> ConvertFrom<W> for V where
    W: ConvertTo<V>, 
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> Sealed<T> for T where
    T: ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]