szetszwo commented on code in PR #5522:
URL: https://github.com/apache/ozone/pull/5522#discussion_r1382436153
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/BlockManagerImpl.java:
##########
@@ -69,7 +69,7 @@ public class BlockManagerImpl implements BlockManager {
public BlockManagerImpl(ConfigurationSource conf) {
Preconditions.checkNotNull(conf, "Config cannot be null");
this.config = conf;
- this.defaultReadBufferCapacity = (long) config.getStorageSize(
+ this.defaultReadBufferCapacity = (int) config.getStorageSize(
Review Comment:
Check range before casting to `(int)`.
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/interfaces/ChunkManager.java:
##########
@@ -117,12 +117,12 @@ default StateMachine.DataChannel getStreamDataChannel(
return null;
}
- static long getBufferCapacityForChunkRead(ChunkInfo chunkInfo,
- long defaultReadBufferCapacity) {
- long bufferCapacity = 0;
+ static int getBufferCapacityForChunkRead(ChunkInfo chunkInfo,
+ int defaultReadBufferCapacity) {
+ int bufferCapacity = 0;
Review Comment:
Use `long` and check range.
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/FilePerChunkStrategy.java:
##########
@@ -229,8 +229,8 @@ public ChunkBuffer readChunk(Container container, BlockID
blockID,
possibleFiles.add(finalChunkFile);
}
- long len = info.getLen();
- long bufferCapacity = ChunkManager.getBufferCapacityForChunkRead(info,
+ int len = (int) info.getLen();
Review Comment:
`len` should be `long`.
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/common/utils/BufferUtils.java:
##########
@@ -39,8 +39,8 @@ private BufferUtils() {
* @param totalLen total length of all ByteBuffers
* @param bufferCapacity max capacity of each ByteBuffer
*/
- public static ByteBuffer[] assignByteBuffers(long totalLen,
- long bufferCapacity) {
+ public static ByteBuffer[] assignByteBuffers(int totalLen,
Review Comment:
The `totalLen` and `buffersAllocated` should be long. We should allow >= 2G
chunks.
--
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]