You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by et...@apache.org on 2021/01/05 15:28:34 UTC
[storm] branch master updated: [STORM-3729] fix assgin memory error
over 2g (#3368)
This is an automated email from the ASF dual-hosted git repository.
ethanli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/storm.git
The following commit(s) were added to refs/heads/master by this push:
new f451be2 [STORM-3729] fix assgin memory error over 2g (#3368)
f451be2 is described below
commit f451be2ef81c0821f65a1a4d671b90c221ef99db
Author: Hal <ze...@gmail.com>
AuthorDate: Tue Jan 5 23:28:19 2021 +0800
[STORM-3729] fix assgin memory error over 2g (#3368)
---
storm-client/src/jvm/org/apache/storm/utils/Utils.java | 2 +-
storm-client/test/jvm/org/apache/storm/utils/UtilsTest.java | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/storm-client/src/jvm/org/apache/storm/utils/Utils.java b/storm-client/src/jvm/org/apache/storm/utils/Utils.java
index 50d94e4..1f500c0 100644
--- a/storm-client/src/jvm/org/apache/storm/utils/Utils.java
+++ b/storm-client/src/jvm/org/apache/storm/utils/Utils.java
@@ -1086,7 +1086,7 @@ public class Utils {
}
Matcher m = optsPattern.matcher(option);
while (m.find()) {
- int value = Integer.parseInt(m.group(1));
+ long value = Long.parseLong(m.group(1));
char unitChar = m.group(2).toLowerCase().charAt(0);
int unit;
switch (unitChar) {
diff --git a/storm-client/test/jvm/org/apache/storm/utils/UtilsTest.java b/storm-client/test/jvm/org/apache/storm/utils/UtilsTest.java
index 27e8987..10996e0 100644
--- a/storm-client/test/jvm/org/apache/storm/utils/UtilsTest.java
+++ b/storm-client/test/jvm/org/apache/storm/utils/UtilsTest.java
@@ -89,7 +89,7 @@ public class UtilsTest {
}
private void doParseJvmHeapMemByChildOptsTest(String message, List<String> opts, double expected) {
- Assert.assertEquals(message, Utils.parseJvmHeapMemByChildOpts(opts, 123.0), expected, 0);
+ Assert.assertEquals(message, expected, Utils.parseJvmHeapMemByChildOpts(opts, 123.0), 0);
}
@Test
@@ -104,6 +104,7 @@ public class UtilsTest {
doParseJvmHeapMemByChildOptsTest("Xmx100M results in 100 MB", "Xmx100m", 100.0);
doParseJvmHeapMemByChildOptsTest("Xmx100m results in 100 MB", "Xmx100M", 100.0);
doParseJvmHeapMemByChildOptsTest("-Xmx100M results in 100 MB", "-Xmx100m", 100.0);
+ doParseJvmHeapMemByChildOptsTest("-Xmx2048M results in 2048 MB", "-Xmx2048m", 2048.0);
}
@Test
@@ -111,6 +112,7 @@ public class UtilsTest {
doParseJvmHeapMemByChildOptsTest("Xmx1g results in 1024 MB", "Xmx1g", 1024.0);
doParseJvmHeapMemByChildOptsTest("Xmx1G results in 1024 MB", "Xmx1G", 1024.0);
doParseJvmHeapMemByChildOptsTest("-Xmx1g results in 1024 MB", "-Xmx1g", 1024.0);
+ doParseJvmHeapMemByChildOptsTest("-Xmx2g results in 2048 MB", "-Xmx2g", 2048.0);
}
@Test