Struct tikv::server::lock_manager::deadlock::Detector [−][src]
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]
S: StoreAddrResolver + 'static,
P: PdClient + 'static,
pub fn new(
store_id: u64,
pd_client: Arc<P>,
resolver: S,
security_mgr: Arc<SecurityManager>,
waiter_mgr_scheduler: WaiterMgrScheduler,
cfg: &Config
) -> Self
[src]
store_id: u64,
pd_client: Arc<P>,
resolver: S,
security_mgr: Arc<SecurityManager>,
waiter_mgr_scheduler: WaiterMgrScheduler,
cfg: &Config
) -> Self
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]
&mut self,
tp: DetectType,
txn_ts: TimeStamp,
lock: Lock,
diag_ctx: DiagnosticContext
) -> bool
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]
&self,
tp: DetectType,
txn_ts: TimeStamp,
lock: Lock,
diag_ctx: DiagnosticContext
)
fn handle_detect(
&mut self,
tp: DetectType,
txn_ts: TimeStamp,
lock: Lock,
diag_ctx: DiagnosticContext
)
[src]
&mut self,
tp: DetectType,
txn_ts: TimeStamp,
lock: Lock,
diag_ctx: DiagnosticContext
)
Handles detect requests of itself.
fn handle_detect_rpc(
&self,
stream: RequestStream<DeadlockRequest>,
sink: DuplexSink<DeadlockResponse>
)
[src]
&self,
stream: RequestStream<DeadlockRequest>,
sink: DuplexSink<DeadlockResponse>
)
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]
S: StoreAddrResolver + 'static,
P: PdClient + 'static,
impl<S, P> Send for Detector<S, P> where
S: StoreAddrResolver + 'static,
P: PdClient + 'static,
[src]
S: StoreAddrResolver + 'static,
P: PdClient + 'static,
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,
S: Unpin,
impl<S, P> !UnwindSafe for Detector<S, P>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<V, W> ConvertFrom<W> for V where
W: ConvertTo<V>,
[src]
W: ConvertTo<V>,
pub fn convert_from(ctx: &mut EvalContext, from: W) -> Result<V, Error>
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
[src]
pub const ALIGN: usize
[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
[src]
pub unsafe fn drop(ptr: usize)
[src]
impl<T> Pointable for T
[src]
pub const ALIGN: usize
[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
[src]
pub unsafe fn drop(ptr: usize)
[src]
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> Sealed<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,