NicoK commented on a change in pull request #6705: [FLINK-10356][network] add 
sanity checks to SpillingAdaptiveSpanningRecordDeserializer
URL: https://github.com/apache/flink/pull/6705#discussion_r252359412
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/api/serialization/SpillingAdaptiveSpanningRecordDeserializer.java
 ##########
 @@ -575,6 +615,18 @@ private void 
moveRemainderToNonSpanningDeserializer(NonSpanningWrapper deseriali
                        }
                }
 
+               private int getRemainingBytes() {
+                       if (this.spillFileReader == null) {
+                               return this.serializationReadBuffer.available();
+                       } else {
+                               try {
+                                       return this.spillFileReader.available();
+                               } catch (IOException ignored) {
 
 Review comment:
   Hmm - it may look dangerous but honestly, if retrieving the number of 
remaining bytes gets to some error, it will still be an error when trying to 
continue retrieving actual data (if we even do so). Since this is only used for 
better error reporting, I didn't want to add another source of errors.
   I could maybe rename the method to state that it tolerates failures so that 
it is not confusing for future users, e.g. `getRemainingBytesOrZero()`. How 
about that instead?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to