We found the incompatibility of creating key with v2 emulation. The details are as follows:
# Check etcdctl version.
$ etcdctl --version
etcdctl version: 3.3.3
API version: 2
# Start etcd without v2 emulation.
$ docker run -it --rm -p 2379:2379 gcr.io/etcd-development/etcd:v3.3.3 \
etcd --advertise-client-urls="http://127.0.0.1:2379" --listen-client-urls="http://0.0.0.0:2379"
# We can create a nested key.
$ etcdctl set /skydns/com/example/foo '{"host":"192.168.1.1"}'
{"host":"192.168.1.1"}
# Start etcd with v2 emulation.
$ docker run -it --rm -p 2379:2379 gcr.io/etcd-development/etcd:v3.3.3 \
etcd --advertise-client-urls="http://127.0.0.1:2379" --listen-client-urls="http://0.0.0.0:2379" --experimental-enable-v2v3="/v2"
# We can't create a nested key.
$ etcdctl set /skydns/com/example/foo '{"host":"192.168.1.1"}'
Error: 100: Key not found (/skydns/com/example/foo) [0]
Is this the intended behavior? If this is the intended, we will need to modify the client even if we use v2 emulation.
I guess you had a directory at /skydns/com/example in your v2 store already and that made set to /skydns/com/example/foo succeeded.
With the v2v3 emulation, etcd uses the v3 store for v2 requests. So if you don't have the directory in your v3 store, even if you have it on your v2 store, set requests to the directory fails. I assume you just need to mkdir again with the emulation.
Hi, yudai-san :)
No, the v2 API allows us to set the key even if the directory does not exist as shown above. But v2 emulation does not do that.
When migrating from v2 API to use v2 emulation, should we change to use mkdir on all clients?
@summerwind
When migrating from v2 API to use v2 emulation, should we change to use mkdir on all clients?
No, you should not. Probably you can help to fix the problem in etcd emulation layer instead.
Sorry, it's my misunderstand. v2 doesn't require mkdir to make files.
The cause is here:
https://github.com/coreos/etcd/blob/master/etcdserver/api/v2v3/store.go#L147
I'll send a PR to fix this.
I found Watch of v2v3 is also somewhat broken on the master.
I don't get events when I watch with etcdctl watch -r -f /skydns and put something to /skydns/com/example/foo, which is not compatible with the v2 api.
If you run etcdctl watch -r -f /skydns/com/example, you get identical events forever somehow.
I'll take a look into this issue as well maybe tomorrow.
Thank you for the support!