hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rang...@apache.org
Subject svn commit: r700926 - in /hadoop/core/branches/branch-0.18: CHANGES.txt src/test/org/apache/hadoop/dfs/SimulatedFSDataset.java src/test/org/apache/hadoop/dfs/TestReplication.java
Date Wed, 01 Oct 2008 21:09:39 GMT
Author: rangadi
Date: Wed Oct  1 14:09:39 2008
New Revision: 700926

URL: http://svn.apache.org/viewvc?rev=700926&view=rev
Log:
HADOOP-4314. Simulated datanodes should not include blocks that are still
being written in their block report. (Raghu Angadi)

Modified:
    hadoop/core/branches/branch-0.18/CHANGES.txt   (contents, props changed)
    hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/SimulatedFSDataset.java
    hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestReplication.java

Modified: hadoop/core/branches/branch-0.18/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/CHANGES.txt?rev=700926&r1=700925&r2=700926&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/CHANGES.txt (original)
+++ hadoop/core/branches/branch-0.18/CHANGES.txt Wed Oct  1 14:09:39 2008
@@ -14,6 +14,9 @@
     HADOOP-2421.  Add jdiff output to documentation, listing all API
     changes from the prior release.  (cutting)
 
+    HADOOP-4314. Simulated datanodes should not include blocks that are still
+    being written in their block report. (Raghu Angadi)
+
 Release 0.18.1 - 2008-09-17
 
   IMPROVEMENTS

Propchange: hadoop/core/branches/branch-0.18/CHANGES.txt
------------------------------------------------------------------------------
    svn:mergeinfo = /hadoop/core/trunk/CHANGES.txt:699517,700163,700923

Modified: hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/SimulatedFSDataset.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/SimulatedFSDataset.java?rev=700926&r1=700925&r2=700926&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/SimulatedFSDataset.java
(original)
+++ hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/SimulatedFSDataset.java
Wed Oct  1 14:09:39 2008
@@ -20,6 +20,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Random;
 
@@ -274,9 +275,14 @@
 
   public synchronized Block[] getBlockReport() {
     Block[] blockTable = new Block[blockMap.size()];
-    int i = 0;
-    for (Block b: blockMap.keySet()) {  
-      blockTable[i++] = blockMap.get(b).theBlock;
+    int count = 0;
+    for (BInfo b : blockMap.values()) {
+      if (b.isFinalized()) {
+        blockTable[count++] = b.theBlock;
+      }
+    }
+    if (count != blockTable.length) {
+      blockTable = Arrays.copyOf(blockTable, count);
     }
     return blockTable;
   }

Modified: hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestReplication.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestReplication.java?rev=700926&r1=700925&r2=700926&view=diff
==============================================================================
--- hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestReplication.java (original)
+++ hadoop/core/branches/branch-0.18/src/test/org/apache/hadoop/dfs/TestReplication.java Wed
Oct  1 14:09:39 2008
@@ -30,8 +30,6 @@
 import org.apache.hadoop.fs.FSDataOutputStream;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.ipc.RPC;
-import org.apache.hadoop.net.NetUtils;
 
 /**
  * This class tests the replication of a DFS file.
@@ -66,27 +64,11 @@
     Configuration conf = fileSys.getConf();
     ClientProtocol namenode = DFSClient.createNamenode(conf);
       
-    LocatedBlocks locations;
-    boolean isReplicationDone;
-    do {
-      locations = namenode.getBlockLocations(name.toString(),0,Long.MAX_VALUE);
-      isReplicationDone = true;
-      for (LocatedBlock blk : locations.getLocatedBlocks()) {
-        DatanodeInfo[] datanodes = blk.getLocations();
-        if (Math.min(numDatanodes, repl) != datanodes.length) {
-          isReplicationDone=false;
-          LOG.warn("File has "+datanodes.length+" replicas, expecting "
-                   +Math.min(numDatanodes, repl));
-          try {
-            Thread.sleep(15000L);
-          } catch (InterruptedException e) {
-            // nothing
-          }
-          break;
-        }
-      }
-    } while(!isReplicationDone);
-      
+    waitForBlockReplication(name.toString(), namenode, 
+                            Math.min(numDatanodes, repl), -1);
+    
+    LocatedBlocks locations = namenode.getBlockLocations(name.toString(),0,
+                                                         Long.MAX_VALUE);
     boolean isOnSameRack = true, isNotOnSameRack = true;
     for (LocatedBlock blk : locations.getLocatedBlocks()) {
       DatanodeInfo[] datanodes = blk.getLocations();



Mime
View raw message