Details
-
Sub-task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Implement the FGL lock for the FSNamesystemLock.
We will use two global locks to implement this FGL lock in this milestone, FSLock and BMLock.
The FSLock is used to protect some operations:
- Directory tree-related operations.
- FSEditLog related operations.
- ErasureCodingPolicy related operations.
The BMLock is used to protect some operations:
- Block related operations
- DN related operations
Both FSLock and BMLock are needed for some operations:
- The operations involves both directory tree and block
- The operations involves both directory tree and dn
- The operations involves both FSEdits and block
The lock order should be:
- Acquire the FSLock
- Acquire the BMLock
- Release the BMLock
- Release the FSLock
This FGL class implements the FSNamesystemLock interface, and it will acquire/release the locks according to the LockMode(GLOBAL, FS, BM).
Locking process:
- For the GLOBAL Lock mode, this FGL will acquire the FS lock first, then acquire the BM lock
- For the FS Lock mode, this FGL will only acquire the FS lock
- For the BM Lock mode, this FGL will only acquire the BM lock.
Lock releasing process:
- For the GLOBAL Lock mode, this FGL will release the BM lock first, then release the lock
- For the FS Lock mode, this FGL will only release the FS lock
- For the BM Lock mode, this FGL will only release the BM lock.
Attachments
Issue Links
- links to