Github user vrozov commented on a diff in the pull request:

    https://github.com/apache/apex-core/pull/359#discussion_r71728748
  
    --- Diff: 
engine/src/main/java/com/datatorrent/stram/plan/physical/PhysicalPlan.java ---
    @@ -895,8 +895,10 @@ private void redoPartitions(PMapping currentMapping, 
String note)
             addedPartitions.add(newPartition);
           } else {
             // check whether mapping was changed
    +        int currentPartitionsSize = mainPC.currentPartitions.size();
             for (DefaultPartition<Operator> pi : mainPC.currentPartitions) {
    -          if (pi == newPartition && pi.isModified()) {
    +          if (pi == newPartition && (pi.isModified() ||
    --- End diff --
    
    @tweise Thomas, are partitions in `mainPC.currentPartitions` unique? It 
looks like, there are. Should in this case currentPartitions be declared as 
HashSet instead of ArrayList to explicitly enforce uniqueness? It should be 
also possible to avoid iterating over currentPartitions
    ```
          if (op == null) {
            addedPartitions.add(newPartition);
          } else if (((DefaultPartition)newPartition).isModified()) {
            // check whether mapping was changed
            for (DefaultPartition<Operator> currentPartition : 
mainPC.currentPartitions) {
              if (currentPartition == newPartition) {
                // existing partition changed (operator or partition keys)
                // remove/add to update subscribers and state
                mainPC.currentPartitionMap.put(newPartition, op);
                addedPartitions.add(newPartition);
                break;
              }
            }
          }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to