Struct persist::storage::LockInfo [−][src]
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.
Fields
reentrance_id: String
details: String
Implementations
Returns a new LockInfo from its component parts.
Errors if reentrance_id contains a newline.
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
Auto Trait Implementations
impl RefUnwindSafe for LockInfo
impl UnwindSafe for LockInfo
Blanket Implementations
Mutably borrows from an owned value. Read more
Formats an object with the “alternative” format ({:#}
) and returns it.
Compare self to key
and return true
if they are equal.
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more