Skip to content

Commit 42c3f64

Browse files
committed
update
1 parent ea3d87d commit 42c3f64

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueHandler.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,7 @@ private HandlerWithVolumeSet createKeyValueHandlerWithVolumeSet(Path path) throw
10091009
@Test
10101010
public void testReadBlockMetrics() throws Exception {
10111011
Path testDir = Files.createTempDirectory("testReadBlockMetrics");
1012+
RandomAccessFileChannel blockFile = null;
10121013
try {
10131014
conf.set(OZONE_SCM_CONTAINER_LAYOUT_KEY, ContainerLayoutVersion.FILE_PER_BLOCK.name());
10141015
HandlerWithVolumeSet handlerWithVolume = createKeyValueHandlerWithVolumeSet(testDir);
@@ -1067,7 +1068,7 @@ public void onCompleted() {
10671068
}
10681069
};
10691070

1070-
RandomAccessFileChannel blockFile = new RandomAccessFileChannel();
1071+
blockFile = new RandomAccessFileChannel();
10711072
ContainerCommandResponseProto response = kvHandler.readBlock(
10721073
readBlockRequest, container, blockFile, streamObserver);
10731074

@@ -1078,6 +1079,9 @@ public void onCompleted() {
10781079
ContainerMetrics.STORAGE_CONTAINER_METRICS);
10791080
assertCounter("bytesReadBlock", 1024L, containerMetrics);
10801081
} finally {
1082+
if (blockFile != null) {
1083+
blockFile.close();
1084+
}
10811085
FileUtils.deleteDirectory(testDir.toFile());
10821086
ContainerMetrics.remove();
10831087
}

0 commit comments

Comments
 (0)