diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index f3f6f8ec7f0..34b55837320 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -78,6 +78,9 @@ Release 2.0.5-beta - UNRELEASED YARN-481. Add AM Host and RPC Port to ApplicationCLI Status Output (Chris Riccomini via bikas) + YARN-297. Improve hashCode implementations for PB records. (Xuan Gong via + hitesh) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptId.java index 063a878b7be..24f15ced7fd 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptId.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptId.java @@ -76,8 +76,8 @@ public abstract class ApplicationAttemptId implements @Override public int hashCode() { // Generated by eclipse. - final int prime = 31; - int result = 1; + final int prime = 347671; + int result = 5501; ApplicationId appId = getApplicationId(); result = prime * result + appId.hashCode(); result = prime * result + getAttemptId(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationId.java index 45aa0157798..097a5334c51 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationId.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationId.java @@ -97,8 +97,8 @@ public abstract class ApplicationId implements Comparable { @Override public int hashCode() { // Generated by eclipse. - final int prime = 31; - int result = 1; + final int prime = 371237; + int result = 6521; long clusterTimestamp = getClusterTimestamp(); result = prime * result + (int) (clusterTimestamp ^ (clusterTimestamp >>> 32)); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java index 53d816d554c..68cd09e2aa1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java @@ -86,8 +86,8 @@ public abstract class ContainerId implements Comparable{ @Override public int hashCode() { // Generated by eclipse. - final int prime = 31; - int result = 1; + final int prime = 435569; + int result = 7507; result = prime * result + getId(); result = prime * result + getApplicationAttemptId().hashCode(); return result; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java index 112ea0796de..886f88eac50 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java @@ -65,8 +65,8 @@ public abstract class NodeId implements Comparable { @Override public int hashCode() { - final int prime = 31; - int result = 1; + final int prime = 493217; + int result = 8501; result = prime * result + this.getHost().hashCode(); result = prime * result + this.getPort(); return result; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Priority.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Priority.java index 5c27f386ef6..2b456f74846 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Priority.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Priority.java @@ -39,8 +39,8 @@ public abstract class Priority implements Comparable { @Override public int hashCode() { - final int prime = 31; - int result = 1; + final int prime = 517861; + int result = 9511; result = prime * result + getPriority(); return result; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java index 72d703eeaf7..c1b7541265d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java @@ -124,8 +124,8 @@ public abstract class ResourceRequest implements Comparable { @Override public int hashCode() { - final int prime = 31; - int result = 1; + final int prime = 2153; + int result = 2459; Resource capability = getCapability(); String hostName = getHostName(); Priority priority = getPriority();