-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
fix(core): Fix pruning of non-finished executions #7333
fix(core): Fix pruning of non-finished executions #7333
Conversation
This fixes a bug in the pruning (soft-delete). The pruning was a bit too aggressive, as it also pruned executions that weren't in an end state yet. This only becomes an issue if there are long-running executions (e.g. workflow with Wait node) or the prune parameters are set to keep only a tiny number of executions.
Great PR! Please pay attention to the following items before merging: Files matching
Files matching
Make sure to check off this list before asking for review. |
this.logger.debug('Setting soft-deletion interval (pruning) for executions'); | ||
this.logger.debug( | ||
`Setting soft-deletion interval (pruning) for executions with rate ${this.rates.hardDeletion}`, | ||
); | ||
|
||
this.intervals.softDeletion = setInterval(async () => this.prune(), this.rates.hardDeletion); |
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.
I noticed we are using hardDeletion
rate even for the soft-deletes. Is this intentional or should it be changed?
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.
Good catch, if you can please update.
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.
Fixed. Btw, is it intentional that hard-deletion happens every 15min but soft-deletion only every 1h?
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #7333 +/- ##
=======================================
Coverage 33.29% 33.29%
=======================================
Files 3376 3376
Lines 205754 205754
Branches 22149 22148 -1
=======================================
Hits 68499 68499
Misses 136141 136141
Partials 1114 1114
☔ View full report in Codecov by Sentry. |
packages/cli/src/databases/repositories/execution.repository.ts
Outdated
Show resolved
Hide resolved
packages/cli/src/databases/repositories/execution.repository.ts
Outdated
Show resolved
Hide resolved
packages/cli/src/databases/repositories/execution.repository.ts
Outdated
Show resolved
Hide resolved
packages/cli/src/databases/repositories/execution.repository.ts
Outdated
Show resolved
Hide resolved
packages/cli/test/integration/repositories/execution.repository.test.ts
Outdated
Show resolved
Hide resolved
packages/cli/test/integration/repositories/execution.repository.test.ts
Outdated
Show resolved
Hide resolved
@ivov thank you for the great PR comments! I've addressed them and this is now ready for re-review |
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.
Looks good! With the new tests, does it make sense to preserve packages/cli/test/unit/repositories/execution.repository.test.ts
?
1 flaky test on run #2362 ↗︎
Details:
cypress/e2e/2-credentials.cy.ts • 1 flaky test
Review all test suite changes for PR #7333 ↗︎ |
✅ All Cypress E2E specs passed |
Good point. I think those are actually already covered by the new tests. I'll remove them |
✅ All Cypress E2E specs passed |
This fixes a bug in the pruning (soft-delete). The pruning was a bit too aggressive, as it also pruned executions that weren't in an end state yet. This only becomes an issue if there are long-running executions (e.g. workflow with Wait node) or the prune parameters are set to keep only a tiny number of executions.
## [1.9.1](https://github.com/n8n-io/n8n/compare/n8n@1.9.0...n8n@1.9.1) (2023-10-04) ### Bug Fixes * **core:** Account for itemless case on restoring binary data ID ([#7305](#7305)) ([c479d86](c479d86)) * **core:** Fix pruning of non-finished executions ([#7333](#7333)) ([d8309a1](d8309a1)) * **editor:** Disable email confirmation banner for trialing users ([#7340](#7340)) ([3815327](3815327)) * **editor:** Display value of selected matching column in RMC ([#7298](#7298)) ([9fbd22e](9fbd22e)) * **editor:** Fix canvas endpoint snapping when dragging connection ([#7346](#7346)) ([b4681e7](b4681e7)) * **editor:** Fix RLC not loading when an expression can't resolve ([#7295](#7295)) ([116a6df](116a6df)) * **editor:** Separate cloud endpoint calls ([#7312](#7312)) ([54610b0](54610b0)) * **Jira Software Node:** Get all users in dropdown/RLC ([#7322](#7322)) ([7abf13b](7abf13b)), closes [#2670](#2670) * **Notion Node:** Rename Notion API Key to Internal Integration Token ([#7176](#7176)) ([e606ded](e606ded)) * **Postgres Node:** Node requires comma-separated string even when using a single parameter through an expression ([#7300](#7300)) ([43534ab](43534ab)) * **Set Node:** Do not stringify null and undefined ([#7313](#7313)) ([326abaa](326abaa)) * **Typeform Trigger Node:** Change output format for TypeForm trigger to object instead of array ([#7315](#7315)) ([b1fc981](b1fc981)) Co-authored-by: netroy <netroy@users.noreply.github.com>
Got released with |
# [1.10.0](https://github.com/n8n-io/n8n/compare/n8n@1.9.0...n8n@1.10.0) (2023-10-05) ### Bug Fixes * **Convert to/from binary data Node:** Rename 'Move Binary Data' to 'Convert to/from binary data' ([#7318](#7318)) ([5e6c1d4](5e6c1d4)) * **core:** Account for itemless case on restoring binary data ID ([#7305](#7305)) ([1691223](1691223)) * **core:** Fix pruning of non-finished executions ([#7333](#7333)) ([1b4848a](1b4848a)) * **editor:** Disable email confirmation banner for trialing users ([#7340](#7340)) ([6d3d178](6d3d178)) * **editor:** Display value of selected matching column in RMC ([#7298](#7298)) ([3aac22b](3aac22b)) * **editor:** Fix canvas endpoint snapping when dragging connection ([#7346](#7346)) ([b59b908](b59b908)) * **editor:** Fix disappearing NDV header in code nodes ([#7290](#7290)) ([7ebf8f3](7ebf8f3)) * **editor:** Fix RLC not loading when an expression can't resolve ([#7295](#7295)) ([ddc26c2](ddc26c2)) * **editor:** Separate cloud endpoint calls ([#7312](#7312)) ([04dfcd7](04dfcd7)) * **Jira Software Node:** Get all users in dropdown/RLC ([#7322](#7322)) ([3704760](3704760)), closes [#2670](#2670) * **Notion Node:** Rename Notion API Key to Internal Integration Token ([#7176](#7176)) ([ec2aa38](ec2aa38)) * **Postgres Node:** Node requires comma-separated string even when using a single parameter through an expression ([#7300](#7300)) ([763d451](763d451)) * **Set Node:** Do not stringify null and undefined ([#7313](#7313)) ([f0a6687](f0a6687)) * **Typeform Trigger Node:** Change output format for TypeForm trigger to object instead of array ([#7315](#7315)) ([b3fc00e](b3fc00e)) ### Features * **core:** Add "Sent by n8n" attribution ([#7183](#7183)) ([8f9fe62](8f9fe62)) * **core:** Add support for building LLM applications ([#7235](#7235)) ([00a4b8b](00a4b8b)), closes [#7246](#7246) [#7137](#7137) * Workflow History pruning and prune time settings ([#7343](#7343)) ([0adc533](0adc533)) Co-authored-by: krynble <krynble@users.noreply.github.com>
This fixes a bug in the pruning (soft-delete). The pruning was a bit too aggressive, as it also pruned executions that weren't in an end state yet. This only becomes an issue if there are long-running executions (e.g. workflow with Wait node) or the prune parameters are set to keep only a tiny number of executions.
Github issue / Community forum post (link here to close automatically):