-
Notifications
You must be signed in to change notification settings - Fork 205
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
puts that would succeed on consul & zookeeper fail on etcd #20
Comments
Thanks for opening the issue @spikecurtis I'm actually torn between just changing the documentation and waiting for the support in If I'm not mistaken, using hidden keys is the only way to store informations for a directory without the key being listed or events being triggered for that key. The interoperability with other client libraries is not really an issue in that case: they must point directly to I'm not against making the change in that case because this is a bug. Even though this is a design issue in |
@abronan it's more than other client libraries seeing keys they wouldn't recognize. Suppose you have an existing application that writes to We can't just use this trick only for "directory" keys, since we won't know a priori whether the path is a leaf or not. So every My personal feeling is to change the documentation. At this stage, anyone serious about multiple backends better be testing them with their application. Other options involve a lot of black magic and complexity for very little benefit. |
To my understanding, the prefix would only be used for a single unique key So we would have a structure like this:
The process of
Now, if you try to Unless I'm missing something obvious, this would be possible but this involves a lot of trickery and back and forth transformations between
I actually agree with this. Not sure if this is a good option as this hides a lot of things that could backfire on us if people are upgrading to new versions of Is there any actual Issue or open PR in the |
@spikecurtis After a discussion with @kelseyhightower (thanks for all the infos!), etcd API |
etcd v2.0+ with API v2 cannot watch on a regular key, we must ensure that the initial steps involve creating a 'key' under a directory at 'path'. This is a workaround to recursively create the path and make sure that 'path' is considered as a watchable directory. These steps are necessary unless 'libkv' includes and supports the new etcd API v3 which removes the directory/key distinction. Fixes: moby#392 See: docker/libkv#20 Signed-off-by: Alexandre Beslic <abronan@docker.com>
etcd v2.0+ with API v2 cannot watch on a regular key, we must ensure that the initial steps involve creating a 'key' under a directory at 'path'. This is a workaround to recursively create the path and make sure that 'path' is considered as a watchable directory. These steps are necessary unless 'libkv' includes and supports the new etcd API v3 which removes the directory/key distinction to allow for a better abstraction. Fixes: moby#392 See: docker/libkv#20 Signed-off-by: Alexandre Beslic <abronan@docker.com>
etcd v2.0+ with API v2 cannot watch on a regular key, we must enforce the 'IsDir' parameter while creating the key for it to be considered as a directory. This step is necessary unless 'libkv' includes and supports the new etcd API v3 which removes the directory/key distinction to allow for a better abstraction. Fixes: moby#392 See: docker/libkv#20 Signed-off-by: Alexandre Beslic <abronan@docker.com>
Base on my observation, Say we and theses should be considered. |
Update travis to use Go 1.9
Since etcd enforces a distinction between "directory" keys and "file" keys, some sequences of puts that would succeed on the other backends will fail on etcd.
will succeed on Consul, but the second call will fail on etcd, since
/path/to
is a file.Likewise
will fail on etcd since
/path
is a directory.I've discussed the next-gen API for etcd with some of their maintainers, and I think they're planning to remove the directory/file distinction for v3. So, this issue may sort itself out on that new API.
I'm not sure there is a satisfactory resolution that doesn't involve a trade off.
One thing that could be done is to automatically change directories to files and vice versa, but this would result in data loss, and so is probably not acceptable.
Another possibility would be for libkv to append a file node suffix to every key when using etcd. E.g.
This leads to etcd backend behaving the same way as Consul & Zookeeper, however, it makes it very difficult to allow interoperation with other clients of the data store that are not
libkv
-based, since the keys they see are different.We could also just do nothing, and warn developers that writing interoperable code requires that they plan their key use carefully so they always write to a leaf node in the tree.
The text was updated successfully, but these errors were encountered: