reswqa commented on code in PR #23863:
URL: https://github.com/apache/flink/pull/23863#discussion_r1414966335
##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/tier/disk/DiskTierProducerAgent.java:
##########
@@ -223,9 +228,16 @@ private void releaseResources() {
}
}
- private Integer retrieveFirstBufferIndexInSegment(int subpartitionId, int
bufferIndex) {
- return firstBufferIndexInSegment.size() > subpartitionId
- ?
firstBufferIndexInSegment.get(subpartitionId).get(bufferIndex)
- : null;
+ private Integer getSegmentIdByIndexOfFirstBufferInSegment(int
subpartitionId, int bufferIndex) {
+ Integer segmentId;
+ try {
+ segmentId =
firstBufferIndexInSegment.get(subpartitionId).get(bufferIndex);
Review Comment:
This name is a bit confuse, It looks like we will get the first buffer index
instead of the segment id. I propose rename this to
`firstBufferIndexToSegmentId`.
##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/tier/disk/DiskTierProducerAgent.java:
##########
@@ -223,9 +228,16 @@ private void releaseResources() {
}
}
- private Integer retrieveFirstBufferIndexInSegment(int subpartitionId, int
bufferIndex) {
- return firstBufferIndexInSegment.size() > subpartitionId
- ?
firstBufferIndexInSegment.get(subpartitionId).get(bufferIndex)
- : null;
+ private Integer getSegmentIdByIndexOfFirstBufferInSegment(int
subpartitionId, int bufferIndex) {
+ Integer segmentId;
+ try {
+ segmentId =
firstBufferIndexInSegment.get(subpartitionId).get(bufferIndex);
+ } catch (Exception e) {
Review Comment:
This is somehow a little hack to avoid `NPE`. Could we not clean up the
outer `list` when releasing?
--
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]