HBASE-5038 Some tests leak connections

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1214839 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-12-15 16:20:41 +00:00
parent 5543c548c4
commit 32490bddce
6 changed files with 18 additions and 2 deletions

View File

@ -382,6 +382,7 @@ public class RegionSplitter {
Thread.sleep(10 * 1000); // sleep Thread.sleep(10 * 1000); // sleep
} }
} }
table.close();
} }
LOG.debug("Finished creating table with " + splitCount + " regions"); LOG.debug("Finished creating table with " + splitCount + " regions");
@ -566,7 +567,7 @@ public class RegionSplitter {
} }
} }
} }
LOG.debug("All regions have been sucesfully split!"); LOG.debug("All regions have been successfully split!");
} finally { } finally {
long tDiff = System.currentTimeMillis() - startTime; long tDiff = System.currentTimeMillis() - startTime;
LOG.debug("TOTAL TIME = " LOG.debug("TOTAL TIME = "
@ -576,6 +577,9 @@ public class RegionSplitter {
+ org.apache.hadoop.util.StringUtils.formatTime(tDiff / splitCount)); + org.apache.hadoop.util.StringUtils.formatTime(tDiff / splitCount));
splitOut.close(); splitOut.close();
if (table != null){
table.close();
}
} }
fs.delete(splitFile, false); fs.delete(splitFile, false);
} }

View File

@ -140,6 +140,7 @@ public class TestHCM {
conn.deleteCachedLocation(TABLE_NAME, ROW); conn.deleteCachedLocation(TABLE_NAME, ROW);
HRegionLocation rl = conn.getCachedLocation(TABLE_NAME, ROW); HRegionLocation rl = conn.getCachedLocation(TABLE_NAME, ROW);
assertNull("What is this location?? " + rl, rl); assertNull("What is this location?? " + rl, rl);
conn.close();
table.close(); table.close();
} }

View File

@ -226,6 +226,7 @@ public class TestColumnRangeFilter {
} }
} }
long scanTime = System.currentTimeMillis() - timeBeforeScan; long scanTime = System.currentTimeMillis() - timeBeforeScan;
scanner.close();
LOG.info("scan time = " + scanTime + "ms"); LOG.info("scan time = " + scanTime + "ms");
LOG.info("found " + results.size() + " results"); LOG.info("found " + results.size() + " results");
LOG.info("Expecting " + rangeMap.get(s).size() + " results"); LOG.info("Expecting " + rangeMap.get(s).size() + " results");

View File

@ -116,6 +116,8 @@ public class TestHalfStoreFileReader {
int ret = scanner.reseekTo(getLastOnCol(curr).getKey()); int ret = scanner.reseekTo(getLastOnCol(curr).getKey());
//System.out.println("Last reseek: " + ret); //System.out.println("Last reseek: " + ret);
assertTrue( ret > 0 ); assertTrue( ret > 0 );
halfreader.close(true);
} }
private KeyValue getLastOnCol(KeyValue curr) { private KeyValue getLastOnCol(KeyValue curr) {

View File

@ -124,6 +124,8 @@ public class TestStoreFileBlockCacheSummary {
assertEquals("table", TEST_TABLE2, e.getTable()); assertEquals("table", TEST_TABLE2, e.getTable());
assertEquals("cf", TEST_CF, e.getColumnFamily()); assertEquals("cf", TEST_CF, e.getColumnFamily());
ht.close();
ht2.close();
} }
private void addRows(HTable ht, byte[] family) throws IOException { private void addRows(HTable ht, byte[] family) throws IOException {

View File

@ -126,7 +126,13 @@ public class TestHBaseFsck {
assertNoErrors(doFsck(conf, false)); assertNoErrors(doFsck(conf, false));
// comment needed - what is the purpose of this line // comment needed - what is the purpose of this line
new HTable(conf, Bytes.toBytes(table)).getScanner(new Scan()); HTable t = new HTable(conf, Bytes.toBytes(table));
ResultScanner s = t.getScanner(new Scan());
s.close();
t.close();
scanner.close();
meta.close();
} }
private HRegionInfo createRegion(Configuration conf, final HTableDescriptor private HRegionInfo createRegion(Configuration conf, final HTableDescriptor