From 6cae7f106316fe8634da85e4dde1378851aaecc5 Mon Sep 17 00:00:00 2001 From: Frank Wall Date: Thu, 4 Apr 2024 23:19:26 +0200 Subject: [PATCH] remove all $gc_tune default values Solr provides it's own default values in it's `bin/solr` startup script. So instead of duplicating these default values, which may or may not work depending on the Solr/Java version, we just rely on the default values that are provided by Solr from now on. --- CHANGELOG.md | 3 +++ data/common.yaml | 10 +--------- spec/classes/solr_spec.rb | 21 +++++++++++++++++++++ templates/solr.in.sh.epp | 2 +- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc1c160..f7e7d8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added - Add new parameter `$jetty_host` +### Changed +- Remove all `$gc_tune` default values + ## [4.0.0] - 2024-04-03 ### Added diff --git a/data/common.yaml b/data/common.yaml index 64825ae..51771d5 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -12,15 +12,7 @@ solr::extract_dir: '/opt' solr::gc_log_opts: - '-verbose:gc' - '-Xlog:gc' -solr::gc_tune: - - '-XX:NewRatio=3' - - '-XX:SurvivorRatio=4' - - '-XX:TargetSurvivorRatio=90' - - '-XX:MaxTenuringThreshold=8' - - '-XX:ConcGCThreads=4' - - '-XX:ParallelGCThreads=4' - - '-XX:PretenureSizeThreshold=64m' - - '-XX:+ParallelRefProcEnabled' +solr::gc_tune: [] solr::java_home: ~ solr::java_mem: '-Xms512m -Xmx512m' solr::jetty_host: ~ diff --git a/spec/classes/solr_spec.rb b/spec/classes/solr_spec.rb index 161bf6b..d882ffe 100644 --- a/spec/classes/solr_spec.rb +++ b/spec/classes/solr_spec.rb @@ -247,6 +247,27 @@ it { is_expected.to contain_file('/var/solr/solr.in.sh').with_content(%r{SOLR_JETTY_HOST="10.1.2.3"}) } end + + context 'solr class when gc_tune is empty' do + let(:params) do + { + version: '9.4.1', + } + end + + it { is_expected.to contain_file('/var/solr/solr.in.sh').without_content(%r{GC_TUNE=}) } + end + + context 'solr class when gc_tune is not empty' do + let(:params) do + { + gc_tune: ['-XX:+UseG1GC'], + version: '9.4.1', + } + end + + it { is_expected.to contain_file('/var/solr/solr.in.sh').with_content(%r{GC_TUNE="-XX:\+UseG1GC"}) } + end end end end diff --git a/templates/solr.in.sh.epp b/templates/solr.in.sh.epp index 1564a0b..c1d1c30 100644 --- a/templates/solr.in.sh.epp +++ b/templates/solr.in.sh.epp @@ -32,7 +32,7 @@ SOLR_JAVA_MEM="<%= $solr::java_mem %>" GC_LOG_OPTS="<%= $solr::gc_log_opts.join(' ') %>" <% } -%> -<% if $solr::gc_tune {-%> +<% if $solr::gc_tune and !empty($solr::gc_tune) {-%> # Enable custom GC settings GC_TUNE="<%= $solr::gc_tune.join(' ') %>" <% } -%>