You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by dh...@apache.org on 2016/07/08 05:21:10 UTC

[1/2] incubator-beam git commit: Closes #600

Repository: incubator-beam
Updated Branches:
  refs/heads/master 921c55c94 -> 74e1f83df


Closes #600


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/74e1f83d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/74e1f83d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/74e1f83d

Branch: refs/heads/master
Commit: 74e1f83df651af61a98c388604d6cdd4f75d0ff5
Parents: 921c55c 543842c
Author: Dan Halperin <dh...@google.com>
Authored: Thu Jul 7 22:20:03 2016 -0700
Committer: Dan Halperin <dh...@google.com>
Committed: Thu Jul 7 22:20:03 2016 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/beam/sdk/io/OffsetBasedSource.java    | 6 +++---
 .../java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java   | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------



[2/2] incubator-beam git commit: [BEAM-381] BoundedReader: update the range last of all

Posted by dh...@apache.org.
[BEAM-381] BoundedReader: update the range last of all

Reorders the code in some splitAtFraction calls so that the rangeTracker update
is the last thing (besides assignment) in the function. This avoids a potential
issue if creating the primary or residual sources happens to throw an exception.


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/543842cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/543842cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/543842cb

Branch: refs/heads/master
Commit: 543842cbd9d433bcef9b7962d9c71a8779e99eb5
Parents: 921c55c
Author: Dan Halperin <dh...@google.com>
Authored: Wed Jul 6 23:05:56 2016 -0700
Committer: Dan Halperin <dh...@google.com>
Committed: Thu Jul 7 22:20:03 2016 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/beam/sdk/io/OffsetBasedSource.java    | 6 +++---
 .../java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java   | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/543842cb/sdks/java/core/src/main/java/org/apache/beam/sdk/io/OffsetBasedSource.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/io/OffsetBasedSource.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/io/OffsetBasedSource.java
index d5a6801..8cbcd1f 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/io/OffsetBasedSource.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/io/OffsetBasedSource.java
@@ -370,13 +370,13 @@ public abstract class OffsetBasedSource<T> extends BoundedSource<T> {
       LOG.debug(
           "Proposing to split OffsetBasedReader {} at fraction {} (offset {})",
           rangeTracker, fraction, splitOffset);
-      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);
+      if (!rangeTracker.trySplitAtPosition(splitOffset)) {
+        return null;
+      }
       this.source = primary;
       return residual;
     }

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/543842cb/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java
----------------------------------------------------------------------
diff --git a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java
index b4c3c75..0c485bf 100644
--- a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java
+++ b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigtable/BigtableIO.java
@@ -861,11 +861,11 @@ public class BigtableIO {
       }
       logger.debug(
           "Proposing to split {} at fraction {} (key {})", rangeTracker, fraction, splitKey);
+      BigtableSource primary = source.withEndKey(splitKey);
+      BigtableSource residual = source.withStartKey(splitKey);
       if (!rangeTracker.trySplitAtPosition(splitKey)) {
         return null;
       }
-      BigtableSource primary = source.withEndKey(splitKey);
-      BigtableSource residual = source.withStartKey(splitKey);
       this.source = primary;
       return residual;
     }