Partition manager identifies partitions to detach
What does this MR do?
Adds an option to the monthly partitioning strategy so that we can specify a retention period:
partiton_by :monthly, retain_for: 3.months
We plan to eventually detach and then drop partitions that are older than the retention period, but for now this MR simply identifies the partitions that should be detached and logs them so that we can observe the behavior in prod and verify that it's selecting the correct partitions.
While the code to actually drop partitions is not included in this MR, there's a risk that a logic bug could lead to not creating the correct partitions for future months when the PartitionCreationWorker
runs. To mitigate this, the feature flag partition_pruning_dry_run
will disable the new code if we discover a logic issue.
So that this change can be observed in production, it is added to the web_hook_logs
table (which will be pruned in #332200 (closed)).
Screenshots (strongly suggested)
Does this MR meet the acceptance criteria?
Conformity
-
I have included changelog trailers, or none are needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Availability and Testing
If there is a logic error and we don't create the appropriate partitions in the future, there could be risk to inserting new rows in partitioned tables. The partition creator currently creates six months of future partitions, so we will be able to safely toggle the partition_pruning_dry_run
feature flag off if there is a problem.
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) -
I have tested this MR in all supported browsers, or it's not needed. -
I have informed the Infrastructure department of a default or new setting change per definition of done, or it's not needed.