allow union of several retention policies#3766
allow union of several retention policies#3766Ivansete-status merged 13 commits intorelease/v0.37from
Conversation
|
This PR may contain changes to database schema of one of the drivers. If you are introducing any changes to the schema, make sure the upgrade from the latest release to this change passes without any errors/issues. Please make sure the label |
| partitionLastMoment = oldestPartition.getLastMoment(), | ||
| tsInSec | ||
|
|
||
| while oldestPartition.getFirstMoment() < tsInSec: |
There was a problem hiding this comment.
The previous while implementation caused the deletion of all the partitions when using time retention policy.
There was a problem hiding this comment.
Isn't this oldestPartition.getLastMoment() < tsInSec?
That is, this whole partition is dead if the entire timestamp range in it is obsolete.
first = time 10
last = time 20
oldest msg we want = 15
we have to keep this partition, but first (10) < 15 and it gets deleted
(Maybe I'm just being dumb here, please check the math!)
There was a problem hiding this comment.
Yes, I have the same impression that it should be
| while oldestPartition.getFirstMoment() < tsInSec: | |
| while oldestPartition.getLastMoment() < tsInSec: |
There was a problem hiding this comment.
Good catch! Thank you both! You see that I'm nothing without a calculator xD
Addressed in fde1723
|
I'm wondering whether we can't just delete this query inside Just dropping whole partitions is faster than running a query to collect the last expired messages inside the oldest partition (because, well, it's just less work). Maybe we can get away with some fuzziness in the time retention logic and just drop whole partitions at once? Sticking to data expiration in whole buckets is usually safer; it has a more predictable cost. |
NagyZoltanPeter
left a comment
There was a problem hiding this comment.
Approve with the time check needs attention.
| storeMessageRetentionPolicy* {. | ||
| desc: | ||
| "Message store retention policy. Time retention policy: 'time:<seconds>'. Capacity retention policy: 'capacity:<count>'. Size retention policy: 'size:<xMB/xGB>'. Set to 'none' to disable.", | ||
| "Message store retention policy. Multiple policies may be provided as a semicolon-separated string and are applied as a union. Time retention policy: 'time:<seconds>'. Capacity retention policy: 'capacity:<count>'. Size retention policy: 'size:<xMB/xGB>'. Set to 'none' to disable. Example: 'time:3600;size:1GB;capacity:100'.", |
There was a problem hiding this comment.
Can you please note what happens if duplicated options are found (I'd just fail to start in this case, as it's obviously a misconfiguration).
Yes good point. In this particular case, we are dropping partitions at the beginning of the proc. |
* refactor retention policy to allow union of several retention policies * bug fix time retention policy * add removal of orphan partitions if any * use nim-http-utils 0.4.1
Description
<-only approach is being used.size: 50GB;time:86400. The node applies both and then, the most restrictive remains.Validation done
I've validated that the proposed solution works well in waku.test.
By applying the following:
... the database is kept up to the lowest retention policy threshold (either of them.)
In the following pic I share evidence how a retention policy is applied depending on which is more restrictive:
Related Issue
This PR aims to help mitigate the following issue as much as possible but it doesn't fixes it.