-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Setting a new key with an empty value creates a "dir" key #349
Comments
I agree this is a little prickly of an API. I guess we should add a parameter like mkdir=true that will error if value is set. |
@benbjohnson @xiangli-cmu I looked at the store and it seems it relies on the same logic as the API, that if a node has an empty value it is a directory. I guess we will have to change the internal format of the store to have a type? |
@AaronO We do not allow 1. a key with an empty value 2. a dir with value for now. So the expected behavior is to create a dir when no value is given. Is there any reason that you want to create a key with no value or a dir with value? We can do that if there is a clear need. Also I cannot understand your example and do not think etcd will produce the similar result. |
@xiangli-cmu Yes, I can't reproduce the case that @AaronO has above:
Although, I can see how this will really easily cause programming errors. A simple solution that we can do on the API side without changing the store, for now, is to:
The current API is going to make it too easy for people to create clients that accidentally create directories. You were right on this one. What do you think? |
@AaronO I started a discussion on the mailing list about this: http://news.gmane.org/gmane.comp.distributed.etcd |
In many ways @xiangli-cmu Thus However One can easily work around not having empty values, but I think most programmers, because of the FS metaphor or how other k/v stores behave will view this behavior as non obvious (also this behavior should be documented for those writing applications or client libraries on top of @philips @xiangli-cmu Sorry, there was a typo in my reproduce command, it's fixed now (I wrote @philips I read your message on the mailing list, and I think it's a reasonable suggestion. |
@AaronO We solved the problem be adding a dir flag. And empty key is allowed. |
@xiangli-cmu Is this in the |
@AaronO We will cut another rc soon. |
The expected behavior should be to create a normal "key" with simply no value.
This behavior of creating a directory can cause obvious issues, since directories can be updated with subsequent sets for example, ...
Version :
0.2.0-rc1
Reproduce (unexpected) :
Reproduce (expected) :
The text was updated successfully, but these errors were encountered: