allow kvstore upgrade #758
Open
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_versionuses themanifestfiles, this creates alistand does not allow to use theversionconditional 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_commonrole:New task
get_facts_current_version.yml:versionconditional used in theupgrade_kvstore.ymltask, requires the value to be astring, themanifestmethod causes the value to be alist. Whenetc/splunk.versionis already present, or is populated with theupdate_etc.ymltask, we can use thesplunk.versionfile to get the version and build. Ifetcis not populated, we use themanifestmethod to get the version.Modified task
get_facts.yml:get_facts_current_version.ymltask.var/libdirectory exists. This will allow us to determine if there is a data volume present or mounted that may contain a KVStore.mmapv1storage engine by checking if thevar/lib/splunk/kvstore/mongo/WiredTigerexists.Modified
update_etc.yml:get_facts_current_version.ymlagain if theetcdirectory was updated if this task was triggered inmain.yml, and thesplunk.versionfile was not present when the initialget_facts.ymltask ran.Modified
main.yml:kvstore_upgrade.ymltask ifvar/libexists.New task
upgrade_kvstore.yml:storageEngineMigrationinserver.confin 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/WiredTigerdoes not exist.