duongkame commented on code in PR #6923:
URL: https://github.com/apache/ozone/pull/6923#discussion_r1674936779
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/FilePerBlockStrategy.java:
##########
@@ -307,11 +310,14 @@ public FileChannel getChannel(File file, boolean sync)
}
}
- private static OpenFile open(File file, boolean sync) {
+ private static OpenFile open(Container container, BlockID blockID, boolean
sync) {
try {
+ File file = getChunkFile(container, blockID);
return new OpenFile(file, sync);
} catch (FileNotFoundException e) {
throw new UncheckedIOException(e);
+ } catch (StorageContainerException e) {
Review Comment:
nit: this catch block can be compacted to the previous catch block.
```
} catch (FileNotFoundException | StorageContainerException e) {
throw new UncheckedIOException(e);
}
```
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/FilePerBlockStrategy.java:
##########
@@ -137,34 +138,36 @@ public void writeChunk(Container container, BlockID
blockID, ChunkInfo info,
KeyValueContainerData containerData = (KeyValueContainerData) container
.getContainerData();
- final File chunkFile = getChunkFile(container, blockID);
long len = info.getLen();
long offset = info.getOffset();
HddsVolume volume = containerData.getVolume();
FileChannel channel = null;
+ OpenFile openFile = null;
Review Comment:
```suggestion
final OpenFile openFile;
```
no need to preinit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]