You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2013/02/28 03:41:59 UTC
svn commit: r1451077 - in /hbase/branches/0.94/src:
main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java
test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java
Author: tedyu
Date: Thu Feb 28 02:41:59 2013
New Revision: 1451077
URL: http://svn.apache.org/r1451077
Log:
HBASE-7878 revert due to TestHLogSplit test failure
Modified:
hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java
hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java
Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java?rev=1451077&r1=1451076&r2=1451077&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/util/FSHDFSUtils.java Thu Feb 28 02:41:59 2013
@@ -50,8 +50,6 @@ public class FSHDFSUtils extends FSUtils
* in o.a.h.hdfs.protocol.HdfsConstants cause of HDFS-1620.
*/
public static final long LEASE_SOFTLIMIT_PERIOD = 60 * 1000;
-
- public static final String TEST_TRIGGER_DFS_APPEND = "hbase.test.trigger.dfs.append";
@Override
public void recoverFileLease(final FileSystem fs, final Path p, Configuration conf)
@@ -70,23 +68,13 @@ public class FSHDFSUtils extends FSUtils
// Trying recovery
boolean recovered = false;
- long recoveryTimeout = conf.getInt("hbase.lease.recovery.timeout", 300000);
- // conf parameter passed from unit test, indicating whether fs.append() should be triggered
- boolean triggerAppend = conf.getBoolean(TEST_TRIGGER_DFS_APPEND, false);
- Exception ex = null;
while (!recovered) {
try {
try {
if (fs instanceof DistributedFileSystem) {
DistributedFileSystem dfs = (DistributedFileSystem)fs;
- if (triggerAppend) throw new IOException("recoverFileLease");
- try {
- recovered = (Boolean) DistributedFileSystem.class.getMethod(
- "recoverLease", new Class[] { Path.class }).invoke(dfs, p);
- } catch (InvocationTargetException ite) {
- // function was properly called, but threw it's own exception
- throw (IOException) ite.getCause();
- }
+ DistributedFileSystem.class.getMethod("recoverLease",
+ new Class[] {Path.class}).invoke(dfs, p);
} else {
throw new Exception("Not a DistributedFileSystem");
}
@@ -95,17 +83,11 @@ public class FSHDFSUtils extends FSUtils
throw (IOException) ite.getCause();
} catch (Exception e) {
LOG.debug("Failed fs.recoverLease invocation, " + e.toString() +
- ", trying fs.append instead");
- ex = e;
- }
- if (ex != null || System.currentTimeMillis() - startWaiting > recoveryTimeout) {
- ex = null; // assume the following append() call would succeed
- LOG.debug("recoverLease times out after " + recoveryTimeout + " ms. Calling append");
+ ", trying fs.append instead");
FSDataOutputStream out = fs.append(p);
out.close();
- recovered = true;
}
- if (recovered) break;
+ recovered = true;
} catch (IOException e) {
e = RemoteExceptionHandler.checkIOException(e);
if (e instanceof AlreadyBeingCreatedException) {
@@ -129,9 +111,9 @@ public class FSHDFSUtils extends FSUtils
}
try {
Thread.sleep(1000);
- } catch (InterruptedException ie) {
+ } catch (InterruptedException ex) {
InterruptedIOException iioe = new InterruptedIOException();
- iioe.initCause(ie);
+ iioe.initCause(ex);
throw iioe;
}
}
Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java?rev=1451077&r1=1451076&r2=1451077&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java (original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java Thu Feb 28 02:41:59 2013
@@ -42,7 +42,6 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.*;
import org.apache.hadoop.hbase.regionserver.wal.HLog.Reader;
import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.FSHDFSUtils;
import org.apache.hadoop.hbase.util.FSUtils;
import org.apache.hadoop.hbase.Coprocessor;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
@@ -53,6 +52,7 @@ import org.apache.hadoop.hdfs.MiniDFSClu
import org.apache.hadoop.hdfs.protocol.FSConstants;
import org.apache.hadoop.hdfs.server.datanode.DataNode;
import org.apache.hadoop.hdfs.server.namenode.LeaseManager;
+import org.apache.hadoop.io.SequenceFile;
import org.apache.log4j.Level;
import org.junit.After;
import org.junit.AfterClass;
@@ -81,7 +81,7 @@ public class TestHLog {
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static Path hbaseDir;
private static Path oldLogDir;
-
+
@Before
public void setUp() throws Exception {
@@ -101,7 +101,6 @@ public class TestHLog {
// Make block sizes small.
TEST_UTIL.getConfiguration().setInt("dfs.blocksize", 1024 * 1024);
// needed for testAppendClose()
- TEST_UTIL.getConfiguration().setBoolean("dfs.support.broken.append", true);
TEST_UTIL.getConfiguration().setBoolean("dfs.support.append", true);
// quicker heartbeat interval for faster DN death notification
TEST_UTIL.getConfiguration().setInt("heartbeat.recheck.interval", 5000);
@@ -371,29 +370,17 @@ public class TestHLog {
}
}
- /*
- * We pass different values to recoverFileLease() so that different code paths are covered
- *
- * For this test to pass, requires:
- * 1. HDFS-200 (append support)
- * 2. HDFS-988 (SafeMode should freeze file operations
- * [FSNamesystem.nextGenerationStampForBlock])
- * 3. HDFS-142 (on restart, maintain pendingCreates)
- */
+ // For this test to pass, requires:
+ // 1. HDFS-200 (append support)
+ // 2. HDFS-988 (SafeMode should freeze file operations
+ // [FSNamesystem.nextGenerationStampForBlock])
+ // 3. HDFS-142 (on restart, maintain pendingCreates)
@Test
public void testAppendClose() throws Exception {
- testAppendClose(true);
- testAppendClose(false);
- }
-
- /*
- * @param triggerDirectAppend whether to trigger direct call of fs.append()
- */
- public void testAppendClose(final boolean triggerDirectAppend) throws Exception {
byte [] tableName = Bytes.toBytes(getName());
HRegionInfo regioninfo = new HRegionInfo(tableName,
HConstants.EMPTY_START_ROW, HConstants.EMPTY_END_ROW, false);
- Path subdir = new Path(dir, "hlogdir-" + triggerDirectAppend);
+ Path subdir = new Path(dir, "hlogdir");
Path archdir = new Path(dir, "hlogdir_archive");
HLog wal = new HLog(fs, subdir, archdir, conf);
final int total = 20;
@@ -467,7 +454,6 @@ public class TestHLog {
public Exception exception = null;
public void run() {
try {
- rlConf.setBoolean(FSHDFSUtils.TEST_TRIGGER_DFS_APPEND, triggerDirectAppend);
FSUtils.getInstance(fs, rlConf)
.recoverFileLease(recoveredFs, walPath, rlConf);
} catch (IOException e) {