LOCK BUCKETS
Description
Bucket-based lock.
Precautions
- It can be called only during hash bucket scaling out.
- LOCK BUCKETS is useless outside a transaction block: the lock would remain held only to the completion of the statement. If LOCK BUCKETS is out of any transaction block, an error is reported.
Syntax
1
|
LOCK BUCKETS (bucketlist) IN {ACCESS SHARE|ACCESS EXCLUSIVE} MODE [CANCELABLE]; |
Parameters
Parameters of LOCK BUCKETS are as follows:
- bucketlist
Specifies the list of buckets to be locked.
Value range: For each bucket, the value range is [0,1023].
- ACCESS SHARE
Allows only read operations on a bucket.
- ACCESS EXCLUSIVE
Guarantees that the holder is the only transaction accessing the bucket in any way.
- CANCELABLE
Allows the waiting thread to send CANCEL signals to the holding threads and waiting threads.
Examples
1 2 3 4 5 |
gaussdb=# START TRANSACTION; gaussdb=# LOCK BUCKETS (0,1,2,3) IN ACCESS EXCLUSIVE MODE; gaussdb=# COMMIT; |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.