hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject hbase git commit: HBASE-14392 [tests] TestLogRollingNoCluster fails on master from time to time
Date Fri, 11 Sep 2015 03:25:43 GMT
Repository: hbase
Updated Branches:
  refs/heads/master bf26088d7 -> 411b516f5


HBASE-14392 [tests] TestLogRollingNoCluster fails on master from time to time


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/411b516f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/411b516f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/411b516f

Branch: refs/heads/master
Commit: 411b516f5156730075558d91b69c3c3e09fb200d
Parents: bf26088
Author: stack <stack@apache.org>
Authored: Thu Sep 10 20:25:36 2015 -0700
Committer: stack <stack@apache.org>
Committed: Thu Sep 10 20:25:36 2015 -0700

----------------------------------------------------------------------
 .../regionserver/wal/ProtobufLogWriter.java     | 24 ++++++++------------
 .../wal/TestLogRollingNoCluster.java            |  4 +---
 2 files changed, 10 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/411b516f/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogWriter.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogWriter.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogWriter.java
index a6e4eb5..42abeae 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogWriter.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/ProtobufLogWriter.java
@@ -19,26 +19,26 @@
 
 package org.apache.hadoop.hbase.regionserver.wal;
 
+import static org.apache.hadoop.hbase.regionserver.wal.ProtobufLogReader.DEFAULT_WAL_TRAILER_WARN_SIZE;
+import static org.apache.hadoop.hbase.regionserver.wal.ProtobufLogReader.WAL_TRAILER_WARN_SIZE;
+
 import java.io.IOException;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataOutputStream;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.HBaseInterfaceAudience;
+import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.codec.Codec;
 import org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALHeader;
 import org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALTrailer;
 import org.apache.hadoop.hbase.util.FSUtils;
 import org.apache.hadoop.hbase.wal.WAL.Entry;
 
-import static org.apache.hadoop.hbase.regionserver.wal.ProtobufLogReader.WAL_TRAILER_WARN_SIZE;
-import static org.apache.hadoop.hbase.regionserver.wal.ProtobufLogReader.DEFAULT_WAL_TRAILER_WARN_SIZE;
-
 /**
  * Writer for protobuf-based WAL.
  */
@@ -165,16 +165,10 @@ public class ProtobufLogWriter extends WriterBase {
 
   @Override
   public void sync() throws IOException {
-    try {
-      // This looks to be a noop but its what we have always done.  Leaving for now.
-      this.output.flush();
-      // TODO: Add in option to call hsync. See HBASE-5954 Allow proper fsync support for
HBase
-      //
-      this.output.hflush();
-    } catch (NullPointerException npe) {
-      // Concurrent close...
-      throw new IOException(npe);
-    }
+    FSDataOutputStream fsdos = this.output;
+    if (fsdos == null) return; // Presume closed
+    fsdos.flush();
+    fsdos.hflush();
   }
 
   @Override
@@ -194,4 +188,4 @@ public class ProtobufLogWriter extends WriterBase {
   void setWALTrailer(WALTrailer walTrailer) {
     this.trailer = walTrailer;
   }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hbase/blob/411b516f/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollingNoCluster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollingNoCluster.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollingNoCluster.java
index 41e05ae..bc33fc0 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollingNoCluster.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollingNoCluster.java
@@ -25,7 +25,6 @@ import java.util.concurrent.atomic.AtomicLong;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
@@ -44,7 +43,7 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 /**
- * Test many concurrent appenders to an {@link #WAL} while rolling the log.
+ * Test many concurrent appenders to an WAL while rolling the log.
  */
 @Category({RegionServerTests.class, SmallTests.class})
 public class TestLogRollingNoCluster {
@@ -60,7 +59,6 @@ public class TestLogRollingNoCluster {
    */
   @Test
   public void testContendedLogRolling() throws IOException, InterruptedException {
-    FileSystem fs = FileSystem.get(TEST_UTIL.getConfiguration());
     Path dir = TEST_UTIL.getDataTestDir();
     // The implementation needs to know the 'handler' count.
     TEST_UTIL.getConfiguration().setInt(HConstants.REGION_SERVER_HANDLER_COUNT, THREAD_COUNT);


Mime
View raw message