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

This commit is contained in:
stack 2015-09-10 20:25:36 -07:00
parent bf26088d7b
commit 411b516f51
2 changed files with 10 additions and 18 deletions

View File

@ -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;
}
}
}

View File

@ -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);