From 934047630a8c0dc227dc393797a460933d212a17 Mon Sep 17 00:00:00 2001 From: Mahadev Konar Date: Sat, 28 Jan 2012 04:05:19 +0000 Subject: [PATCH 1/2] HADOOP-8002. SecurityUtil acquired token message should be a debug rather than info. (Arpit Gupta via mahadev) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1236976 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../main/java/org/apache/hadoop/security/SecurityUtil.java | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 4a420692a70..51f582745ed 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -218,6 +218,9 @@ Release 0.23.1 - Unreleased HADOOP-7939. Improve Hadoop subcomponent integration in Hadoop 0.23. (rvs via tucu) + HADOOP-8002. SecurityUtil acquired token message should be a debug rather than info. + (Arpit Gupta via mahadev) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java index abf9f3aa80a..26858874649 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SecurityUtil.java @@ -409,7 +409,9 @@ public class SecurityUtil { Text service = buildTokenService(addr); if (token != null) { token.setService(service); - LOG.info("Acquired token "+token); // Token#toString() prints service + if (LOG.isDebugEnabled()) { + LOG.debug("Acquired token "+token); // Token#toString() prints service + } } else { LOG.warn("Failed to get token for service "+service); } From 976c07696d6dd839993f06ba250975c874f31145 Mon Sep 17 00:00:00 2001 From: Aaron Myers Date: Sat, 28 Jan 2012 20:26:13 +0000 Subject: [PATCH 2/2] HDFS-2759. Pre-allocate HDFS edit log files after writing version number. Contributed by Aaron T. Myers. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1237153 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hdfs/server/namenode/EditLogFileOutputStream.java | 4 ++-- .../server/namenode/TestEditLogFileOutputStream.java | 10 ++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index d2a0d1115e0..213e3fea94d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -172,6 +172,9 @@ Trunk (unreleased changes) HDFS-2768. BackupNode stop can not close proxy connections because it is not a proxy instance. (Uma Maheswara Rao G via eli) + HDFS-2759. Pre-allocate HDFS edit log files after writing version number. + (atm) + Release 0.23.1 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/EditLogFileOutputStream.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/EditLogFileOutputStream.java index 72c33673168..bdc0bd2a56c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/EditLogFileOutputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/EditLogFileOutputStream.java @@ -167,10 +167,10 @@ class EditLogFileOutputStream extends EditLogOutputStream { LOG.info("Nothing to flush"); return; } - preallocate(); // preallocate file if necessary doubleBuf.flushTo(fp); - fc.force(false); // metadata updates not needed because of preallocation + fc.force(false); // metadata updates not needed fc.position(fc.position() - 1); // skip back the end-of-file marker + preallocate(); // preallocate file if necessary } /** diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestEditLogFileOutputStream.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestEditLogFileOutputStream.java index 1228bef6044..b5097a7645c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestEditLogFileOutputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestEditLogFileOutputStream.java @@ -41,6 +41,7 @@ import org.mockito.Mockito; public class TestEditLogFileOutputStream { + private final static long PREALLOCATION_LENGTH = (1024 * 1024) + 4; private final static int HEADER_LEN = 17; private static final File TEST_EDITS = new File(System.getProperty("test.build.data","/tmp"), @@ -65,8 +66,9 @@ public class TestEditLogFileOutputStream { assertEquals("Edit log should contain a header as valid length", HEADER_LEN, validation.getValidLength()); assertEquals(1, validation.getNumTransactions()); - assertEquals("Edit log should have 1MB of bytes allocated", - 1024*1024, editLog.length()); + assertEquals("Edit log should have 1MB pre-allocated, plus 4 bytes " + + "for the version number", + PREALLOCATION_LENGTH, editLog.length()); cluster.getFileSystem().mkdirs(new Path("/tmp"), @@ -79,8 +81,8 @@ public class TestEditLogFileOutputStream { validation.getValidLength() > oldLength); assertEquals(2, validation.getNumTransactions()); - assertEquals("Edit log should be 1MB long", - 1024 * 1024, editLog.length()); + assertEquals("Edit log should be 1MB long, plus 4 bytes for the version number", + PREALLOCATION_LENGTH, editLog.length()); // 256 blocks for the 1MB of preallocation space assertTrue("Edit log disk space used should be at least 257 blocks", 256 * 4096 <= new DU(editLog, conf).getUsed());