HBASE-5030 Some tests do not close the HFile.Reader they use, leaving some file descriptors open (N Keywal)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1214519 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2011-12-14 22:52:45 +00:00
parent e85d2d45d3
commit 6b60585fef
7 changed files with 14 additions and 0 deletions

View File

@ -90,6 +90,8 @@ public class TestHalfStoreFileReader {
Reference top = new Reference(midkey, Reference.Range.top); Reference top = new Reference(midkey, Reference.Range.top);
doTestOfScanAndReseek(p, fs, top, cacheConf); doTestOfScanAndReseek(p, fs, top, cacheConf);
r.close();
} }
private void doTestOfScanAndReseek(Path p, FileSystem fs, Reference bottom, private void doTestOfScanAndReseek(Path p, FileSystem fs, Reference bottom,

View File

@ -572,6 +572,7 @@ public class TestHFileBlockIndex {
reader.getTrailer().getUncompressedDataIndexSize()); reader.getTrailer().getUncompressedDataIndexSize());
reader.close(); reader.close();
reader2.close();
} }
} }

View File

@ -261,6 +261,7 @@ public class TestHFilePerformance extends TestCase {
} }
break; break;
} }
reader.close();
} else if("SequenceFile".equals(fileType)){ } else if("SequenceFile".equals(fileType)){
SequenceFile.Reader reader; SequenceFile.Reader reader;

View File

@ -87,6 +87,8 @@ public class TestReseekTo {
scanner.reseekTo(Bytes.toBytes(key)); scanner.reseekTo(Bytes.toBytes(key));
assertEquals(value, scanner.getValueString()); assertEquals(value, scanner.getValueString());
} }
reader.close();
} }

View File

@ -93,6 +93,8 @@ public class TestSeekTo extends HBaseTestCase {
assertEquals("i", toRowStr(scanner.getKeyValue())); assertEquals("i", toRowStr(scanner.getKeyValue()));
assertEquals(true, scanner.seekBefore(toKV("l").getKey())); assertEquals(true, scanner.seekBefore(toKV("l").getKey()));
assertEquals("k", toRowStr(scanner.getKeyValue())); assertEquals("k", toRowStr(scanner.getKeyValue()));
reader.close();
} }
public void testSeekTo() throws Exception { public void testSeekTo() throws Exception {
@ -113,6 +115,8 @@ public class TestSeekTo extends HBaseTestCase {
assertEquals(1, scanner.seekTo(toKV("l").getKey())); assertEquals(1, scanner.seekTo(toKV("l").getKey()));
assertEquals("k", toRowStr(scanner.getKeyValue())); assertEquals("k", toRowStr(scanner.getKeyValue()));
reader.close();
} }
public void testBlockContainingKey() throws Exception { public void testBlockContainingKey() throws Exception {
@ -144,6 +148,8 @@ public class TestSeekTo extends HBaseTestCase {
toKV("k").getKey(), 0, klen)); toKV("k").getKey(), 0, klen));
assertEquals(1, blockIndexReader.rootBlockContainingKey( assertEquals(1, blockIndexReader.rootBlockContainingKey(
toKV("l").getKey(), 0, klen)); toKV("l").getKey(), 0, klen));
reader.close();
} }
@org.junit.Rule @org.junit.Rule

View File

@ -296,6 +296,7 @@ public class TestHFileOutputFormat {
"...." + timeRangeTracker.getMaximumTimestamp()); "...." + timeRangeTracker.getMaximumTimestamp());
assertEquals(1000, timeRangeTracker.getMinimumTimestamp()); assertEquals(1000, timeRangeTracker.getMinimumTimestamp());
assertEquals(2000, timeRangeTracker.getMaximumTimestamp()); assertEquals(2000, timeRangeTracker.getMaximumTimestamp());
rd.close();
} finally { } finally {
if (writer != null && context != null) writer.close(context); if (writer != null && context != null) writer.close(context);
dir.getFileSystem(conf).delete(dir, true); dir.getFileSystem(conf).delete(dir, true);

View File

@ -191,6 +191,7 @@ public class TestLoadIncrementalHFiles {
count++; count++;
} while (scanner.next()); } while (scanner.next());
assertTrue(count > 0); assertTrue(count > 0);
reader.close();
return count; return count;
} }