-
Notifications
You must be signed in to change notification settings - Fork 80
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
NC | Online Upgrade Process #8326
NC | Online Upgrade Process #8326
Conversation
4321d6a
to
62d12f5
Compare
Consider changing the |
not specific to this PR, but the upgrade scripts must be reentrant in case the upgrade is restarted for some reason |
src/cmd/nsfs.js
Outdated
} | ||
} | ||
}); | ||
await config_fs.create_system_config_file(JSON.stringify(updated_system_json)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably be an update operation and not create
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This issue is probably also relevant in this case, since all hosts will attempt to update the config dir concurrently
src/sdk/config_fs.js
Outdated
async _throw_if_config_dir_locked() { | ||
const system_data = await this.get_system_config_file({silent_if_missing: true}); | ||
if (!system_data) return; | ||
if (this.config_dir_version !== system_data.config_directory.config_dir_version) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is also related to the meaning of the config_dir_version
. It should probably be defined better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used version_compare, is this what you meant?
src/upgrade/nc_upgrade_manager.js
Outdated
const this_upgrade = { timestamp: Date.now(), from_version, to_version }; | ||
system_data[hostname].current_version = to_version; | ||
system_data[hostname]?.upgrade_history?.successful_upgrades.unshift(this_upgrade); | ||
await config_fs.update_system_json_with_retries(JSON.stringify(system_data)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update issue is relevant here too
62d12f5
to
7df8234
Compare
regarding the verification step |
a419679
to
5db2a7f
Compare
9622d3d
to
1a3514e
Compare
Signed-off-by: Romy <[email protected]>
1a3514e
to
43807c2
Compare
Explain the changes
High Level -
This PR is responsible for the core logic of the online upgrade of NooBaa NC, according to the design the online upgrade algorithm is as follows -
Details -
CLI changes -
1.1. upgrade.js - Instead of throwing NotImplemented we now call nc_upgrade_manager.upgrade_config_dir() that executes step 4 of the upgrade algorithm.
1.2. added new flags for
upgrade start
---skip_verification, --expected_version, --custom_upgrade_scripts_dir
.1.3. Updated help, constants and validations files of the cli to support the new flags.
Service changes -
nsfs.js -
on init_nc_system() if config_directory information is missing, update the system.json with the hosts config directory information.noobaa.service -
remove RPM upgrade from the PreExec, moved it to nsfs.js.ConfigFS -
a. Added
this.config_dir_version = '1.0.0'.
b. Added a new function called -
throw_if_config_dir_locked()
that compares the config_dir version on system.json and this.config_dir_version, and if they do not match - throw aBAD REQUEST
error. this function is called from all config_fs functions that do updates to the config directory, like create/update/delete_account_config_file(), create/update/delete_bucket_config_file().c. Added system.json related functions to config_fs, like -
create/update_system_config_file()
etc.Upgrade Manager -
a. Created 2 new files -
upgrade_utils.js
andnc_upgrade_manager.js
.b.
upgrade_utils -
moved utils functions that are being used by bothupgrade_manager.js and nc_upgrade_manager.js
.c.
nc_upgrade_manager -
created update_rpm_upgrade() and upgrade_config_dir(), config_directory_defaults(), _verify_config_dir_upgrade(), _update_config_dir_upgrade_start(), _run_nc_upgrade_scripts(), _update_config_dir_upgrade_finish()
functions that implement step 4 of the online upgrade algorithm.Issues: Fixed #xxx / Gap #xxx
Testing Instructions: