hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sur...@apache.org
Subject svn commit: r1074728 - in /hadoop/hdfs/branches/HDFS-1052: ./ src/java/org/apache/hadoop/hdfs/server/common/ src/java/org/apache/hadoop/hdfs/server/datanode/
Date Fri, 25 Feb 2011 22:44:52 GMT
Author: suresh
Date: Fri Feb 25 22:44:51 2011
New Revision: 1074728

URL: http://svn.apache.org/viewvc?rev=1074728&view=rev
Log:
HDFS-1648. Only DataStorage must be locked using in_use.lock and no locks must be associated
with BlockPoolStorage. Contributed by Tanping Wang.

Modified:
    hadoop/hdfs/branches/HDFS-1052/CHANGES.txt
    hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/common/Storage.java
    hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolStorage.java
    hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java

Modified: hadoop/hdfs/branches/HDFS-1052/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/CHANGES.txt?rev=1074728&r1=1074727&r2=1074728&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/CHANGES.txt (original)
+++ hadoop/hdfs/branches/HDFS-1052/CHANGES.txt Fri Feb 25 22:44:51 2011
@@ -41,6 +41,9 @@ Trunk (unreleased changes)
 
     HDFS-1639. Add block pool management to FSDataset. (suresh)
 
+    HDFS-1648. Only DataStorage must be locked using in_use.lock and no 
+    locks must be associated with BlockPoolStorage. (tanping via suresh)
+
   IMPROVEMENTS
 
     HDFS-1510. Added test-patch.properties required by test-patch.sh (nigel)

Modified: hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/common/Storage.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/common/Storage.java?rev=1074728&r1=1074727&r2=1074728&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/common/Storage.java
(original)
+++ hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/common/Storage.java
Fri Feb 25 22:44:51 2011
@@ -198,19 +198,32 @@ public abstract class Storage extends St
    */
   @InterfaceAudience.Private
   public class StorageDirectory {
-    File              root; // root directory
-    FileLock          lock; // storage lock
-    StorageDirType dirType; // storage dir type
+    final File root;              // root directory
+    final boolean useLock;        // flag to enable storage lock
+    final StorageDirType dirType; // storage dir type
+    FileLock lock;                // storage lock
     
     public StorageDirectory(File dir) {
       // default dirType is null
-      this(dir, null);
+      this(dir, null, true);
     }
     
     public StorageDirectory(File dir, StorageDirType dirType) {
+      this(dir, dirType, true);
+    }
+    
+    /**
+     * Constructor
+     * @param dir directory corresponding to the storage
+     * @param dirType storage directory type
+     * @param useLock true - enables locking on the storage directory and false
+     *          disables locking
+     */
+    public StorageDirectory(File dir, StorageDirType dirType, boolean useLock) {
       this.root = dir;
       this.lock = null;
       this.dirType = dirType;
+      this.useLock = useLock;
     }
     
     /**
@@ -616,6 +629,10 @@ public abstract class Storage extends St
      * @throws IOException if locking fails
      */
     public void lock() throws IOException {
+      if (!useLock) {
+        LOG.info("Locking is disabled");
+        return;
+      }
       this.lock = tryLock();
       if (lock == null) {
         String msg = "Cannot lock storage " + this.root 

Modified: hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolStorage.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolStorage.java?rev=1074728&r1=1074727&r2=1074728&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolStorage.java
(original)
+++ hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolStorage.java
Fri Feb 25 22:44:51 2011
@@ -94,7 +94,7 @@ public class BlockPoolStorage extends St
         dataDirs.size());
     for (Iterator<File> it = dataDirs.iterator(); it.hasNext();) {
       File dataDir = it.next();
-      StorageDirectory sd = new StorageDirectory(dataDir);
+      StorageDirectory sd = new StorageDirectory(dataDir, null, false);
       StorageState curState;
       try {
         curState = sd.analyzeStorage(startOpt);

Modified: hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java?rev=1074728&r1=1074727&r2=1074728&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
(original)
+++ hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java
Fri Feb 25 22:44:51 2011
@@ -911,13 +911,6 @@ public class DataNode extends Configured
         register();
       } catch (IOException ioe) {
         LOG.error(bpRegistration + ": Setup failed", ioe);
-        try {
-          // TODO:FEDERATION needs to unlock only this specific storage...
-          // and remove it....
-          storage.unlockAll(); 
-        } catch (Exception e) { 
-          LOG.warn("failed to unlock storage for dn: " + bpRegistration, e);
-        }
         // TODO:FEDERATION should be local only
         //shutdown();
         return;



Mime
View raw message