Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy versioned logic for DefaultSystemMemoryInfo #85761

Merged
merged 3 commits into from
Apr 12, 2022

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented Apr 8, 2022

The machine dependent heap logic uses SystemMemoryInfo to determine how
much total memory is available on the system. The default implementation
delegates to Java's MX bean to get OS stats. In the past this was only
available in Java 14, but since the main branch is now on Java 17, we do
not need this logic.

This commit refactors the default implementation to no longer need the
version check, and to also remove unnecessary forbidden api suppressions
for the entire class, instead using a LongSupplier for the memory to
isolate the platform specific bean references.

relates #85758

The machine dependent heap logic uses SystemMemoryInfo to determine how
much total memory is available on the system. The default implementation
delegates to Java's MX bean to get OS stats. In the past this was only
available in Java 14, but since the main branch is now on Java 17, we do
not need this logic.

This commit refactors the default implementation to no longer need the
version check, and to also remove unnecessary forbidden api suppressions
for the entire class, instead using a LongSupplier for the memory to
isolate the platform specific bean references.

relates elastic#85758
@rjernst rjernst added :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts :Core/Infra/Core Core issues without another label >refactoring v8.3.0 labels Apr 8, 2022
@rjernst rjernst requested a review from mark-vieira April 8, 2022 13:12
@elasticmachine elasticmachine added Team:Core/Infra Meta label for core/infra team Team:Delivery Meta label for Delivery team labels Apr 8, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-delivery (Team:Delivery)


return operatingSystemMXBean.getTotalPhysicalMemorySize();
@Override
public long availableSystemMemory() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we've removed SystemMemoryInfoException from the signature here we should probably remove it everywhere else as well (catch statements, SystemMemoryInfo interface, etc). As far as I can tell this was the only place we ever threw such an exception, unless we want to keep this in place for furture implementations?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed SystemMemoryInfoException

@rjernst
Copy link
Member Author

rjernst commented Apr 11, 2022

@elasticmachine run elasticsearch-ci/part-2

@rjernst
Copy link
Member Author

rjernst commented Apr 11, 2022

@mark-vieira This is ready for another review.

Copy link
Contributor

@mark-vieira mark-vieira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@rjernst rjernst merged commit f98631a into elastic:master Apr 12, 2022
@rjernst rjernst deleted the cli/system_memory_info branch April 12, 2022 18:04
weizijun added a commit to weizijun/elasticsearch that referenced this pull request Apr 13, 2022
* upstream/master: (40 commits)
  Fix BuildTests serialization (elastic#85827)
  Use urgent priority for node shutdown cluster state update (elastic#85838)
  Remove Task classes from HLRC (elastic#85835)
  Remove unused migration classes (elastic#85834)
  Remove uses of Charset name parsing (elastic#85795)
  Remove legacy versioned logic for DefaultSystemMemoryInfo (elastic#85761)
  Expose proxy settings for GCS repositories (elastic#85785)
  Remove SLM classes from HLRC (elastic#85825)
  TSDB: fix the time_series in order collect priority (elastic#85526)
  Remove ILM classes from HLRC (elastic#85822)
  FastVectorHighlighter should use ValueFetchers to load source data (elastic#85815)
  Iteratively execute synchronous ingest processors (elastic#84250)
  Remove TransformClient from HLRC  (elastic#85787)
  Mute XPackRestIT deprecation/10_basic/Test Deprecations (elastic#85807)
  Unmute Lintian packaging test (elastic#85778)
  Add a highlighter unit test base class (elastic#85719)
  Remove NIO Transport Plugin (elastic#82085)
  [TEST] Remove token methods from HLRC SecurityClient (elastic#85515)
  [Test] Use thread-safe hashSet for result collection (elastic#85653)
  [TEST] Mute BuildTests.testSerialization (elastic#85801)
  ...

# Conflicts:
#	server/src/test/java/org/elasticsearch/search/aggregations/timeseries/TimeSeriesIndexSearcherTests.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts >refactoring Team:Core/Infra Meta label for core/infra team Team:Delivery Meta label for Delivery team v8.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants