From 242028a3fb887708dea5ef557c0ded22e014ac7d Mon Sep 17 00:00:00 2001 From: Konstantin Shvachko Date: Sat, 13 Apr 2013 01:35:58 +0000 Subject: [PATCH] HDFS-4639. startFileInternal() should not increment generation stamp. Contributed by Plamen Jeliazkov. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1467534 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../org/apache/hadoop/hdfs/server/namenode/FSDirectory.java | 3 +-- .../org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 3 +-- .../src/test/java/org/apache/hadoop/hdfs/TestDFSUpgrade.java | 2 +- .../org/apache/hadoop/hdfs/server/namenode/TestCheckpoint.java | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index bde5d8285c..32bcb99696 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -503,6 +503,9 @@ Release 2.0.5-beta - UNRELEASED HDFS-4643. Fix flakiness in TestQuorumJournalManager. (todd) + HDFS-4639. startFileInternal() should not increment generation stamp. + (Plamen Jeliazkov via shv) + Release 2.0.4-alpha - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java index 07679b2eb7..b5ef8ef2e9 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java @@ -235,8 +235,7 @@ INodeFileUnderConstruction addFile(String path, long preferredBlockSize, String clientName, String clientMachine, - DatanodeDescriptor clientNode, - long generationStamp) + DatanodeDescriptor clientNode) throws FileAlreadyExistsException, QuotaExceededException, UnresolvedLinkException { waitForReady(); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index 07b87c7074..fbf97a80a7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -1907,9 +1907,8 @@ private LocatedBlock startFileInternal(FSPermissionChecker pc, String src, checkFsObjectLimit(); // increment global generation stamp - long genstamp = nextGenerationStamp(); INodeFileUnderConstruction newNode = dir.addFile(src, permissions, - replication, blockSize, holder, clientMachine, clientNode, genstamp); + replication, blockSize, holder, clientMachine, clientNode); if (newNode == null) { throw new IOException("DIR* NameSystem.startFile: " + "Unable to add file to namespace."); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUpgrade.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUpgrade.java index b087968363..2e7c8b47d3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUpgrade.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUpgrade.java @@ -53,7 +53,7 @@ */ public class TestDFSUpgrade { - private static final int EXPECTED_TXID = 49; + private static final int EXPECTED_TXID = 45; private static final Log LOG = LogFactory.getLog(TestDFSUpgrade.class.getName()); private Configuration conf; private int testCounter = 0; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestCheckpoint.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestCheckpoint.java index db0e9b8e05..8ee07cbbbf 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestCheckpoint.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestCheckpoint.java @@ -1129,7 +1129,7 @@ public void testSaveNamespace() throws IOException { throw new IOException(e); } - final int EXPECTED_TXNS_FIRST_SEG = 12; + final int EXPECTED_TXNS_FIRST_SEG = 11; // the following steps should have happened: // edits_inprogress_1 -> edits_1-12 (finalized)