Skip to content
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

Add upgrade notes entry on optional field data migration utility script #1071

Merged
merged 12 commits into from
Jun 12, 2021

Conversation

Kami
Copy link
Member

@Kami Kami commented May 9, 2021

Upgrade notes entry for optional migration script in StackStorm/st2#5255.

@Kami Kami added this to the 3.5.0 milestone May 9, 2021
Copy link
Member

@cognifloyd cognifloyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor nitpicks. But I'm fine if we merge without these changes.

docs/source/upgrade_notes.rst Outdated Show resolved Hide resolved
docs/source/upgrade_notes.rst Outdated Show resolved Hide resolved
docs/source/upgrade_notes.rst Outdated Show resolved Hide resolved
docs/source/upgrade_notes.rst Outdated Show resolved Hide resolved
docs/source/upgrade_notes.rst Outdated Show resolved Hide resolved
arm4b and others added 6 commits June 11, 2021 23:11
Co-authored-by: Jacob Floyd <cognifloyd@gmail.com>
Co-authored-by: Jacob Floyd <cognifloyd@gmail.com>
Co-authored-by: Jacob Floyd <cognifloyd@gmail.com>
Co-authored-by: Jacob Floyd <cognifloyd@gmail.com>
Co-authored-by: Jacob Floyd <cognifloyd@gmail.com>
Comment on lines +20 to +72
* The underlying database field type for storing large values such as action execution result has
changed for various database models (ActionExecutionDB, LiveActionDB, WorkflowExecutionDB,
TaskExecutionDB, TriggerInstanceDB).

For most users this change will result in 8-20x speed up when working with (reading and writing)
large values from / to the database.

The change is fully transparent to the end user and new objects created after upgrade to |st2|
v3.5 will automatically utilize this new field type.

Existing objects in the database will continue to utilize old field type.

If you want to migrate them to the new field type, you can use
``st2-migrate-db-dict-field-values`` migration script which ships with |st2| v3.5. The script
only operates on "finalized" objects (i.e. finished executions) and it's idempotent which means
you can re-run it on failures or similar.

It's worth noting that running this script is optional - in most cases users primarily care about
performance for recent / new objects (e.g. viewing recent executions) so if you don't migrate
existing database field values this means retrieving those objects will still be slow, but it
doesn't affect newly created objects post v3.5 upgrade which will utilize new field type and
as such, exhibit much better performance.

By default the script will run in an interactive mode and display a prompt with a warning which needs
to be acknowledged before continuing. If you want to run script in an non-interactive mode, pass
``--yes`` command line argument to it.

The script also defaults to migrating data for the past 30 days. You can migrate objects from
a different time period using ``--start-dt`` and ``--end-dt`` arguments as shown below.

The script currently doesn't support batching so in case you have many objects in the database
(especially trigger instances) you may need to migrate things in smaller chunks and call this
script multiple time (e.g. using a day long intervals or shorter).

Before running this script, you may also want to purge some old operational data. For information
on that, please refer to :doc:`Purging Old Operational Data </troubleshooting/purging_old_data>`
documentation page.

.. code-block:: bash

# Migrate objects with creation date between April 20th, 2021 and April 25th, 2021
/opt/stackstorm/st2/bin/st2-migrate-db-dict-field-values --start-dt "2021-04-20T19:16:55Z" --end-dt "2021-04-25T19:26:55Z"

# Migrate object between April 20th and "now"
/opt/stackstorm/st2/bin/st2-migrate-db-dict-field-values --start-dt "2021-04-20T19:16:55Z" --end-dt "now"

.. note::

You are strongly recommended to create a full database backup before running this script.

If you run this migration script and a need arises, you won't be able to rollback back to a
previous version (v3.4) because code in previous version doesn't include support for this new
field type (in such case you would need to restore the database backup).
Copy link
Member

@arm4b arm4b Jun 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kami The upgrade note looked "little big" though :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think it's better to give more context than less.

I always hate when there is a regression / issue with a new version of some project / library and changelog / upgrade notes don't give much clue where to begin and then you need start going over the commits immediately which means more wasted time...

Copy link
Member

@arm4b arm4b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Kami and @cognifloyd 👍

@Kami Kami merged commit a889288 into master Jun 12, 2021
@Kami Kami deleted the migration_scripts_change branch June 12, 2021 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants