matrixorigin / mo_ctl_standalone

mo_ctl tool for standalone matrixone
Apache License 2.0
2 stars 1 forks source link

[Feature Request]: upgrade function #28

Closed dengn closed 1 year ago

dengn commented 1 year ago

Is there an existing issue for the feature request?

Feature Description

upgrade from a commit number to another, or a stable version to another.

mo_ctl upgrade commit_id 
mo_ctl upgrade 1.0.0

It calls git to upgrade the code base.

Feature Implementation

No response

Additional information

No response

aronchanisme commented 1 year ago

how to implement:

  1. pre-requisites: user needs to run mo_ctl stop to stop any running mo-service first before up upgrading in order to avoid any potential data loss. mo_ctl watchdog disable is also required in order to avoid watchdog keeping mo-service alive.
  2. check if the given commitid is valid, if yes continue, otherwise exit 1
  3. backup MO_PATH: cp ${MO_PATH}/matrixone ${MO_PATH}/matrixone-bk-${current_time} (maybe we can ignore logs folder since it might be too large?). in case any operations to be performed below go wrong, delete the original folder(maybe expect logs) and restore the backup folder to original
  4. run git actions like git fecth -all, get pull, etc to update mo codes to specified commit id
  5. run build_mo_service and build_mo_dump to rebuild mo-service and mo-dump
  6. now upgrade is done successfully, and tell user to re-run mo_ctl start to restart mo-service and mo_ctl watchdog enable to enable watchdog keeping mo-service alive
aronchanisme commented 1 year ago

testing also, use mo_ctl upgrade latest will upgrade mo to latest commit id, in case the latest id is unknown to user

aronchanisme commented 1 year ago

Test done, currently support upgrade as below:

mo_ctl upgrade help
Usage           : mo_ctl upgrade [version_or_commitid]   # upgrade or downgrade mo from current version to a target commit id or stable version
 [commitid]     : a commit id such as '38888f7', or a stable version such as '0.8.0'
                : use 'latest' to upgrade to latest commit on main branch if you don't know the id
  e.g.          : mo_ctl upgrade 38888f7              # upgrade/downgrade to commit id 38888f7 on main branch
                : mo_ctl upgrade latest               # upgrade/downgrade to latest commit on main branch
                : mo_ctl upgrade 0.8.0                # upgrade/downgrade to stable version 0.8.0