diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index f3f6f8ec7f..34b5583732 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 063a878b7b..24f15ced7f 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 NumberFormat initialValue() { @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 45aa015779..097a5334c5 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 String toString() { @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 53d816d554..68cd09e2aa 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 NumberFormat initialValue() { @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 112ea0796d..886f88eac5 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 String toString() { @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 5c27f386ef..2b456f7484 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 72d703eeaf..c1b7541265 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();