[NO ISSUE][CLUS] Order Cluster Partition Constraints Similar to Node Groups

- user model changes: no
- storage format changes: no
- interface changes: no

Details:

- Order the list of nodes in the cluster partition constraints
  using the same ordering as nodegroups to allow data source
  functions attempting to access storage to be routed to the
  correct storage partition.

Change-Id: Iba193bccb0c9c28f24e8d7136ce394abf780fa00
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/8783
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Reviewed-by: Ali Alsuliman <ali.al.solaiman@gmail.com>
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/ClusterStateManager.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/ClusterStateManager.java
index 7933cd2..2c05c53 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/ClusterStateManager.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/utils/ClusterStateManager.java
@@ -299,6 +299,8 @@
             }
         }
         clusterActiveLocations.removeAll(pendingRemoval);
+        // for operators attempting to access storage, order the nodes list similar to a nodegroup
+        Collections.sort(clusterActiveLocations);
         clusterPartitionConstraint =
                 new AlgebricksAbsolutePartitionConstraint(clusterActiveLocations.toArray(new String[] {}));
     }