Return-Path: X-Original-To: apmail-hadoop-hdfs-commits-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1DE3590A5 for ; Wed, 11 Apr 2012 22:51:44 +0000 (UTC) Received: (qmail 21399 invoked by uid 500); 11 Apr 2012 22:51:43 -0000 Delivered-To: apmail-hadoop-hdfs-commits-archive@hadoop.apache.org Received: (qmail 21368 invoked by uid 500); 11 Apr 2012 22:51:43 -0000 Mailing-List: contact hdfs-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-dev@hadoop.apache.org Delivered-To: mailing list hdfs-commits@hadoop.apache.org Received: (qmail 21299 invoked by uid 99); 11 Apr 2012 22:51:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Apr 2012 22:51:43 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Apr 2012 22:51:38 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 7C8672388A56; Wed, 11 Apr 2012 22:51:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1325052 [1/3] - in /hadoop/common/branches/HDFS-3092/hadoop-hdfs-project: ./ hadoop-hdfs/ hadoop-hdfs/src/contrib/ hadoop-hdfs/src/contrib/fuse-dfs/ hadoop-hdfs/src/contrib/fuse-dfs/src/ hadoop-hdfs/src/main/java/ hadoop-hdfs/src/main/java... Date: Wed, 11 Apr 2012 22:51:15 -0000 To: hdfs-commits@hadoop.apache.org From: szetszwo@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120411225118.7C8672388A56@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: szetszwo Date: Wed Apr 11 22:51:10 2012 New Revision: 1325052 URL: http://svn.apache.org/viewvc?rev=1325052&view=rev Log: Merge r1311518 through r1325051 from trunk. Added: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/build-contrib.xml - copied unchanged from r1325051, hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/build-contrib.xml hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/pom.xml - copied unchanged from r1325051, hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/pom.xml Removed: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/contrib/build-contrib.xml hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/contrib/build.xml hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolR23Compatible/ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocol/TestCorruptFileBlocks.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/common/TestStorageInfo.java Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/ (props changed) hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/build.xml hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/src/Makefile.am hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/ (props changed) hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/BlockLocalPathInfo.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientDatanodeProtocol.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/CorruptFileBlocks.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeID.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeInfo.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DirectoryListing.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ExtendedBlock.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/HdfsFileStatus.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/HdfsLocatedFileStatus.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/LocatedBlock.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/LocatedBlocks.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolTranslatorPB.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/GetUserMappingsProtocolClientSideTranslatorPB.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/NamenodeProtocolTranslatorPB.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshAuthorizationPolicyProtocolClientSideTranslatorPB.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshUserMappingsProtocolClientSideTranslatorPB.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeDescriptor.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/StorageInfo.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/UpgradeStatusReport.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/CheckpointSignature.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/BootstrapStandby.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/BalancerBandwidthCommand.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/BlockCommand.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/BlockRecoveryCommand.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/BlocksWithLocations.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/CheckpointCommand.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/DatanodeCommand.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/DatanodeRegistration.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/FinalizeCommand.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/HeartbeatResponse.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/InterDatanodeProtocol.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/KeyUpdateCommand.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/NNHAStatusHeartbeat.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/NamenodeCommand.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/NamenodeProtocol.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/NamenodeRegistration.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/NamespaceInfo.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/ReceivedDeletedBlockInfo.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/RegisterCommand.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/ReplicaRecoveryInfo.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/ServerCommand.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/protocol/UpgradeCommand.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/GetConf.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/native/ (props changed) hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/datanode/ (props changed) hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/ (props changed) hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/secondary/ (props changed) hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/hdfs/ (props changed) hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSUtil.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestGetBlocks.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestParallelReadUtil.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestReplaceDatanodeOnFailure.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocolPB/TestPBHelper.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockInfo.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestCorruptReplicaInfo.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestDatanodeDescriptor.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestClusterId.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestBootstrapStandby.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestInitializeSharedEdits.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/test/MiniDFSClusterManager.java hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/pom.xml Propchange: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/ ------------------------------------------------------------------------------ Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs:r1311518-1325051 Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Wed Apr 11 22:51:10 2012 @@ -121,6 +121,11 @@ Trunk (unreleased changes) HDFS-3119. Overreplicated block is not deleted even after the replication factor is reduced after sync follwed by closing that file. (Ashish Singhi via umamahesh) + + HDFS-3235. MiniDFSClusterManager doesn't correctly support -format option. + (Henry Robinson via atm) + + HDFS-3243. TestParallelRead timing out on jenkins. (Henry Robinson via todd) Release 2.0.0 - UNRELEASED @@ -347,6 +352,24 @@ Release 2.0.0 - UNRELEASED HDFS-3211. Add fence(..) and replace NamenodeRegistration with JournalInfo and epoch in JournalProtocol. (suresh via szetszwo) + HDFS-3240. Drop log level of "heartbeat: ..." in BPServiceActor to DEBUG + (todd) + + HDFS-3238. ServerCommand and friends don't need to be writables. (eli) + + HDFS-3094. add -nonInteractive and -force option to namenode -format + command (Arpit Gupta via todd) + + HDFS-3244. Remove dead writable code from hdfs/protocol. (eli) + + HDFS-3247. Improve bootstrapStandby behavior when original NN is not active + (todd) + + HDFS-3249. Use ToolRunner.confirmPrompt in NameNode (todd) + + HDFS-3179. Improve the exception message thrown by DataStreamer when + it failed to add a datanode. (szetszwo) + OPTIMIZATIONS HDFS-3024. Improve performance of stringification in addStoredBlock (todd) @@ -462,6 +485,16 @@ Release 2.0.0 - UNRELEASED HDFS-3214. InterDatanodeProtocolServerSideTranslatorPB doesn't handle null response from initReplicaRecovery (todd) + HDFS-3234. Accidentally left log message in GetConf after HDFS-3226 (todd) + + HDFS-3236. NameNode does not initialize generic conf keys when started + with -initializeSharedEditsDir (atm) + + HDFS-3248. bootstrapStandby repeated twice in hdfs namenode usage message + (Colin Patrick McCabe via todd) + + HDFS-2696. Fix the fuse-fds build. (Bruno Mahé via eli) + BREAKDOWN OF HDFS-1623 SUBTASKS HDFS-2179. Add fencing framework and mechanisms for NameNode HA. (todd) Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/build.xml URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/build.xml?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/build.xml (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/build.xml Wed Apr 11 22:51:10 2012 @@ -17,19 +17,19 @@ limitations under the License. --> - + - + - + - + - + @@ -46,24 +46,12 @@ - - - - - - - - - - - - - + - + Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/src/Makefile.am URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/src/Makefile.am?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/src/Makefile.am (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/contrib/fuse-dfs/src/Makefile.am Wed Apr 11 22:51:10 2012 @@ -17,5 +17,5 @@ bin_PROGRAMS = fuse_dfs fuse_dfs_SOURCES = fuse_dfs.c fuse_options.c fuse_trash.c fuse_stat_struct.c fuse_users.c fuse_init.c fuse_connect.c fuse_impls_access.c fuse_impls_chmod.c fuse_impls_chown.c fuse_impls_create.c fuse_impls_flush.c fuse_impls_getattr.c fuse_impls_mkdir.c fuse_impls_mknod.c fuse_impls_open.c fuse_impls_read.c fuse_impls_release.c fuse_impls_readdir.c fuse_impls_rename.c fuse_impls_rmdir.c fuse_impls_statfs.c fuse_impls_symlink.c fuse_impls_truncate.c fuse_impls_utimens.c fuse_impls_unlink.c fuse_impls_write.c AM_CFLAGS= -Wall -g -AM_CPPFLAGS= -DPERMS=$(PERMS) -D_FILE_OFFSET_BITS=64 -I$(JAVA_HOME)/include -I$(HADOOP_PREFIX)/src/c++/libhdfs -I$(JAVA_HOME)/include/linux -D_FUSE_DFS_VERSION=\"$(PACKAGE_VERSION)\" -DPROTECTED_PATHS=\"$(PROTECTED_PATHS)\" -I$(FUSE_HOME)/include -AM_LDFLAGS= -L$(HADOOP_PREFIX)/build/c++/$(BUILD_PLATFORM)/lib -lhdfs -L$(FUSE_HOME)/lib -lfuse -L$(JAVA_HOME)/jre/lib/$(OS_ARCH)/server -ljvm +AM_CPPFLAGS= -DPERMS=$(PERMS) -D_FILE_OFFSET_BITS=64 -I$(JAVA_HOME)/include -I$(HADOOP_PREFIX)/../../src/main/native -I$(JAVA_HOME)/include/linux -D_FUSE_DFS_VERSION=\"$(PACKAGE_VERSION)\" -DPROTECTED_PATHS=\"$(PROTECTED_PATHS)\" -I$(FUSE_HOME)/include +AM_LDFLAGS= -L$(HADOOP_PREFIX)/../../target/native/target/usr/local/lib -lhdfs -L$(FUSE_HOME)/lib -lfuse -L$(JAVA_HOME)/jre/lib/$(OS_ARCH)/server -ljvm -lm Propchange: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/ ------------------------------------------------------------------------------ Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java:r1311518-1325051 Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java Wed Apr 11 22:51:10 2012 @@ -128,7 +128,7 @@ class DFSOutputStream extends FSOutputSu private volatile boolean appendChunk = false; // appending to existing partial block private long initialFileSize = 0; // at time of file open private Progressable progress; - private short blockReplication; // replication factor of file + private final short blockReplication; // replication factor of file private class Packet { long seqno; // sequencenumber of buffer in block @@ -775,9 +775,13 @@ class DFSOutputStream extends FSOutputSu private int findNewDatanode(final DatanodeInfo[] original ) throws IOException { if (nodes.length != original.length + 1) { - throw new IOException("Failed to add a datanode:" - + " nodes.length != original.length + 1, nodes=" - + Arrays.asList(nodes) + ", original=" + Arrays.asList(original)); + throw new IOException("Failed to add a datanode. " + + "User may turn off this feature by setting " + + DFSConfigKeys.DFS_CLIENT_WRITE_REPLACE_DATANODE_ON_FAILURE_POLICY_KEY + + " in configuration, where the current policy is " + + dfsClient.dtpReplaceDatanodeOnFailure + + ". (Nodes: current=" + Arrays.asList(nodes) + + ", original=" + Arrays.asList(original) + ")"); } for(int i = 0; i < nodes.length; i++) { int j = 0; Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/BlockLocalPathInfo.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/BlockLocalPathInfo.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/BlockLocalPathInfo.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/BlockLocalPathInfo.java Wed Apr 11 22:51:10 2012 @@ -17,16 +17,8 @@ */ package org.apache.hadoop.hdfs.protocol; -import java.io.DataInput; -import java.io.DataOutput; -import java.io.IOException; - import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; -import org.apache.hadoop.io.Text; -import org.apache.hadoop.io.Writable; -import org.apache.hadoop.io.WritableFactories; -import org.apache.hadoop.io.WritableFactory; /** * A block and the full path information to the block data file and @@ -34,20 +26,11 @@ import org.apache.hadoop.io.WritableFact */ @InterfaceAudience.Private @InterfaceStability.Evolving -public class BlockLocalPathInfo implements Writable { - static final WritableFactory FACTORY = new WritableFactory() { - public Writable newInstance() { return new BlockLocalPathInfo(); } - }; - static { // register a ctor - WritableFactories.setFactory(BlockLocalPathInfo.class, FACTORY); - } - +public class BlockLocalPathInfo { private ExtendedBlock block; private String localBlockPath = ""; // local file storing the data private String localMetaPath = ""; // local file storing the checksum - public BlockLocalPathInfo() {} - /** * Constructs BlockLocalPathInfo. * @param b The block corresponding to this lock path info. @@ -77,21 +60,6 @@ public class BlockLocalPathInfo implemen */ public String getMetaPath() {return localMetaPath;} - @Override - public void write(DataOutput out) throws IOException { - block.write(out); - Text.writeString(out, localBlockPath); - Text.writeString(out, localMetaPath); - } - - @Override - public void readFields(DataInput in) throws IOException { - block = new ExtendedBlock(); - block.readFields(in); - localBlockPath = Text.readString(in); - localMetaPath = Text.readString(in); - } - /** * Get number of bytes in the block. * @return Number of bytes in the block. Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientDatanodeProtocol.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientDatanodeProtocol.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientDatanodeProtocol.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientDatanodeProtocol.java Wed Apr 11 22:51:10 2012 @@ -24,7 +24,6 @@ import org.apache.hadoop.classification. import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier; import org.apache.hadoop.hdfs.security.token.block.BlockTokenSelector; -import org.apache.hadoop.ipc.VersionedProtocol; import org.apache.hadoop.security.KerberosInfo; import org.apache.hadoop.security.token.Token; import org.apache.hadoop.security.token.TokenInfo; @@ -42,9 +41,6 @@ public interface ClientDatanodeProtocol * the client interface to the DN AND the RPC protocol used to * communicate with the NN. * - * Post version 10 (release 23 of Hadoop), the protocol is implemented in - * {@literal ../protocolR23Compatible/ClientDatanodeWireProtocol} - * * This class is used by both the DFSClient and the * DN server side to insulate from the protocol serialization. * @@ -60,7 +56,6 @@ public interface ClientDatanodeProtocol * * 9 is the last version id when this class was used for protocols * serialization. DO not update this version any further. - * Changes are recorded in R23 classes. */ public static final long versionID = 9L; Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java Wed Apr 11 22:51:10 2012 @@ -66,9 +66,6 @@ public interface ClientProtocol { * the client interface to the NN AND the RPC protocol used to * communicate with the NN. * - * Post version 70 (release 23 of Hadoop), the protocol is implemented in - * {@literal ../protocolR23Compatible/ClientNamenodeWireProtocol} - * * This class is used by both the DFSClient and the * NN server side to insulate from the protocol serialization. * @@ -84,7 +81,6 @@ public interface ClientProtocol { * * 69L is the last version id when this class was used for protocols * serialization. DO not update this version any further. - * Changes are recorded in R23 classes. */ public static final long versionID = 69L; Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/CorruptFileBlocks.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/CorruptFileBlocks.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/CorruptFileBlocks.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/CorruptFileBlocks.java Wed Apr 11 22:51:10 2012 @@ -17,11 +17,6 @@ */ package org.apache.hadoop.hdfs.protocol; -import org.apache.hadoop.io.Writable; -import org.apache.hadoop.io.Text; -import java.io.DataInput; -import java.io.DataOutput; -import java.io.IOException; import java.util.Arrays; /** @@ -29,7 +24,7 @@ import java.util.Arrays; * used for iterative calls to NameNode.listCorruptFileBlocks. * */ -public class CorruptFileBlocks implements Writable { +public class CorruptFileBlocks { // used for hashCode private static final int PRIME = 16777619; @@ -53,28 +48,6 @@ public class CorruptFileBlocks implement return cookie; } - - @Override - public void readFields(DataInput in) throws IOException { - int fileCount = in.readInt(); - files = new String[fileCount]; - for (int i = 0; i < fileCount; i++) { - files[i] = Text.readString(in); - } - cookie = Text.readString(in); - } - - - @Override - public void write(DataOutput out) throws IOException { - out.writeInt(files.length); - for (int i = 0; i < files.length; i++) { - Text.writeString(out, files[i]); - } - Text.writeString(out, cookie); - } - - @Override public boolean equals(Object obj) { if (this == obj) { Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeID.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeID.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeID.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeID.java Wed Apr 11 22:51:10 2012 @@ -18,15 +18,9 @@ package org.apache.hadoop.hdfs.protocol; -import java.io.DataInput; -import java.io.DataOutput; -import java.io.IOException; - import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.hdfs.DFSConfigKeys; -import org.apache.hadoop.io.Text; -import org.apache.hadoop.io.WritableComparable; /** * This class represents the primary identifier for a Datanode. @@ -41,8 +35,8 @@ import org.apache.hadoop.io.WritableComp */ @InterfaceAudience.Private @InterfaceStability.Evolving -public class DatanodeID implements WritableComparable { - public static final DatanodeID[] EMPTY_ARRAY = {}; +public class DatanodeID implements Comparable { + public static final DatanodeID[] EMPTY_ARRAY = {}; protected String ipAddr; // IP address protected String hostName; // hostname @@ -51,10 +45,6 @@ public class DatanodeID implements Writa protected int infoPort; // info server port protected int ipcPort; // IPC server port - public DatanodeID() { - this("", DFSConfigKeys.DFS_DATANODE_DEFAULT_PORT); - } - public DatanodeID(String ipAddr, int xferPort) { this(ipAddr, "", "", xferPort, DFSConfigKeys.DFS_DATANODE_HTTP_DEFAULT_PORT, @@ -234,28 +224,4 @@ public class DatanodeID implements Writa public int compareTo(DatanodeID that) { return getXferAddr().compareTo(that.getXferAddr()); } - - @Override - public void write(DataOutput out) throws IOException { - Text.writeString(out, ipAddr); - Text.writeString(out, hostName); - Text.writeString(out, storageID); - out.writeShort(xferPort); - out.writeShort(infoPort); - out.writeShort(ipcPort); - } - - @Override - public void readFields(DataInput in) throws IOException { - ipAddr = Text.readString(in); - hostName = Text.readString(in); - storageID = Text.readString(in); - // The port read could be negative, if the port is a large number (more - // than 15 bits in storage size (but less than 16 bits). - // So chop off the first two bytes (and hence the signed bits) before - // setting the field. - xferPort = in.readShort() & 0x0000ffff; - infoPort = in.readShort() & 0x0000ffff; - ipcPort = in.readShort() & 0x0000ffff; - } } Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeInfo.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeInfo.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeInfo.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DatanodeInfo.java Wed Apr 11 22:51:10 2012 @@ -17,19 +17,11 @@ */ package org.apache.hadoop.hdfs.protocol; -import java.io.DataInput; -import java.io.DataOutput; -import java.io.IOException; import java.util.Date; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.hdfs.DFSUtil; -import org.apache.hadoop.io.Text; -import org.apache.hadoop.io.Writable; -import org.apache.hadoop.io.WritableFactories; -import org.apache.hadoop.io.WritableFactory; -import org.apache.hadoop.io.WritableUtils; import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.net.NetworkTopology; import org.apache.hadoop.net.Node; @@ -78,11 +70,6 @@ public class DatanodeInfo extends Datano protected AdminStates adminState; - public DatanodeInfo() { - super(); - adminState = null; - } - public DatanodeInfo(DatanodeInfo from) { super(from); this.capacity = from.getCapacity(); @@ -356,50 +343,6 @@ public class DatanodeInfo extends Datano public int getLevel() { return level; } public void setLevel(int level) {this.level = level;} - ///////////////////////////////////////////////// - // Writable - ///////////////////////////////////////////////// - static { // register a ctor - WritableFactories.setFactory - (DatanodeInfo.class, - new WritableFactory() { - public Writable newInstance() { return new DatanodeInfo(); } - }); - } - - @Override - public void write(DataOutput out) throws IOException { - super.write(out); - out.writeLong(capacity); - out.writeLong(dfsUsed); - out.writeLong(remaining); - out.writeLong(blockPoolUsed); - out.writeLong(lastUpdate); - out.writeInt(xceiverCount); - Text.writeString(out, location); - WritableUtils.writeEnum(out, getAdminState()); - } - - @Override - public void readFields(DataInput in) throws IOException { - super.readFields(in); - this.capacity = in.readLong(); - this.dfsUsed = in.readLong(); - this.remaining = in.readLong(); - this.blockPoolUsed = in.readLong(); - this.lastUpdate = in.readLong(); - this.xceiverCount = in.readInt(); - this.location = Text.readString(in); - setAdminState(WritableUtils.readEnum(in, AdminStates.class)); - } - - /** Read a DatanodeInfo */ - public static DatanodeInfo read(DataInput in) throws IOException { - final DatanodeInfo d = new DatanodeInfo(); - d.readFields(in); - return d; - } - @Override public int hashCode() { // Super implementation is sufficient Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DirectoryListing.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DirectoryListing.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DirectoryListing.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/DirectoryListing.java Wed Apr 11 22:51:10 2012 @@ -16,15 +16,8 @@ */ package org.apache.hadoop.hdfs.protocol; -import java.io.DataInput; -import java.io.DataOutput; -import java.io.IOException; - import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; -import org.apache.hadoop.io.Writable; -import org.apache.hadoop.io.WritableFactories; -import org.apache.hadoop.io.WritableFactory; /** * This class defines a partial listing of a directory to support @@ -32,25 +25,11 @@ import org.apache.hadoop.io.WritableFact */ @InterfaceAudience.Private @InterfaceStability.Evolving -public class DirectoryListing implements Writable { - static { // register a ctor - WritableFactories.setFactory - (DirectoryListing.class, - new WritableFactory() { - public Writable newInstance() { return new DirectoryListing(); } - }); - } - +public class DirectoryListing { private HdfsFileStatus[] partialListing; private int remainingEntries; /** - * default constructor - */ - public DirectoryListing() { - } - - /** * constructor * @param partialListing a partial listing of a directory * @param remainingEntries number of entries that are left to be listed @@ -103,39 +82,4 @@ public class DirectoryListing implements } return partialListing[partialListing.length-1].getLocalNameInBytes(); } - - // Writable interface - @Override - public void readFields(DataInput in) throws IOException { - int numEntries = in.readInt(); - partialListing = new HdfsFileStatus[numEntries]; - if (numEntries !=0 ) { - boolean hasLocation = in.readBoolean(); - for (int i=0; i blocks; // array of blocks with prioritized locations private boolean underConstruction; @@ -167,61 +160,6 @@ public class LocatedBlocks implements Wr return binSearchResult >= 0 ? binSearchResult : -(binSearchResult+1); } - ////////////////////////////////////////////////// - // Writable - ////////////////////////////////////////////////// - static { // register a ctor - WritableFactories.setFactory - (LocatedBlocks.class, - new WritableFactory() { - public Writable newInstance() { return new LocatedBlocks(); } - }); - } - - public void write(DataOutput out) throws IOException { - out.writeLong(this.fileLength); - out.writeBoolean(underConstruction); - - //write the last located block - final boolean isNull = lastLocatedBlock == null; - out.writeBoolean(isNull); - if (!isNull) { - lastLocatedBlock.write(out); - } - out.writeBoolean(isLastBlockComplete); - - // write located blocks - int nrBlocks = locatedBlockCount(); - out.writeInt(nrBlocks); - if (nrBlocks == 0) { - return; - } - for (LocatedBlock blk : this.blocks) { - blk.write(out); - } - } - - public void readFields(DataInput in) throws IOException { - this.fileLength = in.readLong(); - underConstruction = in.readBoolean(); - - //read the last located block - final boolean isNull = in.readBoolean(); - if (!isNull) { - lastLocatedBlock = LocatedBlock.read(in); - } - isLastBlockComplete = in.readBoolean(); - - // read located blocks - int nrBlocks = in.readInt(); - this.blocks = new ArrayList(nrBlocks); - for (int idx = 0; idx < nrBlocks; idx++) { - LocatedBlock blk = new LocatedBlock(); - blk.readFields(in); - this.blocks.add(blk); - } - } - @Override public String toString() { final StringBuilder b = new StringBuilder(getClass().getSimpleName()); Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolTranslatorPB.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolTranslatorPB.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolTranslatorPB.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientDatanodeProtocolTranslatorPB.java Wed Apr 11 22:51:10 2012 @@ -39,12 +39,10 @@ import org.apache.hadoop.hdfs.protocol.p import org.apache.hadoop.hdfs.protocol.proto.ClientDatanodeProtocolProtos.GetBlockLocalPathInfoResponseProto; import org.apache.hadoop.hdfs.protocol.proto.ClientDatanodeProtocolProtos.GetReplicaVisibleLengthRequestProto; import org.apache.hadoop.hdfs.protocol.proto.ClientDatanodeProtocolProtos.RefreshNamenodesRequestProto; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier; import org.apache.hadoop.ipc.ProtobufHelper; import org.apache.hadoop.ipc.ProtobufRpcEngine; import org.apache.hadoop.ipc.ProtocolMetaInterface; -import org.apache.hadoop.ipc.ProtocolSignature; import org.apache.hadoop.ipc.ProtocolTranslator; import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.ipc.RpcClientUtil; Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java Wed Apr 11 22:51:10 2012 @@ -40,7 +40,6 @@ import org.apache.hadoop.hdfs.protocol.D import org.apache.hadoop.hdfs.protocol.DatanodeInfo; import org.apache.hadoop.hdfs.protocol.DirectoryListing; import org.apache.hadoop.hdfs.protocol.ExtendedBlock; -import org.apache.hadoop.hdfs.protocol.HdfsConstants; import org.apache.hadoop.hdfs.protocol.HdfsConstants.DatanodeReportType; import org.apache.hadoop.hdfs.protocol.HdfsConstants.SafeModeAction; import org.apache.hadoop.hdfs.protocol.HdfsConstants.UpgradeAction; @@ -102,24 +101,16 @@ import org.apache.hadoop.hdfs.protocol.p import org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.UpdatePipelineRequestProto; import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier; import org.apache.hadoop.hdfs.server.common.UpgradeStatusReport; -import org.apache.hadoop.hdfs.server.namenode.NameNode; import org.apache.hadoop.hdfs.server.namenode.NotReplicatedYetException; import org.apache.hadoop.hdfs.server.namenode.SafeModeException; import org.apache.hadoop.io.EnumSetWritable; import org.apache.hadoop.io.Text; -import org.apache.hadoop.io.retry.RetryPolicies; -import org.apache.hadoop.io.retry.RetryPolicy; -import org.apache.hadoop.io.retry.RetryProxy; import org.apache.hadoop.ipc.ProtobufHelper; -import org.apache.hadoop.ipc.ProtobufRpcEngine; import org.apache.hadoop.ipc.ProtocolMetaInterface; import org.apache.hadoop.ipc.RPC; -import org.apache.hadoop.ipc.RemoteException; import org.apache.hadoop.ipc.RpcClientUtil; import org.apache.hadoop.ipc.RpcPayloadHeader.RpcKind; -import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.security.AccessControlException; -import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.token.Token; import com.google.protobuf.ByteString; @@ -127,8 +118,8 @@ import com.google.protobuf.ServiceExcept /** * This class forwards NN's ClientProtocol calls as RPC calls to the NN server - * while translating from the parameter types used in ClientProtocol to those - * used in protocolR23Compatile.*. + * while translating from the parameter types used in ClientProtocol to the + * new PB types. */ @InterfaceAudience.Private @InterfaceStability.Stable Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/GetUserMappingsProtocolClientSideTranslatorPB.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/GetUserMappingsProtocolClientSideTranslatorPB.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/GetUserMappingsProtocolClientSideTranslatorPB.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/GetUserMappingsProtocolClientSideTranslatorPB.java Wed Apr 11 22:51:10 2012 @@ -22,10 +22,8 @@ import java.io.Closeable; import java.io.IOException; import org.apache.hadoop.hdfs.protocol.proto.GetUserMappingsProtocolProtos.GetGroupsForUserRequestProto; import org.apache.hadoop.hdfs.protocol.proto.GetUserMappingsProtocolProtos.GetGroupsForUserResponseProto; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.ipc.ProtobufHelper; import org.apache.hadoop.ipc.ProtocolMetaInterface; -import org.apache.hadoop.ipc.ProtocolSignature; import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.ipc.RpcClientUtil; import org.apache.hadoop.ipc.RpcPayloadHeader.RpcKind; Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/NamenodeProtocolTranslatorPB.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/NamenodeProtocolTranslatorPB.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/NamenodeProtocolTranslatorPB.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/NamenodeProtocolTranslatorPB.java Wed Apr 11 22:51:10 2012 @@ -35,7 +35,6 @@ import org.apache.hadoop.hdfs.protocol.p import org.apache.hadoop.hdfs.protocol.proto.NamenodeProtocolProtos.RegisterRequestProto; import org.apache.hadoop.hdfs.protocol.proto.NamenodeProtocolProtos.RollEditLogRequestProto; import org.apache.hadoop.hdfs.protocol.proto.NamenodeProtocolProtos.StartCheckpointRequestProto; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys; import org.apache.hadoop.hdfs.server.namenode.CheckpointSignature; import org.apache.hadoop.hdfs.server.protocol.BlocksWithLocations; @@ -46,7 +45,6 @@ import org.apache.hadoop.hdfs.server.pro import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; import org.apache.hadoop.ipc.ProtobufHelper; import org.apache.hadoop.ipc.ProtocolMetaInterface; -import org.apache.hadoop.ipc.ProtocolSignature; import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.ipc.RpcClientUtil; import org.apache.hadoop.ipc.RpcPayloadHeader.RpcKind; Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshAuthorizationPolicyProtocolClientSideTranslatorPB.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshAuthorizationPolicyProtocolClientSideTranslatorPB.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshAuthorizationPolicyProtocolClientSideTranslatorPB.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshAuthorizationPolicyProtocolClientSideTranslatorPB.java Wed Apr 11 22:51:10 2012 @@ -22,10 +22,8 @@ import java.io.Closeable; import java.io.IOException; import org.apache.hadoop.hdfs.protocol.proto.RefreshAuthorizationPolicyProtocolProtos.RefreshServiceAclRequestProto; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.ipc.ProtobufHelper; import org.apache.hadoop.ipc.ProtocolMetaInterface; -import org.apache.hadoop.ipc.ProtocolSignature; import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.ipc.RpcClientUtil; import org.apache.hadoop.ipc.RpcPayloadHeader.RpcKind; Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshUserMappingsProtocolClientSideTranslatorPB.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshUserMappingsProtocolClientSideTranslatorPB.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshUserMappingsProtocolClientSideTranslatorPB.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/RefreshUserMappingsProtocolClientSideTranslatorPB.java Wed Apr 11 22:51:10 2012 @@ -23,10 +23,8 @@ import java.io.IOException; import org.apache.hadoop.hdfs.protocol.proto.RefreshUserMappingsProtocolProtos.RefreshSuperUserGroupsConfigurationRequestProto; import org.apache.hadoop.hdfs.protocol.proto.RefreshUserMappingsProtocolProtos.RefreshUserToGroupsMappingsRequestProto; -import org.apache.hadoop.hdfs.protocolR23Compatible.ProtocolSignatureWritable; import org.apache.hadoop.ipc.ProtobufHelper; import org.apache.hadoop.ipc.ProtocolMetaInterface; -import org.apache.hadoop.ipc.ProtocolSignature; import org.apache.hadoop.ipc.RPC; import org.apache.hadoop.ipc.RpcClientUtil; import org.apache.hadoop.ipc.RpcPayloadHeader.RpcKind; Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeDescriptor.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeDescriptor.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeDescriptor.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/DatanodeDescriptor.java Wed Apr 11 22:51:10 2012 @@ -153,8 +153,6 @@ public class DatanodeDescriptor extends */ private boolean disallowed = false; - public DatanodeDescriptor() {} - /** * DatanodeDescriptor constructor * @param nodeID id of the data node Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/HdfsServerConstants.java Wed Apr 11 22:51:10 2012 @@ -57,13 +57,18 @@ public final class HdfsServerConstants { BOOTSTRAPSTANDBY("-bootstrapStandby"), INITIALIZESHAREDEDITS("-initializeSharedEdits"), RECOVER ("-recover"), - FORCE("-force"); + FORCE("-force"), + NONINTERACTIVE("-nonInteractive"); private String name = null; // Used only with format and upgrade options private String clusterId = null; + // Used only with format option + private boolean isForceFormat = false; + private boolean isInteractiveFormat = true; + // Used only with recovery option private int force = 0; @@ -101,6 +106,22 @@ public final class HdfsServerConstants { public int getForce() { return this.force; } + + public boolean getForceFormat() { + return isForceFormat; + } + + public void setForceFormat(boolean force) { + isForceFormat = force; + } + + public boolean getInteractiveFormat() { + return isInteractiveFormat; + } + + public void setInteractiveFormat(boolean interactive) { + isInteractiveFormat = interactive; + } } // Timeouts for communicating with DataNode for streaming writes/reads Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/StorageInfo.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/StorageInfo.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/StorageInfo.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/StorageInfo.java Wed Apr 11 22:51:10 2012 @@ -17,13 +17,7 @@ */ package org.apache.hadoop.hdfs.server.common; -import java.io.DataInput; -import java.io.DataOutput; -import java.io.IOException; - import org.apache.hadoop.classification.InterfaceAudience; -import org.apache.hadoop.io.Writable; -import org.apache.hadoop.io.WritableUtils; import com.google.common.base.Joiner; @@ -33,16 +27,16 @@ import com.google.common.base.Joiner; * TODO namespaceID should be long and computed as hash(address + port) */ @InterfaceAudience.Private -public class StorageInfo implements Writable { +public class StorageInfo { public int layoutVersion; // layout version of the storage data public int namespaceID; // id of the file system public String clusterID; // id of the cluster public long cTime; // creation time of the file system state - + public StorageInfo () { this(0, 0, "", 0L); } - + public StorageInfo(int layoutV, int nsID, String cid, long cT) { layoutVersion = layoutV; clusterID = cid; @@ -83,23 +77,6 @@ public class StorageInfo implements Writ namespaceID = from.namespaceID; cTime = from.cTime; } - - ///////////////////////////////////////////////// - // Writable - ///////////////////////////////////////////////// - public void write(DataOutput out) throws IOException { - out.writeInt(getLayoutVersion()); - out.writeInt(getNamespaceID()); - WritableUtils.writeString(out, clusterID); - out.writeLong(getCTime()); - } - - public void readFields(DataInput in) throws IOException { - layoutVersion = in.readInt(); - namespaceID = in.readInt(); - clusterID = WritableUtils.readString(in); - cTime = in.readLong(); - } public String toString() { StringBuilder sb = new StringBuilder(); Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/UpgradeStatusReport.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/UpgradeStatusReport.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/UpgradeStatusReport.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/UpgradeStatusReport.java Wed Apr 11 22:51:10 2012 @@ -17,14 +17,7 @@ */ package org.apache.hadoop.hdfs.server.common; -import java.io.DataInput; -import java.io.DataOutput; -import java.io.IOException; - import org.apache.hadoop.classification.InterfaceAudience; -import org.apache.hadoop.io.Writable; -import org.apache.hadoop.io.WritableFactories; -import org.apache.hadoop.io.WritableFactory; /** * Base upgrade upgradeStatus class. @@ -33,17 +26,11 @@ import org.apache.hadoop.io.WritableFact * Describes status of current upgrade. */ @InterfaceAudience.Private -public class UpgradeStatusReport implements Writable { +public class UpgradeStatusReport { protected int version; protected short upgradeStatus; protected boolean finalized; - public UpgradeStatusReport() { - this.version = 0; - this.upgradeStatus = 0; - this.finalized = false; - } - public UpgradeStatusReport(int version, short status, boolean isFinalized) { this.version = version; this.upgradeStatus = status; @@ -98,29 +85,4 @@ public class UpgradeStatusReport impleme public String toString() { return getStatusText(false); } - - ///////////////////////////////////////////////// - // Writable - ///////////////////////////////////////////////// - static { // register a ctor - WritableFactories.setFactory - (UpgradeStatusReport.class, - new WritableFactory() { - public Writable newInstance() { return new UpgradeStatusReport(); } - }); - } - - /** - */ - public void write(DataOutput out) throws IOException { - out.writeInt(this.version); - out.writeShort(this.upgradeStatus); - } - - /** - */ - public void readFields(DataInput in) throws IOException { - this.version = in.readInt(); - this.upgradeStatus = in.readShort(); - } } Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java Wed Apr 11 22:51:10 2012 @@ -417,7 +417,9 @@ class BPServiceActor implements Runnable HeartbeatResponse sendHeartBeat() throws IOException { - LOG.info("heartbeat: " + this); + if (LOG.isDebugEnabled()) { + LOG.debug("Sending heartbeat from service actor: " + this); + } // reports number of failed volumes StorageReport[] report = { new StorageReport(bpRegistration.getStorageID(), false, Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/CheckpointSignature.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/CheckpointSignature.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/CheckpointSignature.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/CheckpointSignature.java Wed Apr 11 22:51:10 2012 @@ -17,15 +17,11 @@ */ package org.apache.hadoop.hdfs.server.namenode; -import java.io.DataInput; -import java.io.DataOutput; import java.io.IOException; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.hdfs.server.common.StorageInfo; import org.apache.hadoop.hdfs.server.namenode.FSImage; -import org.apache.hadoop.io.WritableComparable; -import org.apache.hadoop.io.WritableUtils; import com.google.common.collect.ComparisonChain; @@ -33,16 +29,15 @@ import com.google.common.collect.Compari * A unique signature intended to identify checkpoint transactions. */ @InterfaceAudience.Private -public class CheckpointSignature extends StorageInfo - implements WritableComparable { +public class CheckpointSignature extends StorageInfo + implements Comparable { + private static final String FIELD_SEPARATOR = ":"; private static final int NUM_FIELDS = 7; String blockpoolID = ""; long mostRecentCheckpointTxId; long curSegmentTxId; - public CheckpointSignature() {} - CheckpointSignature(FSImage fsImage) { super(fsImage.getStorage()); blockpoolID = fsImage.getBlockPoolID(); @@ -162,21 +157,4 @@ public class CheckpointSignature extends (int)(cTime ^ mostRecentCheckpointTxId ^ curSegmentTxId) ^ clusterID.hashCode() ^ blockpoolID.hashCode(); } - - ///////////////////////////////////////////////// - // Writable - ///////////////////////////////////////////////// - public void write(DataOutput out) throws IOException { - super.write(out); - WritableUtils.writeString(out, blockpoolID); - out.writeLong(mostRecentCheckpointTxId); - out.writeLong(curSegmentTxId); - } - - public void readFields(DataInput in) throws IOException { - super.readFields(in); - blockpoolID = WritableUtils.readString(in); - mostRecentCheckpointTxId = in.readLong(); - curSegmentTxId = in.readLong(); - } } Modified: hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java?rev=1325052&r1=1325051&r2=1325052&view=diff ============================================================================== --- hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java (original) +++ hadoop/common/branches/HDFS-3092/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java Wed Apr 11 22:51:10 2012 @@ -72,6 +72,7 @@ import org.apache.hadoop.security.author import org.apache.hadoop.tools.GetUserMappingsProtocol; import org.apache.hadoop.util.ServicePlugin; import org.apache.hadoop.util.StringUtils; +import static org.apache.hadoop.util.ToolRunner.confirmPrompt; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Lists; @@ -215,7 +216,7 @@ public class NameNode { /** Format a new filesystem. Destroys any filesystem that may already * exist at this location. **/ public static void format(Configuration conf) throws IOException { - format(conf, true); + format(conf, true, true); } static NameNodeMetrics metrics; @@ -658,9 +659,8 @@ public class NameNode { * @return true if formatting was aborted, false otherwise * @throws IOException */ - private static boolean format(Configuration conf, - boolean force) - throws IOException { + private static boolean format(Configuration conf, boolean force, + boolean isInteractive) throws IOException { String nsId = DFSUtil.getNamenodeNameServiceId(conf); String namenodeId = HAUtil.getNameNodeId(conf, nsId); initializeGenericKeys(conf, nsId, namenodeId); @@ -669,7 +669,7 @@ public class NameNode { Collection dirsToFormat = FSNamesystem.getNamespaceDirs(conf); List editDirsToFormat = FSNamesystem.getNamespaceEditsDirs(conf); - if (!confirmFormat(dirsToFormat, force, true)) { + if (!confirmFormat(dirsToFormat, force, isInteractive)) { return true; // aborted } @@ -760,6 +760,9 @@ public class NameNode { */ private static boolean initializeSharedEdits(Configuration conf, boolean force, boolean interactive) { + String nsId = DFSUtil.getNamenodeNameServiceId(conf); + String namenodeId = HAUtil.getNameNodeId(conf, nsId); + initializeGenericKeys(conf, nsId, namenodeId); NNStorage existingStorage = null; try { FSNamesystem fsns = FSNamesystem.loadFromDisk(conf, @@ -827,13 +830,13 @@ public class NameNode { "Usage: java NameNode [" + StartupOption.BACKUP.getName() + "] | [" + StartupOption.CHECKPOINT.getName() + "] | [" + - StartupOption.FORMAT.getName() + "[" + StartupOption.CLUSTERID.getName() + - " cid ]] | [" + + StartupOption.FORMAT.getName() + " [" + StartupOption.CLUSTERID.getName() + + " cid ] [" + StartupOption.FORCE.getName() + "] [" + + StartupOption.NONINTERACTIVE.getName() + "] ] | [" + StartupOption.UPGRADE.getName() + "] | [" + StartupOption.ROLLBACK.getName() + "] | [" + StartupOption.FINALIZE.getName() + "] | [" + StartupOption.IMPORT.getName() + "] | [" + - StartupOption.BOOTSTRAPSTANDBY.getName() + "] | [" + StartupOption.INITIALIZESHAREDEDITS.getName() + "] | [" + StartupOption.BOOTSTRAPSTANDBY.getName() + "] | [" + StartupOption.RECOVER.getName() + " [ " + @@ -847,11 +850,35 @@ public class NameNode { String cmd = args[i]; if (StartupOption.FORMAT.getName().equalsIgnoreCase(cmd)) { startOpt = StartupOption.FORMAT; - // might be followed by two args - if (i + 2 < argsLen - && args[i + 1].equalsIgnoreCase(StartupOption.CLUSTERID.getName())) { - i += 2; - startOpt.setClusterId(args[i]); + for (i = i + 1; i < argsLen; i++) { + if (args[i].equalsIgnoreCase(StartupOption.CLUSTERID.getName())) { + i++; + if (i >= argsLen) { + // if no cluster id specified, return null + LOG.fatal("Must specify a valid cluster ID after the " + + StartupOption.CLUSTERID.getName() + " flag"); + return null; + } + String clusterId = args[i]; + // Make sure an id is specified and not another flag + if (clusterId.isEmpty() || + clusterId.equalsIgnoreCase(StartupOption.FORCE.getName()) || + clusterId.equalsIgnoreCase( + StartupOption.NONINTERACTIVE.getName())) { + LOG.fatal("Must specify a valid cluster ID after the " + + StartupOption.CLUSTERID.getName() + " flag"); + return null; + } + startOpt.setClusterId(clusterId); + } + + if (args[i].equalsIgnoreCase(StartupOption.FORCE.getName())) { + startOpt.setForceFormat(true); + } + + if (args[i].equalsIgnoreCase(StartupOption.NONINTERACTIVE.getName())) { + startOpt.setInteractiveFormat(false); + } } } else if (StartupOption.GENCLUSTERID.getName().equalsIgnoreCase(cmd)) { startOpt = StartupOption.GENCLUSTERID; @@ -945,34 +972,6 @@ public class NameNode { } } - /** - * Print out a prompt to the user, and return true if the user - * responds with "Y" or "yes". - */ - static boolean confirmPrompt(String prompt) throws IOException { - while (true) { - System.err.print(prompt + " (Y or N) "); - StringBuilder responseBuilder = new StringBuilder(); - while (true) { - int c = System.in.read(); - if (c == -1 || c == '\r' || c == '\n') { - break; - } - responseBuilder.append((char)c); - } - - String response = responseBuilder.toString(); - if (response.equalsIgnoreCase("y") || - response.equalsIgnoreCase("yes")) { - return true; - } else if (response.equalsIgnoreCase("n") || - response.equalsIgnoreCase("no")) { - return false; - } - // else ask them again - } - } - public static NameNode createNameNode(String argv[], Configuration conf) throws IOException { if (conf == null) @@ -994,7 +993,8 @@ public class NameNode { switch (startOpt) { case FORMAT: { - boolean aborted = format(conf, false); + boolean aborted = format(conf, startOpt.getForceFormat(), + startOpt.getInteractiveFormat()); System.exit(aborted ? 1 : 0); return null; // avoid javac warning }