You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2018/08/10 05:13:19 UTC
asterixdb git commit: [NO ISSUE][COMP] Ensure Consistent Locations in
Splits and Constraints
Repository: asterixdb
Updated Branches:
refs/heads/master b674b1b54 -> 107c2059d
[NO ISSUE][COMP] Ensure Consistent Locations in Splits and Constraints
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- This change ensures that the splits provider and constraints
have the same order of locations to avoid a possibility where
splits of a node are assigned to another node.
Change-Id: Id969251eb17bfb5139bc656b1e5025c2742d5318
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2872
Reviewed-by: Michael Blow <mb...@apache.org>
Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/107c2059
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/107c2059
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/107c2059
Branch: refs/heads/master
Commit: 107c2059dec2e493eff891a112b69319886df1c2
Parents: b674b1b
Author: Murtadha Hubail <mh...@apache.org>
Authored: Thu Aug 9 18:16:12 2018 -0700
Committer: Michael Blow <mb...@apache.org>
Committed: Thu Aug 9 22:11:34 2018 -0700
----------------------------------------------------------------------
.../java/org/apache/asterix/common/utils/StoragePathUtil.java | 5 +++++
.../constraints/AlgebricksAbsolutePartitionConstraint.java | 3 +--
2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/107c2059/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/StoragePathUtil.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/StoragePathUtil.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/StoragePathUtil.java
index aa2c7af..63e29ce 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/StoragePathUtil.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/StoragePathUtil.java
@@ -21,6 +21,8 @@ package org.apache.asterix.common.utils;
import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.Comparator;
import org.apache.asterix.common.cluster.ClusterPartition;
import org.apache.asterix.common.storage.ResourceReference;
@@ -39,12 +41,15 @@ import org.apache.logging.log4j.Logger;
public class StoragePathUtil {
private static final Logger LOGGER = LogManager.getLogger();
+ private static final Comparator<FileSplit> FILE_SPLIT_COMPARATOR =
+ Comparator.comparing(FileSplit::getNodeName).thenComparing(FileSplit::getPath);
private StoragePathUtil() {
}
public static Pair<IFileSplitProvider, AlgebricksPartitionConstraint> splitProviderAndPartitionConstraints(
FileSplit[] splits) {
+ Arrays.sort(splits, FILE_SPLIT_COMPARATOR);
IFileSplitProvider splitProvider = new ConstantFileSplitProvider(splits);
String[] loc = new String[splits.length];
for (int p = 0; p < splits.length; p++) {
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/107c2059/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java b/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java
index 1bb217a..7a1bb28 100644
--- a/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java
+++ b/hyracks-fullstack/algebricks/algebricks-common/src/main/java/org/apache/hyracks/algebricks/common/constraints/AlgebricksAbsolutePartitionConstraint.java
@@ -27,8 +27,7 @@ public class AlgebricksAbsolutePartitionConstraint extends AlgebricksPartitionCo
private final String[] locations;
public AlgebricksAbsolutePartitionConstraint(String[] locations) {
- this.locations = locations.clone();
- Arrays.sort(this.locations);
+ this.locations = locations;
}
@Override