Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-33123

Wrong dynamic replacement of partitioner from FORWARD to REBLANCE for autoscaler and adaptive scheduler

    XMLWordPrintableJSON

Details

    • Bug
    • Status: In Progress
    • Critical
    • Resolution: Unresolved
    • 1.17.0, 1.18.0
    • None
    • None

    Description

      Background

      https://issues.apache.org/jira/browse/FLINK-30213 reported that the edge is wrong when the parallelism is changed for a vertex with a FORWARD edge, which is used by both the autoscaler and adaptive scheduler where one can change the vertex parallelism dynamically. Fix is applied to dynamically replace partitioner from FORWARD to REBLANCE on task deployment in StreamTask
       

      Problem

      Unfortunately, the fix is still buggy in two aspects:

      1. The connections between upstream and downstream tasks are determined by the distribution type of the partitioner when generating execution graph on the JM side. When the edge is FORWARD, the distribution type is POINTWISE, and Flink will try to evenly distribute subpartitions to all downstream tasks. If one want to change it to REBALANCE, the distribution type has to be changed to ALL_TO_ALL to make all-to-all connections between upstream and downstream tasks. However, the fix did not change the distribution type which makes the network connections be set up in a wrong way.
      2. The FOWARD partitioner will be replaced if environment.getWriter(outputIndex).getNumberOfSubpartitions() equals to the task parallelism. However, the number of subpartitions here equals to the number of downstream tasks of this particular task, which is also determined by the distribution type of the partitioner when generating execution graph on the JM side.  When ceil(downstream task parallelism / upstream task parallelism) = upstream task parallelism, we will have the number of subpartitions = task parallelism. For example, for a topology A (parallelism 2) -> B (parallelism 5), we will have 1 A task having 2 subpartitions, 1 A task having 3 subpartition, and hence 1 task will have its number of subpartitions equals to the task parallelism 2 and skip partitioner replacement. As a result, that task will only send data to only one downstream task as the FORWARD partitioner always send data to the first subpartition. In fact, for a normal job with a FORWARD edge without any autoscaling action, you will find that the partitioner is changed to REBALANCE internally as the number of subpartitions always equals to 1 in this case.

      Attachments

        1. image-2023-09-20-15-09-22-733.png
          127 kB
          Zhanghao Chen
        2. image-2023-09-20-15-14-04-679.png
          124 kB
          Zhanghao Chen

        Issue Links

          Activity

            People

              dmvk David Morávek
              Zhanghao Chen Zhanghao Chen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: