etcd icon indicating copy to clipboard operation
etcd copied to clipboard

auto-compaction-retention in logs displays nanoseconds when auto-compaction-mode set to revision

Open vilitux opened this issue 1 year ago • 2 comments

Bug report criteria

  • [X] This bug report is not security related, security issues should be disclosed privately via etcd maintainers.
  • [X] This is not a support request or question, support requests or questions should be raised in the etcd discussion forums.
  • [X] You have read the etcd bug reporting guidelines.
  • [X] Existing open issues along with etcd frequently asked questions have been checked and this is not a duplicate.

What happened?

For one of the ETCD clusters that we maintain, we've switched the auto-compaction-mode to revision based compaction. The auto-compaction-retention is set to 1000:

$ grep ^auto-compaction /etc/etcd/etcd.conf.yml 
auto-compaction-mode: "revision"
auto-compaction-retention: "1000"

When restarting, the etcd log shows the following:

{"level":"info","ts":"2024-04-18T15:27:31.278121+0200","caller":"embed/etcd.go:308","msg":"starting an etcd server","etcd-version":"3.5.12","git-sha":"e7b3bb6cc","go-version":"go1.20.13","go-os":"linux","go-arch":"amd64","max-cpu-set":2,"max-cpu-available":2,"member-initialized":true,"name":"10.10.10.10","data-dir":"/var/lib/etcd","wal-dir":"","wal-dir-dedicated":"","member-dir":"/var/lib/etcd/member","force-new-cluster":false,"heartbeat-interval":"100ms","election-timeout":"1s","initial-election-tick-advance":true,"snapshot-count":100000,"max-wals":5,"max-snapshots":5,"snapshot-catchup-entries":5000,"initial-advertise-peer-urls":["https://10.10.10.10:2380"],"listen-peer-urls":["https://10.10.10.10:2380"],"advertise-client-urls":["https://10.10.10.10:2379"],"listen-client-urls":["https://10.10.10.10:2379"],"listen-metrics-urls":["https://10.10.10.10:4001"],"cors":["*"],"host-whitelist":["*"],"initial-cluster":"","initial-cluster-state":"new","initial-cluster-token":"","quota-backend-bytes":8589934592,"max-request-bytes":1572864,"max-concurrent-streams":4294967295,"pre-vote":true,"initial-corrupt-check":false,"corrupt-check-time-interval":"0s","compact-check-time-enabled":false,"compact-check-time-interval":"1m0s","auto-compaction-mode":"revision","auto-compaction-retention":"1µs","auto-compaction-interval":"1µs","discovery-url":"","discovery-proxy":"","downgrade-check-interval":"5s"}

In this log, I would've expected to see "auto-compaction-retention":"1000", instead it shows "auto-compaction-retention":"1µs". This gives you the idea you made mistakes in the configuration.

Also, "auto-compaction-interval":"1µs" also seems wrong, since the interval is 5 minutes for revision based compaction (from what I saw, hardcoded in the source code)

What did you expect to happen?

The logs should show auto-compaction-retention set to 1000 instead of 1µs

How can we reproduce it (as minimally and precisely as possible)?

Change auto-compaction-mode to revision, restart and check the logs.

Anything else we need to know?

No response

Etcd version (please run commands below)

$ etcd --version
etcd Version: 3.5.12
Git SHA: e7b3bb6cc
Go Version: go1.20.13
Go OS/Arch: linux/amd64

$ etcdctl version
etcdctl version: 3.5.12
API version: 3.5

Etcd configuration (command line flags or environment variables)

No response

Etcd debug information (please run commands below, feel free to obfuscate the IP address or FQDN in the output)

No response

Relevant log output

No response

vilitux avatar Apr 19 '24 13:04 vilitux

(I think it would show 5µs for 5000 revisions.)

So there is this:

{
// ...
"compact-check-time-interval": "1m0s",
"auto-compaction-mode": "revision",
"auto-compaction-retention": "1µs",  // this is 1000 revisions, shown as 1000ns = 1µs
"auto-compaction-interval": "1µs",   // this seems wrong too 
"discovery-url": //...

wdoekes avatar Apr 22 '24 06:04 wdoekes

Woops, you're right. During the log output the config was set to 1000. Updated to post accordingly.

vilitux avatar Apr 22 '24 12:04 vilitux