-
|
Beta Was this translation helpful? Give feedback.
Answered by
ahrtr
Aug 21, 2023
Replies: 1 comment 4 replies
-
Hey @lance5890 - For retrieving the size of a key, how about writing the value to disk and just using For example: james ~ D e bin main 16:16:02
➜ ./etcdctl get --print-value-only /kubernetes.io/secrets/xxx > value.tmp
james ~ D e bin main 16:17:39
➜ ls -lh
total 73M
drwx------ 3 james james 4.0K Aug 21 16:14 default.etcd
-rwxrwxr-x 1 james james 32M Aug 20 09:45 etcd
-rwxrwxr-x 1 james james 21M Aug 20 09:45 etcdctl
-rwxrwxr-x 1 james james 21M Aug 20 09:45 etcdutl
-rw-rw-r-- 1 james james 13 Aug 21 16:16 value.tmp
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bbolt doesn't compact the value. But the key & value stored in bbolt is different from the key & value what users see. The key stored in bbolt is actually a monotonically increasing revision, and the value stored in bbolt includes both the real key & value users see. Please read kvstore_txn.go#L209-L232
If you really want to get the value size programatically, you should use the etcd SDK (call the Get method), and then get the value size using expression something like
len(resp.Kvs[0].Value)
.