-
Notifications
You must be signed in to change notification settings - Fork 58
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
feat: Postgres partition implementation #2506
Conversation
The new proc, decreaseDatabaseSize, will have different implementations per each driver. For example, in future commits we will implement a size retention policy thanks for partitions management, in Postgres.
Completing implementation of partition factory and partition deletion. There may still be some bugs that need adjustment.
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.
…g times.now() times.now() returns time in seconds but we need to be in nanoseconds
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 8aff169 |
0732973
to
39183a0
Compare
and retrieve its underlying future object so that it can be cancelled
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.
Overall, I'm amazed how wonderful this PR is!
As we discussed it many times I was excited to see already. This is a real win!
Thank you for it.
Approved! Only left some questions and stuff to consider for the future.
Let's see it live working!
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.
Amazing. Thanks!
Hope it works as well as it sounds.
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.
Amazing PR! Thanks so much! 😍
if beginning <= targetMoment and targetMoment < `end`: | ||
return ok(partition) | ||
|
||
return err("Could'nt find a partition table for given time: " & $targetMoment) |
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.
Super nitpick 😶
return err("Could'nt find a partition table for given time: " & $targetMoment) | |
return err("Couldn't find a partition table for given time: " & $targetMoment) |
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.
Super nitpick 😶
Thanks! Covered in 62e7b3e
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.
Great work, @Ivansete-status (and @NagyZoltanPeter). :)
Description
First of all, special thanks to @NagyZoltanPeter for suggesting such a great partition proposal 🥳 !
In this PR we start managing the partition creation and deletion.
This is interesting from the database size maintenance pov.
There will always be a current partition.
The
loopPartitionFactory
proc responsible for making sure that there will always be a future partition available.The
loopPartitionFactory
will check everyDefaultDatabasePartitionCheckTimeInterval
(10 minutes hard-coded) whether a new partition should be created or not.The
PartitionsRangeInterval
is also hard-coded (1 hour.) This value establishes the time window to store messaged based in theirstoredAt
(epoch time in nanoseconds.)Notice that the partitions are only removed when
size
retention policy is being applied.Changes
require
on postgres tests. I've noticed that it doesn't handle the failure cases very well.waku/waku_archive/driver/postgres_driver/migrations.nim
.)waku/waku_archive/driver/postgres_driver/partitions_manager.nim
that just keeps track the partitions. The partitions are being created from within thepostgres_driver.nim
(loopPartitionFactory
.) and removed from the size retention policy.postgres_driver.nim
. RemovescreateMessageTable
,init
, anddeleteMessageTable
procs.forceRemoval: bool = false
param indecreaseDatabaseSize
is for testing purposes, to allow forcing all the partitions.