You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by se...@apache.org on 2019/07/08 13:34:04 UTC
[flink] 01/10: [hotfix][runtime] Compare native memory in
ResourceProfile#equals().
This is an automated email from the ASF dual-hosted git repository.
sewen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
commit a8c0fb5d455bd2dd9911a9559d546561c8b86024
Author: Xintong Song <to...@gmail.com>
AuthorDate: Thu Jul 4 16:09:31 2019 +0800
[hotfix][runtime] Compare native memory in ResourceProfile#equals().
---
.../runtime/clusterframework/types/ResourceProfile.java | 1 +
.../clusterframework/types/ResourceProfileTest.java | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java b/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java
index e0922c1..8137d9f 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java
@@ -284,6 +284,7 @@ public class ResourceProfile implements Serializable, Comparable<ResourceProfile
return this.cpuCores == that.cpuCores &&
this.heapMemoryInMB == that.heapMemoryInMB &&
this.directMemoryInMB == that.directMemoryInMB &&
+ this.nativeMemoryInMB == that.nativeMemoryInMB &&
this.networkMemoryInMB == that.networkMemoryInMB &&
Objects.equals(extendedResources, that.extendedResources);
}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/clusterframework/types/ResourceProfileTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/clusterframework/types/ResourceProfileTest.java
index 6f54d7f..3a42c33 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/clusterframework/types/ResourceProfileTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/clusterframework/types/ResourceProfileTest.java
@@ -98,6 +98,21 @@ public class ResourceProfileTest {
setGPUResource(2.2).
build();
assertTrue(ResourceProfile.fromResourceSpec(rs3, 100).equals(ResourceProfile.fromResourceSpec(rs5, 100)));
+
+ ResourceProfile rp1 = new ResourceProfile(1.0, 100, 100, 100, 100, Collections.emptyMap());
+ ResourceProfile rp2 = new ResourceProfile(1.1, 100, 100, 100, 100, Collections.emptyMap());
+ ResourceProfile rp3 = new ResourceProfile(1.0, 110, 100, 100, 100, Collections.emptyMap());
+ ResourceProfile rp4 = new ResourceProfile(1.0, 100, 110, 100, 100, Collections.emptyMap());
+ ResourceProfile rp5 = new ResourceProfile(1.0, 100, 100, 110, 100, Collections.emptyMap());
+ ResourceProfile rp6 = new ResourceProfile(1.0, 100, 100, 100, 110, Collections.emptyMap());
+ ResourceProfile rp7 = new ResourceProfile(1.0, 100, 100, 100, 100, Collections.emptyMap());
+
+ assertFalse(rp1.equals(rp2));
+ assertFalse(rp1.equals(rp3));
+ assertFalse(rp1.equals(rp4));
+ assertFalse(rp1.equals(rp5));
+ assertFalse(rp1.equals(rp6));
+ assertTrue(rp1.equals(rp7));
}
@Test