org.apache.hadoop.hdfs.server.namenode
Class LeaseManager

java.lang.Object
  extended by org.apache.hadoop.hdfs.server.namenode.LeaseManager

@InterfaceAudience.Private
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


Field Summary
static org.apache.commons.logging.Log LOG
           
 
Method Summary
 int countLease()
           
 org.apache.hadoop.hdfs.server.namenode.LeaseManager.Lease getLeaseByPath(String src)
           
 void setLeasePeriod(long softLimit, long hardLimit)
           
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
Method Detail

getLeaseByPath

public org.apache.hadoop.hdfs.server.namenode.LeaseManager.Lease getLeaseByPath(String src)
Returns:
the lease containing src

countLease

public int countLease()
Returns:
the number of leases currently in the system

setLeasePeriod

public void setLeasePeriod(long softLimit,
                           long hardLimit)

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2009 The Apache Software Foundation