public class LeaseManager
extends Object
LeaseManager does the lease housekeeping for writing on files.
This class also provides useful static methods for lease recovery.
Lease Recovery Algorithm
1) Namenode retrieves lease information
2) For each file f in the lease, consider the last block b of f
2.1) Get the datanodes which contains b
2.2) Assign one of the datanodes as the primary datanode p
2.3) p obtains a new generation stamp form the namenode
2.4) p get the block info from each datanode
2.5) p computes the minimum block length
2.6) p updates the datanodes, which have a valid generation stamp,
with the new generation stamp and the minimum block length
2.7) p acknowledges the namenode the update results
2.8) Namenode updates the BlockInfo
2.9) Namenode removes f from the lease
and removes the lease once all files have been removed
2.10) Namenode commit changes to edit log