hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jiten...@apache.org
Subject svn commit: r1076874 - in /hadoop/hdfs/branches/HDFS-1052: CHANGES.txt src/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceScanner.java src/java/org/apache/hadoop/hdfs/server/datanode/DataBlockScanner.java
Date Thu, 03 Mar 2011 23:10:13 GMT
Author: jitendra
Date: Thu Mar  3 23:10:13 2011
New Revision: 1076874

URL: http://svn.apache.org/viewvc?rev=1076874&view=rev
Log:
Federation: Prevent DataBlockScanner from running in tight loop.

Modified:
    hadoop/hdfs/branches/HDFS-1052/CHANGES.txt
    hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceScanner.java
    hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataBlockScanner.java

Modified: hadoop/hdfs/branches/HDFS-1052/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/CHANGES.txt?rev=1076874&r1=1076873&r2=1076874&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/CHANGES.txt (original)
+++ hadoop/hdfs/branches/HDFS-1052/CHANGES.txt Thu Mar  3 23:10:13 2011
@@ -194,6 +194,9 @@ Trunk (unreleased changes)
     HDFS-1588. Remove hardcoded strings for configuration keys, "dfs.hosts"
     and "dfs.hosts.exlude". (Erik Steffl via suresh)
 
+    HDFS-1713. Federation: Prevent DataBlockScanner from running in tight loop.
+    (jitendra)
+
   OPTIMIZATIONS
 
   BUG FIXES

Modified: hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceScanner.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceScanner.java?rev=1076874&r1=1076873&r2=1076874&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceScanner.java
(original)
+++ hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceScanner.java
Thu Mar  3 23:10:13 2011
@@ -617,7 +617,9 @@ class BlockPoolSliceScanner {
   }
   
   public void scan() {
-    LOG.info("Starting to scan blockpool: " + blockPoolId);
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Starting to scan blockpool: " + blockPoolId);
+    }
     try {
       adjustThrottler();
         
@@ -633,8 +635,10 @@ class BlockPoolSliceScanner {
             || (!(this.isFirstBlockProcessed()))) {
           verifyFirstBlock();
         } else {
-          LOG.info("All remaining blocks were processed recently, "
-              + "so this run is complete");
+          if (LOG.isDebugEnabled()) {
+            LOG.debug("All remaining blocks were processed recently, "
+                + "so this run is complete");
+          }
           break;
         }
       }
@@ -644,7 +648,9 @@ class BlockPoolSliceScanner {
       throw e;
     } finally {
       cleanUp();
-      LOG.info("Done scanning block pool: " + blockPoolId);
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("Done scanning block pool: " + blockPoolId);
+      }
     }
   }
   
@@ -818,8 +824,10 @@ class BlockPoolSliceScanner {
     }
     
     private void roll() throws IOException {
-      LOG.info("Rolling current file: " + curFile.getAbsolutePath()
-          + " to previous file: " + prevFile.getAbsolutePath());
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("Rolling current file: " + curFile.getAbsolutePath()
+            + " to previous file: " + prevFile.getAbsolutePath());
+      }
 
       if (!prevFile.delete() && prevFile.exists()) {
         throw new IOException("Could not delete " + prevFile);

Modified: hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataBlockScanner.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataBlockScanner.java?rev=1076874&r1=1076873&r2=1076874&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataBlockScanner.java
(original)
+++ hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/datanode/DataBlockScanner.java
Thu Mar  3 23:10:13 2011
@@ -64,7 +64,21 @@ public class DataBlockScanner implements
   
   public void run() {
     String currentBpId = "";
+    boolean firstRun = true;
     while (datanode.shouldRun && !Thread.interrupted()) {
+      //Sleep everytime except in the first interation.
+      if (!firstRun) {
+        try {
+          Thread.sleep(5000);
+        } catch (InterruptedException ex) {
+          // Interrupt itself again to set the interrupt status
+          blockScannerThread.interrupt();
+          continue;
+        }
+      } else {
+        firstRun = false;
+      }
+      
       BlockPoolSliceScanner bpScanner = getNextBPScanner(currentBpId);
       if (bpScanner == null) {
         // Possible if thread is interrupted
@@ -79,12 +93,6 @@ public class DataBlockScanner implements
         continue;
       }
       bpScanner.scanBlockPoolSlice();
-      try {
-        Thread.sleep(5000);
-      } catch (InterruptedException ex) {
-        // Interrupt itself again to set the interrupt status
-        blockScannerThread.interrupt();
-      }
     }
   }
 



Mime
View raw message