Revert "HBASE-12740 Improve performance of TestHBaseFsck"

Undo because Jurriaan Mous did update in meantime.

This reverts commit 042743fff0.
This commit is contained in:
stack 2014-12-30 12:19:14 -08:00
parent c6002ccd38
commit 734324e80f
5 changed files with 268 additions and 266 deletions

View File

@ -17,7 +17,6 @@
*/ */
package org.apache.hadoop.hbase.util; package org.apache.hadoop.hbase.util;
import java.io.Closeable;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
@ -185,7 +184,7 @@ import com.google.protobuf.ServiceException;
*/ */
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.TOOLS) @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.TOOLS)
@InterfaceStability.Evolving @InterfaceStability.Evolving
public class HBaseFsck extends Configured implements Closeable { public class HBaseFsck extends Configured {
public static final long DEFAULT_TIME_LAG = 60000; // default value of 1 minute public static final long DEFAULT_TIME_LAG = 60000; // default value of 1 minute
public static final long DEFAULT_SLEEP_BEFORE_RERUN = 10000; public static final long DEFAULT_SLEEP_BEFORE_RERUN = 10000;
private static final int MAX_NUM_THREADS = 50; // #threads to contact regions private static final int MAX_NUM_THREADS = 50; // #threads to contact regions
@ -396,8 +395,7 @@ public class HBaseFsck extends Configured implements Closeable {
Runtime.getRuntime().addShutdownHook(new Thread() { Runtime.getRuntime().addShutdownHook(new Thread() {
@Override @Override
public void run() { public void run() {
IOUtils.closeStream(HBaseFsck.this); unlockHbck();
unlockHbck();
} }
}); });
LOG.debug("Launching hbck"); LOG.debug("Launching hbck");
@ -613,11 +611,6 @@ public class HBaseFsck extends Configured implements Closeable {
return result; return result;
} }
@Override
public void close() throws IOException {
IOUtils.cleanup(null, admin, meta, connection);
}
private static class RegionBoundariesInformation { private static class RegionBoundariesInformation {
public byte [] regionName; public byte [] regionName;
public byte [] metaFirstKey; public byte [] metaFirstKey;
@ -4089,7 +4082,6 @@ public class HBaseFsck extends Configured implements Closeable {
public int run(String[] args) throws Exception { public int run(String[] args) throws Exception {
HBaseFsck hbck = new HBaseFsck(getConf()); HBaseFsck hbck = new HBaseFsck(getConf());
hbck.exec(hbck.executor, args); hbck.exec(hbck.executor, args);
hbck.close();
return hbck.getRetCode(); return hbck.getRetCode();
} }
}; };
@ -4308,7 +4300,7 @@ public class HBaseFsck extends Configured implements Closeable {
setRetCode(code); setRetCode(code);
} }
} finally { } finally {
IOUtils.cleanup(null, this); IOUtils.cleanup(null, connection, meta, admin);
} }
return this; return this;
} }

View File

@ -210,7 +210,7 @@ public class HBaseFsckRepair {
HRegion region = HRegion.createHRegion(hri, root, conf, htd, null); HRegion region = HRegion.createHRegion(hri, root, conf, htd, null);
// Close the new region to flush to disk. Close log file too. // Close the new region to flush to disk. Close log file too.
HRegion.closeHRegion(region); region.close();
return region; return region;
} }
} }

View File

@ -40,7 +40,7 @@ public class HbckTestingUtil {
public static HBaseFsck doFsck( public static HBaseFsck doFsck(
Configuration conf, boolean fix, TableName table) throws Exception { Configuration conf, boolean fix, TableName table) throws Exception {
return doFsck(conf, fix, fix, fix, fix, fix, fix, fix, fix, fix, fix, table); return doFsck(conf, fix, fix, fix, fix,fix, fix, fix, fix, fix, fix, table);
} }
public static HBaseFsck doFsck(Configuration conf, boolean fixAssignments, public static HBaseFsck doFsck(Configuration conf, boolean fixAssignments,
@ -66,7 +66,6 @@ public class HbckTestingUtil {
fsck.includeTable(table); fsck.includeTable(table);
} }
fsck.onlineHbck(); fsck.onlineHbck();
fsck.close();
return fsck; return fsck;
} }

View File

@ -25,6 +25,9 @@ import static org.junit.Assert.assertFalse;
import java.util.Arrays; import java.util.Arrays;
import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.MiscTests; import org.apache.hadoop.hbase.testclassification.MiscTests;
import org.apache.hadoop.hbase.util.HBaseFsck; import org.apache.hadoop.hbase.util.HBaseFsck;
@ -64,7 +67,6 @@ public class TestOfflineMetaRebuildHole extends OfflineMetaRebuildTestCore {
// attempt to rebuild meta table from scratch // attempt to rebuild meta table from scratch
HBaseFsck fsck = new HBaseFsck(conf); HBaseFsck fsck = new HBaseFsck(conf);
assertFalse(fsck.rebuildMeta(false)); assertFalse(fsck.rebuildMeta(false));
fsck.close();
// bring up the minicluster // bring up the minicluster
TEST_UTIL.startMiniZKCluster(); // tables seem enabled by default TEST_UTIL.startMiniZKCluster(); // tables seem enabled by default