-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
server: update defrag logic to use bolt.Compact() #15470
base: main
Are you sure you want to change the base?
Conversation
I support reusing We should keep the FillPercent consistent in etcd, namely 0.9. On the other hand, we need consider to improve the boltDB to let users to configure compaction options (e.g. FillPercent). |
My understanding is that etcd uses revision numbers are keys in boltdb. Revisions are always incrementing so etcd only inserts to the latest page. Am I missing something here? |
Cenk, that may be true for |
@ahrtr I don't agree with this. When I compact the database, I want the best compaction. The reason I compact is to reduce the database size so it wouldn't reach backend quota limit soon. Because defrag is a blocking operation and takes many many number of seconds, I prefer to do it less frequently as possible. This is especially important for large databases (10 GB). Changing it from 0.9 to 1.0 would save additional 1 GB. If my argument is correct, insertions into @chaochn47 Usually it is |
It seems true for the
If we need the best compaction (setting FillPercent to 1.0), why don't we set it to 1.0 in the first place? Still makes sense to be consistent at all places? In this case, does it make sense to explicitly set a
Have you verified this? Please share you test result. |
We can do this in a separate PR after etcd-io/bbolt#422 (comment) is resolved.
Do you have any test result to share? |
I will test this and share the results here. |
cc @ptabor |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions. |
Signed-off-by: Cenk Alti <[email protected]>
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions. |
The revisions are indeed always incrementing, but when more child pages are allocated/added, then new items (pointing to the child pages) will be added into branch(non-leaf) nodes. The statement " |
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
@cenkalti: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
They are pretty much same implementation. Iterate over buckets, iterate over keys and copy from old db to new db.
One difference is that etcd implementation was setting FillPercent to 0.9 while boltdb implementation sets it to 1.0. After this change the defrag duration on my database dropped from 10.5 to 9 seconds probably because of this change.
The other difference is that boltdb implementation also handles nested buckets. Etcd does not have any nested buckets at the moment but it's nice to have that covered.
With this change, defrag limit changes from 10,000 keys to 10 MB data because bolt.Compact() API wants byte size.