zhuzhurk opened a new pull request #10079: [FLINK-14594] Fix matching logics of ResourceSpec/ResourceProfile/Resource considering double values URL: https://github.com/apache/flink/pull/10079 ## What is the purpose of the change This PR is to fix the matching logics of ResourceSpec/ResourceProfile/Resource. There are resources of double type values, like cpuCores or all extended resources. These values can be generated via a merge or subtract, so that there can be small deltas. Currently, in resource matching, these resources are matched without considering the deltas, which may result in issues. More details see FLINK-14594. ## Brief change log - Introduce a ResourceValue which stores a double value and its acceptable precision (the same kind of resource should use the same precision). It provides compareTo method, in which two ResourceValues are considered equal if the subtracted abs does not exceed the precision. It also provides merge/subtract/validation operations. - Change Resource to use ResourceValue to store its value. - Change ResourceSpec to use ResourceValue for cpuCores. - Replace the usages of equals with another method hasSameResources which considers the precision. - Change ResourceProfile to use ResourceValue for cpuCores. - Replace the usages of equals with another method hasSameResources which considers the precision. ## Verifying this change - *Added tests for ResourceValue/AdditiveResourceValue* - Changes to ResourceSpec/ResourceProfile are already covered by their existing tests. ## 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, Yarn/Mesos, 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? (yes / **no**) - If yes, how is the feature documented? (**not applicable** / docs / JavaDocs / not documented)
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
