HBASE-9827 Intermittent TestLogRollingNoCluster#testContendedLogRolling failure
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1535254 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6be9b4effe
commit
bccd10de11
|
@ -27,7 +27,6 @@ import java.net.URLEncoder;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -50,13 +49,12 @@ import org.apache.hadoop.fs.FileStatus;
|
|||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.fs.Syncable;
|
||||
import org.apache.hadoop.hbase.TableName;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.HRegionInfo;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.hbase.KeyValue;
|
||||
import org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost;
|
||||
import org.apache.hadoop.hbase.TableName;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
import org.apache.hadoop.hbase.util.ClassSize;
|
||||
import org.apache.hadoop.hbase.util.DrainBarrier;
|
||||
|
@ -499,6 +497,10 @@ class FSHLog implements HLog, Syncable {
|
|||
}
|
||||
this.filenum = System.currentTimeMillis();
|
||||
Path newPath = computeFilename();
|
||||
while (fs.exists(newPath)) {
|
||||
this.filenum++;
|
||||
newPath = computeFilename();
|
||||
}
|
||||
|
||||
// Tell our listeners that a new log is about to be created
|
||||
if (!this.listeners.isEmpty()) {
|
||||
|
|
|
@ -711,6 +711,24 @@ public class TestHLog {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailedToCreateHLogIfParentRenamed() throws IOException {
|
||||
FSHLog log = (FSHLog)HLogFactory.createHLog(
|
||||
fs, hbaseDir, "testFailedToCreateHLogIfParentRenamed", conf);
|
||||
long filenum = System.currentTimeMillis();
|
||||
Path path = log.computeFilename(filenum);
|
||||
HLogFactory.createWALWriter(fs, path, conf);
|
||||
Path parent = path.getParent();
|
||||
path = log.computeFilename(filenum + 1);
|
||||
Path newPath = new Path(parent.getParent(), parent.getName() + "-splitting");
|
||||
fs.rename(parent, newPath);
|
||||
try {
|
||||
HLogFactory.createWALWriter(fs, path, conf);
|
||||
fail("It should fail to create the new WAL");
|
||||
} catch (IOException ioe) {
|
||||
// expected, good.
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetServerNameFromHLogDirectoryName() throws IOException {
|
||||
|
|
Loading…
Reference in New Issue