You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "slfan1989 (via GitHub)" <gi...@apache.org> on 2023/03/18 01:23:37 UTC

[GitHub] [flink] slfan1989 opened a new pull request, #22207: FLINK-31510. Use getMemorySize instead of getMemory.

slfan1989 opened a new pull request, #22207:
URL: https://github.com/apache/flink/pull/22207

   <!--
   *Thank you very much for contributing to Apache Flink - we are happy that you want to help us improve Flink. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
   
   *Please understand that we do not do this to make contributions to Flink a hassle. In order to uphold a high standard of quality for code contributions, while at the same time managing a large number of contributions, we need contributors to prepare the contributions well, and give reviewers enough contextual information for the review. Please also understand that contributions that do not follow this guide will take longer to review and thus typically be picked up with lower priority by the community.*
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [JIRA issue](https://issues.apache.org/jira/projects/FLINK/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no JIRA issue.
     
     - Name the pull request in the form "[FLINK-XXXX] [component] Title of the pull request", where *FLINK-XXXX* should be replaced by the actual issue number. Skip *component* if you are unsure about which is the best component.
     Typo fixes that have no associated JIRA issue should be named following this pattern: `[hotfix] [docs] Fix typo in event time introduction` or `[hotfix] [javadocs] Expand JavaDoc for PuncuatedWatermarkGenerator`.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
     
     - Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes. You can set up Azure Pipelines CI to do that following [this guide](https://cwiki.apache.org/confluence/display/FLINK/Azure+Pipelines#AzurePipelines-Tutorial:SettingupAzurePipelinesforaforkoftheFlinkrepository).
   
     - Each pull request should address only one issue, not mix up code from multiple issues.
     
     - Each commit in the pull request has a meaningful commit message (including the JIRA id)
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
   
   
   **(The sections below can be removed for hotfixes of typos)**
   -->
   
   ## What is the purpose of the change
   
   JIRA: FLINK-31510. Use getMemorySize instead of getMemory
   
   In [YARN-4844](https://issues.apache.org/jira/browse/YARN-4844), use getMemorySize instead of getMemory, because using int to represent memory may exceed the bounds in some cases and produce negative numbers. This change was merged in HADOOP-2.8.0, we should use getMemorySize instead of getMemory.
   
   ## Brief change log
   
   Use getMemorySize instead of getMemory.
   
   ## Verifying this change
   
   Manually verified.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / no)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / no)
     - The serializers: (yes / no / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / no / don't know)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes / no / don't know)
     - The S3 file system connector: (yes / no / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? no


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] slfan1989 commented on a diff in pull request #22207: [FLINK-31510][yarn] Use getMemorySize instead of getMemory.

Posted by "slfan1989 (via GitHub)" <gi...@apache.org>.
slfan1989 commented on code in PR #22207:
URL: https://github.com/apache/flink/pull/22207#discussion_r1160998952


##########
flink-yarn/src/main/java/org/apache/flink/yarn/YarnClusterDescriptor.java:
##########
@@ -1945,8 +1938,4 @@ Map<String, String> generateApplicationMasterEnv(
         Utils.setupYarnClassPath(this.yarnConfiguration, env);
         return env;
     }
-
-    private String getDisplayMemory(long memoryMB) {

Review Comment:
   Sorry, it was my mistake, I lost part of the code when I rebase, I re-updated the code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] chucheng92 commented on a diff in pull request #22207: FLINK-31510. Use getMemorySize instead of getMemory.

Posted by "chucheng92 (via GitHub)" <gi...@apache.org>.
chucheng92 commented on code in PR #22207:
URL: https://github.com/apache/flink/pull/22207#discussion_r1141590982


##########
flink-yarn/src/main/java/org/apache/flink/yarn/YarnClusterDescriptor.java:
##########
@@ -670,22 +670,22 @@ private ClusterSpecification validateClusterResources(
 
         final String note =
                 "Please check the 'yarn.scheduler.maximum-allocation-mb' and the 'yarn.nodemanager.resource.memory-mb' configuration values\n";
-        if (jobManagerMemoryMb > maximumResourceCapability.getMemory()) {
+        if (jobManagerMemoryMb > maximumResourceCapability.getMemorySize()) {

Review Comment:
   hi, i think here memory unit is MB. so we can use int, why must long ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] reswqa commented on pull request #22207: [FLINK-31510][yarn] Use getMemorySize instead of getMemory.

Posted by "reswqa (via GitHub)" <gi...@apache.org>.
reswqa commented on PR #22207:
URL: https://github.com/apache/flink/pull/22207#issuecomment-1480571001

   Thanks @slfan1989 for creating this. Would you mind resolving conflict in `YarnClusterDescriptor `?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] reswqa commented on a diff in pull request #22207: [FLINK-31510][yarn] Use getMemorySize instead of getMemory.

Posted by "reswqa (via GitHub)" <gi...@apache.org>.
reswqa commented on code in PR #22207:
URL: https://github.com/apache/flink/pull/22207#discussion_r1160743167


##########
flink-yarn/src/main/java/org/apache/flink/yarn/YarnClusterDescriptor.java:
##########
@@ -1945,8 +1938,4 @@ Map<String, String> generateApplicationMasterEnv(
         Utils.setupYarnClassPath(this.yarnConfiguration, env);
         return env;
     }
-
-    private String getDisplayMemory(long memoryMB) {

Review Comment:
   Even if we use a long value, converting to byte here will still overflow, right?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] slfan1989 commented on pull request #22207: [FLINK-31510][yarn] Use getMemorySize instead of getMemory.

Posted by "slfan1989 (via GitHub)" <gi...@apache.org>.
slfan1989 commented on PR #22207:
URL: https://github.com/apache/flink/pull/22207#issuecomment-1500183076

   @reswqa Can you help review this PR again? Thank you very much! I explained the reason for possible negative numbers.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] flinkbot commented on pull request #22207: FLINK-31510. Use getMemorySize instead of getMemory.

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #22207:
URL: https://github.com/apache/flink/pull/22207#issuecomment-1474563109

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e6835649ed601e22536f0550e52c089aa4e06da9",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "e6835649ed601e22536f0550e52c089aa4e06da9",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * e6835649ed601e22536f0550e52c089aa4e06da9 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] slfan1989 commented on pull request #22207: [FLINK-31510][yarn] Use getMemorySize instead of getMemory.

Posted by "slfan1989 (via GitHub)" <gi...@apache.org>.
slfan1989 commented on PR #22207:
URL: https://github.com/apache/flink/pull/22207#issuecomment-1482249297

   > Thanks @slfan1989 for creating this.
   > 
   > How did you manually verify this issue, could you describe it in detail?
   > 
   > By the way, would you mind resolving conflict in `YarnClusterDescriptor`?
   
   @reswqa Thank you very much for your suggestion, I will modify the information as soon as possible


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] reswqa commented on a diff in pull request #22207: [FLINK-31510][yarn] Use getMemorySize instead of getMemory.

Posted by "reswqa (via GitHub)" <gi...@apache.org>.
reswqa commented on code in PR #22207:
URL: https://github.com/apache/flink/pull/22207#discussion_r1160752449


##########
flink-yarn/src/main/java/org/apache/flink/yarn/YarnClusterDescriptor.java:
##########
@@ -1945,8 +1938,4 @@ Map<String, String> generateApplicationMasterEnv(
         Utils.setupYarnClassPath(this.yarnConfiguration, env);
         return env;
     }
-
-    private String getDisplayMemory(long memoryMB) {

Review Comment:
   It seems that some test case related to this is failed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] reswqa closed pull request #22207: [FLINK-31510][yarn] Use getMemorySize instead of getMemory.

Posted by "reswqa (via GitHub)" <gi...@apache.org>.
reswqa closed pull request #22207: [FLINK-31510][yarn] Use getMemorySize instead of getMemory.
URL: https://github.com/apache/flink/pull/22207


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] reswqa commented on a diff in pull request #22207: [FLINK-31510][yarn] Use getMemorySize instead of getMemory.

Posted by "reswqa (via GitHub)" <gi...@apache.org>.
reswqa commented on code in PR #22207:
URL: https://github.com/apache/flink/pull/22207#discussion_r1160743167


##########
flink-yarn/src/main/java/org/apache/flink/yarn/YarnClusterDescriptor.java:
##########
@@ -1945,8 +1938,4 @@ Map<String, String> generateApplicationMasterEnv(
         Utils.setupYarnClassPath(this.yarnConfiguration, env);
         return env;
     }
-
-    private String getDisplayMemory(long memoryMB) {

Review Comment:
   Why remove this method? Is it because of even if we use a long value, converting to byte here will still overflow? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink] slfan1989 commented on pull request #22207: [FLINK-31510][yarn] Use getMemorySize instead of getMemory.

Posted by "slfan1989 (via GitHub)" <gi...@apache.org>.
slfan1989 commented on PR #22207:
URL: https://github.com/apache/flink/pull/22207#issuecomment-1501007098

   > Thanks @slfan1989 for the update, would you mind squashing all to only one commit with the message like:
   
   @reswqa Thank you for your help to review the code! I will rebase and submit.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org