-
Notifications
You must be signed in to change notification settings - Fork 53
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
refactor: new proc to foster different size retention policy implementations #2463
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 |
You can find the image built from this PR at
Built from 8f1390a |
The new proc, decreaseDatabaseSize, will have different implementations per each driver. For example, in future commits we will implement a size retention policy thanks to partitions management, in Postgres.
cc3fb30
to
07a96c3
Compare
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.
LGTM!
Very useful policy.
Do we know how long does it take? Rough estimate?
Thanks for the 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.
Yes, its a great step ahead!
One tiny naming issue for me, if you might consider. When reading first the code change from init to new was ambiguous until I did not check the code wider that the derived Time/Size/Capacity RetentionPolicies are defined as ref of RetentionPolicy.
Maybe it would help reading the code to use ...Ref naming of derived classes?
https://status-im.github.io/nim-style-guide/formatting.naming.html?highlight=new#naming-conventions-formattingnaming
@Ivansete-status I meant how long to reduce the DB by 20%. For ~1 million messages. |
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 great! Thanks so much! 🤩
ah ok! I haven't measured the time but it is much faster than deleting rows. By removing partitions we directly truncate many rows at once. |
Description
The new proc,
decreaseDatabaseSize
, will have different implementations per driver. For example, in future commits, we will implement a size retention policy thanks to partitions management, in Postgres.Changes
decreaseDatabaseSize
indriver.nim
.decreaseDatabaseSize
implementation in different drivers. Notice that in upcoming PRs we will change the implementation inpostgres_driver.nim
per partition truncation.