Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

etcd v3 binary key space mean ?

66 views
Skip to first unread message

黄俊

unread,
Jun 13, 2022, 2:50:06 AM6/13/22
to etcd-dev
The  etcd v3 offical  doc say:
> Logical view 

The store’s logical view is a flat binary key space. The key space has a lexically sorted index on byte string keys so range queries are inexpensive.

what is the  **binary**  mean?    Why the emphasis on binary?

Jay Vercellone

unread,
Jan 8, 2025, 9:40:51 AMJan 8
to etcd-dev
I think it's because keys themselves can be anything that can be encoded into bytes (i.e. not necessarily human readable).
For example, putting an entry with key "0xabcd" yiels the following log message (in debug mode):
{"level":"debug","ts":"2025-01-06T08:03:35.726338-0800","caller":"etcdserver/server.go:1950","msg":"applyEntryNormal","raftReq":"header:<ID:3632597502842097949 > put:<key:\"\\253\\315\" value:\"456\" > "}

253 in octal corresponds to 0xab, 315 in octal corresponds to 0xcd:
$ echo -ne '\0253\0315' | base64
q80=
$ echo -ne '\xab\xcd' | base64
q80=
Reply all
Reply to author
Forward
0 new messages