You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "reswqa (via GitHub)" <gi...@apache.org> on 2023/12/05 07:06:27 UTC
Re: [PR] [FLINK-33502][network] Prevent DiskTierProducerAgent#getSegmentIdByIndexOfFirstBufferInSegment from throwing NPE when the task is released [flink]
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org