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

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

                Author: ASF GitHub Bot
            Created on: 27/Apr/20 10:35
            Start Date: 27/Apr/20 10:35
    Worklog Time Spent: 10m 
      Work Description: mxm commented on a change in pull request #11530:
URL: https://github.com/apache/beam/pull/11530#discussion_r415698500



##########
File path: 
runners/flink/src/test/java/org/apache/beam/runners/flink/batch/ReshuffleTest.java
##########
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.runners.flink.batch;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.beam.runners.flink.FlinkPipelineOptions;
+import org.apache.beam.runners.flink.FlinkTestPipeline;
+import org.apache.beam.sdk.Pipeline;
+import org.apache.beam.sdk.testing.PAssert;
+import org.apache.beam.sdk.transforms.Create;
+import org.apache.beam.sdk.transforms.DoFn;
+import org.apache.beam.sdk.transforms.ParDo;
+import org.apache.beam.sdk.transforms.Reshuffle;
+import org.apache.beam.sdk.values.PCollection;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ReshuffleTest {
+
+  private static class WithBundleIdFn extends DoFn<String, String> {
+
+    private String uuid;
+
+    @StartBundle
+    public void startBundle() {
+      uuid = UUID.randomUUID().toString();
+    }
+
+    @ProcessElement
+    public void processElement(ProcessContext ctx) {
+      ctx.output(ctx.element() + "@" + uuid);
+    }
+  }
+
+  @Test
+  public void testMultipleReshufflesOnBatch() {

Review comment:
       Or change the name, e.g. 
`testEqualDistributionOnReshuffleAcrossMultipleStages` or something catchier ;)




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


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

    Worklog Id:     (was: 427584)
    Time Spent: 0.5h  (was: 20m)

> Multiple reshuffles are ignored in some cases on Flink batch runner.
> --------------------------------------------------------------------
>
>                 Key: BEAM-9824
>                 URL: https://issues.apache.org/jira/browse/BEAM-9824
>             Project: Beam
>          Issue Type: Bug
>          Components: runner-flink
>    Affects Versions: 2.19.0, 2.20.0
>            Reporter: David Morávek
>            Assignee: David Morávek
>            Priority: Major
>             Fix For: 2.22.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Multiple reshuffles are ignored in some cases on Flink batch runner. This may 
> lead to huge performace penalty in IO connectors (when reshuffling splits).
> In flink optimizer, when we `.rebalance()` dataset, is output channel is 
> marked as `FORCED_REBALANCED`. When we chain this with another 
> `.rebalance()`, the latter is ignored because it's source is already 
> `FORCED_REBALANCED`, thus requested property is met. This is correct beaviour 
> because rebalance is idempotent.
> When we include `flatMap` in between rebalances -> 
> `.rebalance().flatMap(...).rebalance()`, we need to reshuffle again, because 
> dataset distribution may have changed (eg. you can possibli emit unbouded 
> stream from a single element). Unfortunatelly `flatMap` output is still 
> incorrectly marked as `FORCED_REBALANCED` and the second reshuffle gets 
> ignored.
> This especially affects IO connectors -> `FileIO.match()` returns reshuffled 
> list of matched files -> we split each file into ranges -> **reshuffle** -> 
> read. Ignoring the second reshuffle leads to huge perf. degradation (5m -> 2h 
> in one of our production pipelines)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to