Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem description:
When deploying a docker container (or probably some other scenarios) with splunk version 9.x that has an existing volume containing a KVStore that was previously used in version 8.x, the KVStore will fail to start. This is due to the mongo version used for that kvstore was still on version mondo 3.6. This happens when splunk is not running the built-in automatic migration script since the conntainer looks like a fresh install to splunk. Splunk 9.1 does not support mongo version 3.6.
The method of setting the current
splunk_current_version
uses themanifest
files, this creates alist
and does not allow to use theversion
conditional which requires the value to be astring
.This PR allows mongo to be upgraded from 3.6 to 4.0 initially, and then migrates it to the wiredTiger engine, and then starts splunk. It also will always migrate the KVStore to the latest version
Changes in the
splunk_common
role:New task
get_facts_current_version.yml
:version
conditional used in theupgrade_kvstore.yml
task, requires the value to be astring
, themanifest
method causes the value to be alist
. Whenetc/splunk.version
is already present, or is populated with theupdate_etc.yml
task, we can use thesplunk.version
file to get the version and build. Ifetc
is not populated, we use themanifest
method to get the version.Modified task
get_facts.yml
:get_facts_current_version.yml
task.var/lib
directory exists. This will allow us to determine if there is a data volume present or mounted that may contain a KVStore.mmapv1
storage engine by checking if thevar/lib/splunk/kvstore/mongo/WiredTiger
exists.Modified
update_etc.yml
:get_facts_current_version.yml
again if theetc
directory was updated if this task was triggered inmain.yml
, and thesplunk.version
file was not present when the initialget_facts.yml
task ran.Modified
main.yml
:kvstore_upgrade.yml
task ifvar/lib
exists.New task
upgrade_kvstore.yml
:storageEngineMigration
inserver.conf
in case this is being upgraded to version less than 9.0 (edge case, but maybe someone is still doing that).var/lib/splunk/kvstore/mongo/WiredTiger
does not exist.