kaijchen commented on a change in pull request #3118:
URL: https://github.com/apache/ozone/pull/3118#discussion_r811535884
##########
File path:
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECKeyOutputStream.java
##########
@@ -558,13 +558,17 @@ private void handleStripeFailure(int lastStripeSize,
private void addPadding(int parityCellSize) {
ByteBuffer[] buffers = ecChunkBufferCache.getDataBuffers();
-
- for (int i = 1; i < numDataBlks; i++) {
- final int position = buffers[i].position();
- assert position <= parityCellSize : "If an internal block is smaller"
- + " than parity block, then its last cell should be small than last"
- + " parity cell";
- padBufferToLimit(buffers[i], parityCellSize);
+ int maxSize = 0;
Review comment:
It could be simplified to this.
```java
int maxSize = parityCellSize;
for (int i = 0; i < numDataBlks; i++) {
maxSize = Math.max(maxSize, buffers[i].position());
}
```
But parityCellSize shouldn't be smaller than position of any buffers,
because `lastStripeSize` is the sum of all positions.
https://github.com/apache/ozone/blob/60a41bc85e1657344a2b2029ad21e7fab741b711/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECKeyOutputStream.java#L518-L520
--
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]