-
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
compact does not effect when snapshoting one big DB. #18509
Comments
The second test. Before test, compact & defrag to set the cluster to origin state. Then send the same requests (qps and kv size) , snapshot to one etcd member. Make sure the snapshot process doesn't contain the compact operations. This is the only different. Then see the logs. (Contains the next compact log after the snapshot operation). Logs for etcd0:
Logs for etcd1:
Logs for etcd2:
As we can see, nothing is strange. And the db size is all same.
It seems that only the snapshot operation duration contains one compact operation could lead to the db of this member grow up. |
/assign |
Are you able to reproduce this issue? @ArkaSaha30 @ivanvc @henrybear327 |
After added log in #18516 , the logs are: Logs for etcd0:
Logs for etcd1:
Logs for etcd2:
The keyCompactions is same for the three etcd members. But the db size in use for etcd0 is big different from others. |
Could you run commands below? Please build the bbolt command from https://github.com/etcd-io/bbolt/tree/main/cmd/bbolt
|
Thanks for the reply. Please let me know if you want more informations. @ahrtr Execute the commands after snapshotting is done(with etcd0) and stop the etcd cluster. The results are: etcd0:
etcd1:
etcd2:
|
Would you still like some help reproducing this issue? I'd like to help, but I'm not sure how to simulate or get the database to the 10GB size. |
Thanks for your help. @ivanvc I can explain more details for reproducing this issue.
Logs for etcd0:
Logs for etcd1:
Logs for etcd2:
|
This comment said that:
And this comment also show that:
As the etcd snapshot process is holding one long running read transaction until send all the db to client. So this is an issue with BoltDB that has persisted for a very, very long time? :( |
Just to double confirm, when you executed the commands, you had already reproduced the issue again (the etcd0 has much bigger value for |
Yes, but unfortunately i didn't save the log. :( If you find some strange, please tell me. I can test it again. |
Thanks for the feedback. Please restart the problematic etcd instance after reproducing this "issue", afterwards please verify whether the "size-in-use" can be recovered back to normal automatically. Search the log "recovered v3 backend from snapshot" and check the value of etcd/server/etcdserver/server.go Lines 524 to 528 in 1d4372a
|
Actually you don't have to restart the etcd instance. Just executing
Please let me know the result. |
The result is blew. Please not that the log time plus 8 is command run time. Do snapshot with etcd1:
logs for etcd0:
logs for etcd1:(the snapshot member)
logs for etcd2:
after snapshot done:
then restart etcd1.(Before restart i don't stop the benchmark client. And this take a long time about 15m, the etcd1 doesn't running until i stop the benchmark client. Don't have time to dig it)
|
I try to Summarize this issue. Please tell me if i am wrong. cc @ahrtr
The logs show that the Note the dbSizeInuse caculate method is blew, and it has close contact with free pages number.
Also the reason from 1, the benchmark client continue to put and update keys and values during snapshot, the boltdb has not enough free pages to allocate, so it has to grow up the db. |
Thanks for all the feedback, which confirmed that this isn't an issue at all. Instead, it's expected behavior. From your feedback in #18509 (comment), it confirmed that there is no any issue on the compaction, because all etcd members had exactly the same k/v pairs after the compactions. The root cause is as you already pointed out in #18509 (comment). To be clearer, there are two things to clarify:
|
Bug report criteria
What happened?
When snapshot one etcd cluster and i found that the compact does not effect.
Metrics for db and db_in_use:
Snapshot to the etcd0 member, and we can see the etcd0's compaction take effect delayed.
Logs for etcd0: (Please note that the log time should plus 8 for metrics time)
We can see that, after the compaction in time 29:13, the db_inuse is about
"current-db-size-in-use-bytes":19744907264,"current-db-size-in-use":"20 GB"
.Logs for etcd1:
Logs for etcd2:
For etcd1 and etcd2, after compaction in time 29:13, the db_inuse is about
"current-db-size-in-use-bytes":10467917824,"current-db-size-in-use":"10 GB"
.The more important is that, after this, the db total size for etcd0 is grow up. Please ignore the db_inuse size, it is because the client stop update and put keys.
What did you expect to happen?
the compact should take effect during snapshot.
How can we reproduce it (as minimally and precisely as possible)?
Anything else we need to know?
auto compaction params:
Etcd version (please run commands below)
v3.5.13
Etcd configuration (command line flags or environment variables)
paste your configuration here
Etcd debug information (please run commands below, feel free to obfuscate the IP address or FQDN in the output)
Relevant log output
No response
The text was updated successfully, but these errors were encountered: