LOCK CLUSTER WITH
Description
The LOCK CLUSTER WITH syntax is utilized to apply a lock with a specific algorithm to the CLUSTER.
Syntax
LockClusterWith ::=
'LOCK' 'CLUSTER' 'WITH' lockStrategy ('TIMEOUT' timeoutMillis)?
timeoutMillis ::=
longSupplement
- When the
CLUSTERis already locked, it is impossible to re-lock it, otherwise an exception will be thrown. - Currently, the
lockStrategysupports two lock strategies, namely the exclusive lockWRITEand the read-write lockREAD_WRITE. - The
timeoutMillisis used to indicate the timeout period for attempting to acquire the lock, with the unit being milliseconds. When not specified, the default value is 3,000 milliseconds.
Example
- Lock the
CLUSTERwith an exclusive lock without setting the timeout.
LOCK CLUSTER WITH WRITE;- Lock the CLUSTER with a read-write lock and set the timeout to 2000 milliseconds.
LOCK CLUSTER WITH READ_WRITE TIMEOUT 2000;Reserved word
LOCK,CLUSTER,WITH