Struct mz_persist::location::LockInfo
source · [−]pub struct LockInfo { /* private fields */ }
Expand description
The partially structured information stored in an exclusive-writer lock.
To allow for restart without operator intervention in situations where we’ve crashed and are unable to cleanly unlock (s3 has no flock equivalent, for example), this supports reentrance. We define the “same” process as any that have the same reentrance id, which is an opaque user-provided string.
This, in essence, delegates the problem of ensuring writer-exclusivity to the persist user, which may have access to better (possibly distributed) locking primitives than we do.
Concretely, MZ Cloud will initially depend on the exclusivity of attaching an EBS volume. We’ll store the reentrant_id somewhere on the EBS volume that holds the catalog. Any process that starts and has access to this volume is guaranteed that the previous machine is no longer available and thus the previous mz process is no longer running. Similarly, a second process cannot accidentally start up pointed at the same storage locations because it will not have the reentrant_id available.
Violating writer-exclusivity will cause undefined behavior including data loss. It’s always correct, and MUCH safer, to provide a random reentrant_id here (e.g. a UUID). It will simply require operator intervention to verify that the previous process is no longer running in the event of a crash and to confirm this by manually removing the previous lock.
Implementations
sourceimpl LockInfo
impl LockInfo
sourcepub fn new(reentrance_id: String, details: String) -> Result<Self, Error>
pub fn new(reentrance_id: String, details: String) -> Result<Self, Error>
Returns a new LockInfo from its component parts.
Errors if reentrance_id contains a newline.
sourcepub fn new_no_reentrance(details: String) -> Self
pub fn new_no_reentrance(details: String) -> Self
Constructs a new, empty LockInfo with a unique reentrance id.
Helper for tests that don’t care about locking reentrance (which is most of them).
Trait Implementations
impl Eq for LockInfo
impl StructuralEq for LockInfo
impl StructuralPartialEq for LockInfo
Auto Trait Implementations
impl RefUnwindSafe for LockInfo
impl Send for LockInfo
impl Sync for LockInfo
impl Unpin for LockInfo
impl UnwindSafe for LockInfo
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> DisplayExt for T where
T: Display,
impl<T> DisplayExt for T where
T: Display,
sourcefn to_string_alt(&self) -> String
fn to_string_alt(&self) -> String
Formats an object with the “alternative” format ({:#}
) and returns it.
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> FutureExt for T
impl<T> FutureExt for T
sourcefn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
sourcefn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message T
in a tonic::Request
sourceimpl<T> ProgressEventTimestamp for T where
T: Data + Debug + Any,
impl<T> ProgressEventTimestamp for T where
T: Data + Debug + Any,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more