beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (BEAM-3876) unbounded source can not have any checkpoint when they end (no data case)
Date Mon, 19 Mar 2018 17:26:00 GMT

     [ https://issues.apache.org/jira/browse/BEAM-3876?focusedWorklogId=81931&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-81931
]

ASF GitHub Bot logged work on BEAM-3876:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 19/Mar/18 17:25
            Start Date: 19/Mar/18 17:25
    Worklog Time Spent: 10m 
      Work Description: rmannibucau commented on a change in pull request #4894: [BEAM-3876]
avoid NPE if checkpoint is null in an unbounded source
URL: https://github.com/apache/beam/pull/4894#discussion_r175519039
 
 

 ##########
 File path: runners/direct-java/src/main/java/org/apache/beam/runners/direct/UnboundedReadEvaluatorFactory.java
 ##########
 @@ -171,10 +171,28 @@ public void processElement(
                         watermark)));
           } else {
             // End of input. Close the reader after finalizing old checkpoint.
-            shard.getCheckpoint().finalizeCheckpoint();
-            UnboundedReader<?> toClose = reader;
-            reader = null; // Avoid double close below in case of an exception.
-            toClose.close();
+            // note: can be null for empty datasets so ensure to null check the checkpoint
+            final CheckpointMarkT checkpoint = shard.getCheckpoint();
+            IOException ioe = null;
+            try {
+              if (checkpoint != null) {
+                checkpoint.finalizeCheckpoint();
+              }
+            } catch (final IOException finalizeCheckpointException) {
+              ioe = finalizeCheckpointException;
+            } finally {
+              try {
+                UnboundedReader<?> toClose = reader;
+                reader = null; // Avoid double close below in case of an exception.
+                toClose.close();
+              } catch (final IOException closeEx) {
+                if (ioe != null) {
+                  ioe.addSuppressed(closeEx);
+                } else {
+                  throw closeEx;
+                }
+              }
 
 Review comment:
   good catch, updated, thanks!

----------------------------------------------------------------
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:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 81931)
    Time Spent: 40m  (was: 0.5h)

> unbounded source can not have any checkpoint when they end (no data case)
> -------------------------------------------------------------------------
>
>                 Key: BEAM-3876
>                 URL: https://issues.apache.org/jira/browse/BEAM-3876
>             Project: Beam
>          Issue Type: Bug
>          Components: runner-direct
>    Affects Versions: 2.4.0
>            Reporter: Romain Manni-Bucau
>            Assignee: Romain Manni-Bucau
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message