Class SchemaLockHandle
The lock that serializes the schema work of processes starting against one database: creating the schema,
deploying the SQL module, building the indexes of the streams form, upgrading a SQLite file, synchronizing the
schemes. Two nodes of a cluster that met an old database used to run the same upgrade at once, and the second
failed on what the first had just created ("index already exists", "tuple concurrently updated").
A provider hands one per database: a server-side named lock on a connection of its own (PostgreSQL advisory
lock, SQL Server application lock) or the single write lock of the file (SQLite). The attempt never blocks,
so the wait, its log and its time-out live once, in . Disposing releases the lock
when it was taken and frees the connection.
public abstract class SchemaLockHandle : IAsyncDisposable
Inheritance
Implements
Properties
Name
What the lock is called on the server, for the log of a waiting node.
public abstract string Name { get; }
None
A lock that is always granted: for a context the provider cannot lock (a custom one).
public static SchemaLockHandle None { get; }
Methods
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public abstract ValueTask DisposeAsync()
TryAcquireAsync(CancellationToken)
One attempt to take the lock: true when it is now held, false when another process holds it.
public abstract Task<bool> TryAcquireAsync(CancellationToken cancellationToken)