Forced start of the history archiver or deleting workflow history immediately #4465
-
Hello everyone! Background: My team created a domain with retentions day equal for one year more than two years ago. With such a long time, our database (we use MySQL database) has grown to a vast size, has become expensive to maintain. After discussing the problem with the team, we decided that we do not need such a prolonged storage period for the history of the execution of various workflows. A history of 30 days is quite enough. When trying to change the retention period, I ran into the problem of cluster naming, but I successfully solved it in the end. The retention period has changed from 365 days to 30 days, but the size of the table with the node_history has not changed even after a few weeks. I thought that the task of starting archiving or deleting old workflows would begin after some time, but nothing happened. How I understood that nothing happened:
Colleagues, tell me how to start a forced history cleanup. |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 9 replies
-
There is a command cc @yycptt see below comments from @yycptt about fixing the command for closed workflows |
Beta Was this translation helpful? Give feedback.
-
I have verified that Steps:
Final results:
|
Beta Was this translation helpful? Give feedback.
-
please ignore my below comment because @yycptt has provided a fix to refresh-tasks command for closed workflow
|
Beta Was this translation helpful? Give feedback.
-
Did I understand correctly that only active workflows would move into the archive? Currently, I have more than 25000 closed workflows (completed, terminated, failed). And many of them are different, and they use different workers, task lists, and flow lengths. How can I do it automatically, cos to do it manually is too expensive? |
Beta Was this translation helpful? Give feedback.
-
I have sent out a PR (#4472) for fixing workflow refresh for closed workflows. So after domain retention is updated, refresh the workflow will archive the workflow if the new retention has passed. Here's an example:
|
Beta Was this translation helpful? Give feedback.
-
History (the workflow history) archival happens after your workflow closes + the domain retention period (the period when the workflow is closed). Visibility (the list of workflow records you see in webUI) archival happens after the workflow is closed. So between the retention period visibility records are available from both default storage and archival storage. But this is an implementation detail, visibility records in archival storage should only be checked after the retention period. We may change when visibility archival is done in the future. Archival won't happen to any open workflows. |
Beta Was this translation helpful? Give feedback.
-
Thanks to @yycptt fix to the command. Now we have a good solution to your problem. A few questions before I provided a detailed instructions for you:
|
Beta Was this translation helpful? Give feedback.
-
Also , CLI has a command to hard delete the workflow entity and history without archiving: see “cadence admin workflow delete —help” |
Beta Was this translation helpful? Give feedback.
I have sent out a PR (#4472) for fixing workflow refresh for closed workflows. So after domain retention is updated, refresh the workflow will archive the workflow if the new retention has passed.
Here's an example: