hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject hadoop git commit: HDFS-9132. Pass genstamp to ReplicaAccessorBuilder. (Colin Patrick McCabe via Lei (Eddy) Xu)
Date Fri, 25 Sep 2015 22:51:47 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 878504dca -> 5eb237d54


HDFS-9132. Pass genstamp to ReplicaAccessorBuilder. (Colin Patrick McCabe via Lei (Eddy) Xu)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/5eb237d5
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/5eb237d5
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/5eb237d5

Branch: refs/heads/trunk
Commit: 5eb237d544fc8eeea85ac4bd4f7500edd49c8727
Parents: 878504d
Author: Lei Xu <lei@apache.org>
Authored: Fri Sep 25 15:50:19 2015 -0700
Committer: Lei Xu <lei@apache.org>
Committed: Fri Sep 25 15:50:19 2015 -0700

----------------------------------------------------------------------
 .../apache/hadoop/hdfs/ReplicaAccessorBuilder.java   |  3 +++
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt          |  3 +++
 .../org/apache/hadoop/hdfs/BlockReaderFactory.java   |  1 +
 .../apache/hadoop/hdfs/TestExternalBlockReader.java  | 15 +++++++++++++++
 4 files changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/5eb237d5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ReplicaAccessorBuilder.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ReplicaAccessorBuilder.java
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ReplicaAccessorBuilder.java
index 2905df1..14651f4 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ReplicaAccessorBuilder.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ReplicaAccessorBuilder.java
@@ -36,6 +36,9 @@ public abstract class ReplicaAccessorBuilder {
   public abstract ReplicaAccessorBuilder
       setBlock(long blockId, String blockPoolId);
 
+  /** Set the genstamp of the block which is being opened. */
+  public abstract ReplicaAccessorBuilder setGenerationStamp(long genstamp);
+
   /**
    * Set whether checksums must be verified.  Checksums should be skipped if
    * the user has disabled checksum verification in the configuration.  Users

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5eb237d5/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index cb3b975..218f155 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -968,6 +968,9 @@ Release 2.8.0 - UNRELEASED
     HDFS-9112. Improve error message for Haadmin when multiple name service IDs
     are configured. (Anu Engineer via jing9)
 
+    HDFS-9132. Pass genstamp to ReplicaAccessorBuilder. (Colin Patrick McCabe via
+    Lei (Eddy) Xu)
+
   OPTIMIZATIONS
 
     HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5eb237d5/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/BlockReaderFactory.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/BlockReaderFactory.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/BlockReaderFactory.java
index b21261a..c9add53 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/BlockReaderFactory.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/BlockReaderFactory.java
@@ -383,6 +383,7 @@ public class BlockReaderFactory implements ShortCircuitReplicaCreator
{
         ReplicaAccessor accessor = builder.
             setAllowShortCircuitReads(allowShortCircuitLocalReads).
             setBlock(block.getBlockId(), block.getBlockPoolId()).
+            setGenerationStamp(block.getGenerationStamp()).
             setBlockAccessToken(tokenBytes).
             setClientName(clientName).
             setConfiguration(configuration).

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5eb237d5/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestExternalBlockReader.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestExternalBlockReader.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestExternalBlockReader.java
index 48d337b..3a0e8e6 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestExternalBlockReader.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestExternalBlockReader.java
@@ -81,6 +81,7 @@ public class TestExternalBlockReader {
     String fileName;
     long blockId;
     String blockPoolId;
+    long genstamp;
     boolean verifyChecksum;
     String clientName;
     boolean allowShortCircuit;
@@ -101,6 +102,12 @@ public class TestExternalBlockReader {
     }
 
     @Override
+    public ReplicaAccessorBuilder setGenerationStamp(long genstamp) {
+      this.genstamp = genstamp;
+      return this;
+    }
+
+    @Override
     public ReplicaAccessorBuilder setVerifyChecksum(boolean verifyChecksum) {
       this.verifyChecksum = verifyChecksum;
       return this;
@@ -154,12 +161,14 @@ public class TestExternalBlockReader {
     int numCloses = 0;
     String error = "";
     String prefix = "";
+    final long genstamp;
 
     SyntheticReplicaAccessor(SyntheticReplicaAccessorBuilder builder) {
       this.length = builder.visibleLength;
       this.contents = DFSTestUtil.
           calculateFileContentsFromSeed(SEED, Ints.checkedCast(length));
       this.builder = builder;
+      this.genstamp = builder.genstamp;
       String uuid = this.builder.conf.
           get(SYNTHETIC_BLOCK_READER_TEST_UUID_KEY);
       LinkedList<SyntheticReplicaAccessor> accessorsList =
@@ -235,6 +244,10 @@ public class TestExternalBlockReader {
       return error;
     }
 
+    long getGenerationStamp() {
+      return genstamp;
+    }
+
     synchronized void addError(String text) {
       LOG.error("SyntheticReplicaAccessor error: " + text);
       error = error + prefix + text;
@@ -284,6 +297,8 @@ public class TestExternalBlockReader {
       Assert.assertEquals(dfs.getClient().clientName,
           accessor.builder.clientName);
       Assert.assertEquals("/a", accessor.builder.fileName);
+      Assert.assertEquals(block.getGenerationStamp(),
+          accessor.getGenerationStamp());
       Assert.assertTrue(accessor.builder.verifyChecksum);
       Assert.assertEquals(1024L, accessor.builder.visibleLength);
       Assert.assertEquals(1024L, accessor.totalRead);


Mime
View raw message