beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Halperin (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (BEAM-381) OffsetBasedReader should construct sources before updating the range tracker
Date Fri, 08 Jul 2016 05:22:11 GMT

     [ https://issues.apache.org/jira/browse/BEAM-381?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Daniel Halperin resolved BEAM-381.
----------------------------------
    Resolution: Fixed

> OffsetBasedReader should construct sources before updating the range tracker
> ----------------------------------------------------------------------------
>
>                 Key: BEAM-381
>                 URL: https://issues.apache.org/jira/browse/BEAM-381
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>    Affects Versions: 0.1.0-incubating, 0.2.0-incubating
>            Reporter: Daniel Halperin
>            Assignee: Daniel Halperin
>             Fix For: 0.2.0-incubating
>
>
> OffsetBasedReader has the following code:
> {code}
>       if (!rangeTracker.trySplitAtPosition(splitOffset)) {
>         return null;
>       }
>       long start = source.getStartOffset();
>       long end = source.getEndOffset();
>       OffsetBasedSource<T> primary = source.createSourceForSubrange(start, splitOffset);
>       OffsetBasedSource<T> residual = source.createSourceForSubrange(splitOffset,
end);
>       this.source = primary;
>       return residual;
> {code}
> The first line is the line that updates the range of this source. However, subsequent
lines might throw (specifically, in source.createSourceForSubrange). We should construct the
sources first, and then catch exceptions and return null if they fail. This way, the splitAtFraction
call will not throw (so work is not wasted) and the range tracker will not be updated if either
the primary or (more likely) the residual could not be created.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message