You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2011/03/08 05:38:20 UTC

svn commit: r1079134 - in /hadoop/common/branches/yahoo-merge: CHANGES.txt src/java/org/apache/hadoop/fs/BlockLocation.java

Author: omalley
Date: Tue Mar  8 04:38:19 2011
New Revision: 1079134

URL: http://svn.apache.org/viewvc?rev=1079134&view=rev
Log:
commit 8cd52ca083d83a7ea14fc899a9c1c2d2cde15e14
Author: Hairong Kuang <ha...@apache.org>
Date:   Wed Nov 17 05:29:00 2010 +0000

    HADOOP-7013. Add boolean field isCorrupt to BlockLocation. Contributed by Patrick Kling.
    
    
    git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1035923 13f79535-47bb-0310-9956-ffa450edef68

Modified:
    hadoop/common/branches/yahoo-merge/CHANGES.txt
    hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/BlockLocation.java

Modified: hadoop/common/branches/yahoo-merge/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/yahoo-merge/CHANGES.txt?rev=1079134&r1=1079133&r2=1079134&view=diff
==============================================================================
--- hadoop/common/branches/yahoo-merge/CHANGES.txt (original)
+++ hadoop/common/branches/yahoo-merge/CHANGES.txt Tue Mar  8 04:38:19 2011
@@ -43,6 +43,9 @@ Trunk (unreleased changes)
     HADOOP-6854. Options.createOpts should provide API to access Progress.
     (Krishna Ramachandran via jitendra)
 
+    HADOOP-7013. Add boolean field isCorrupt to BlockLocation. 
+    (Patrick Kling via hairong)
+
   IMPROVEMENTS
 
     HADOOP-6644. util.Shell getGROUPS_FOR_USER_COMMAND method name 

Modified: hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/BlockLocation.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/BlockLocation.java?rev=1079134&r1=1079133&r2=1079134&view=diff
==============================================================================
--- hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/BlockLocation.java (original)
+++ hadoop/common/branches/yahoo-merge/src/java/org/apache/hadoop/fs/BlockLocation.java Tue Mar  8 04:38:19 2011
@@ -50,6 +50,7 @@ public class BlockLocation implements Wr
   private String[] topologyPaths; // full path name in network topology
   private long offset;  //offset of the of the block in the file
   private long length;
+  private boolean corrupt;
 
   /**
    * Default Constructor
@@ -63,6 +64,14 @@ public class BlockLocation implements Wr
    */
   public BlockLocation(String[] names, String[] hosts, long offset, 
                        long length) {
+    this(names, hosts, offset, length, false);
+  }
+
+  /**
+   * Constructor with host, name, offset, length and corrupt flag
+   */
+  public BlockLocation(String[] names, String[] hosts, long offset, 
+                       long length, boolean corrupt) {
     if (names == null) {
       this.names = new String[0];
     } else {
@@ -76,6 +85,7 @@ public class BlockLocation implements Wr
     this.offset = offset;
     this.length = length;
     this.topologyPaths = new String[0];
+    this.corrupt = corrupt;
   }
 
   /**
@@ -83,7 +93,16 @@ public class BlockLocation implements Wr
    */
   public BlockLocation(String[] names, String[] hosts, String[] topologyPaths,
                        long offset, long length) {
-    this(names, hosts, offset, length);
+    this(names, hosts, topologyPaths, offset, length, false);
+  }
+
+  /**
+   * Constructor with host, name, network topology, offset, length 
+   * and corrupt flag
+   */
+  public BlockLocation(String[] names, String[] hosts, String[] topologyPaths,
+                       long offset, long length, boolean corrupt) {
+    this(names, hosts, offset, length, corrupt);
     if (topologyPaths == null) {
       this.topologyPaths = new String[0];
     } else {
@@ -138,7 +157,14 @@ public class BlockLocation implements Wr
   public long getLength() {
     return length;
   }
-  
+
+  /**
+   * Get the corrupt flag.
+   */
+  public boolean isCorrupt() {
+    return corrupt;
+  }
+
   /**
    * Set the start offset of file associated with this block
    */
@@ -154,6 +180,13 @@ public class BlockLocation implements Wr
   }
 
   /**
+   * Set the corrupt flag.
+   */
+  public void setCorrupt(boolean corrupt) {
+    this.corrupt = corrupt;
+  }
+
+  /**
    * Set the hosts hosting this block
    */
   public void setHosts(String[] hosts) throws IOException {
@@ -192,6 +225,7 @@ public class BlockLocation implements Wr
   public void write(DataOutput out) throws IOException {
     out.writeLong(offset);
     out.writeLong(length);
+    out.writeBoolean(corrupt);
     out.writeInt(names.length);
     for (int i=0; i < names.length; i++) {
       Text name = new Text(names[i]);
@@ -215,6 +249,7 @@ public class BlockLocation implements Wr
   public void readFields(DataInput in) throws IOException {
     this.offset = in.readLong();
     this.length = in.readLong();
+    this.corrupt = in.readBoolean();
     int numNames = in.readInt();
     this.names = new String[numNames];
     for (int i = 0; i < numNames; i++) {
@@ -245,6 +280,9 @@ public class BlockLocation implements Wr
     result.append(offset);
     result.append(',');
     result.append(length);
+    if (corrupt) {
+      result.append("(corrupt)");
+    }
     for(String h: hosts) {
       result.append(',');
       result.append(h);