Skip to content
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

feat add dir_flag #376

Merged
merged 9 commits into from
Dec 9, 2013
Merged

feat add dir_flag #376

merged 9 commits into from
Dec 9, 2013

Conversation

xiang90
Copy link
Contributor

@xiang90 xiang90 commented Dec 5, 2013

for create/delete a directory, dir=ture will be required.
recursive=true will imply dir=true

empty value of a key-value pair will be allowed.

@@ -59,6 +60,7 @@ func init() {
errors[EcodeNodeExist] = "Already exists" // create
errors[EcodeRootROnly] = "Root is read only"
errors[EcodeKeyIsPreserved] = "The prefix of given key is a keyword in etcd"
errors[EcodeDirNotEmpty] = "The directory is not empty"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets stay with unix tradition "Directory not empty"

@xiang90
Copy link
Contributor Author

xiang90 commented Dec 5, 2013

@philips I will add tests.

return etcdErr.NewError(etcdErr.EcodeNotFile, "", n.store.Index())
if n.IsDir() {
if !dir {
// cannot delete a directory without set recursive to true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"without recursive set to true"

@philips
Copy link
Contributor

philips commented Dec 6, 2013

lgtm, this will break the store from older versions of etcd, right?

@philips
Copy link
Contributor

philips commented Dec 6, 2013

cleanup the small comments and lets merge this!

@xiang90
Copy link
Contributor Author

xiang90 commented Dec 9, 2013

@philips It will break the store state when replay the log from previous version.

xiang90 added a commit that referenced this pull request Dec 9, 2013
@xiang90 xiang90 merged commit dd354c9 into etcd-io:master Dec 9, 2013
@xiang90 xiang90 deleted the dir_flag branch December 9, 2013 16:35
@philips
Copy link
Contributor

philips commented Dec 9, 2013

We need to fix the log replay then. @benbjohnson can you look at making
sure the log replay works from an older version?
On Dec 9, 2013 8:34 AM, "Xiang Li" notifications@github.com wrote:

@philips https://github.com/philips It will break it when replay the
log from previous version.


Reply to this email directly or view it on GitHubhttps://github.com//pull/376#issuecomment-30147250
.

@xiang90
Copy link
Contributor Author

xiang90 commented Dec 9, 2013

@philips The delete part do not have any problem since we just add a flag. For create/set, empty value used to create a directory but now it will create a key with empty value.

@philips
Copy link
Contributor

philips commented Dec 9, 2013

Right but we want to be able to move logs from v1
On Dec 9, 2013 8:49 AM, "Xiang Li" notifications@github.com wrote:

@philips https://github.com/philips The delete part do not have any
problem since we just add a flag. For create/set, empty value used to
create a directory but now it will create a key with empty value.


Reply to this email directly or view it on GitHubhttps://github.com//pull/376#issuecomment-30148715
.

@xiang90
Copy link
Contributor Author

xiang90 commented Dec 9, 2013

@philips v1 to v2 should not be a problem. I think we just broke rc version, which we are not guarantee to support upgrade if I remember correctly. I will be great if @benbjohnson can help to test v1 to v2.

@benbjohnson
Copy link
Contributor

@xiangli-cmu There's an existing v1 migration test:

https://github.com/coreos/etcd/blob/master/tests/functional/v1_migration_test.go

It takes the log generated from a v1 binary and loads it into a v2 binary. What else do you need?

@xiang90
Copy link
Contributor Author

xiang90 commented Dec 9, 2013

@benbjohnson This change does not break the test. So it proves v1 should be able to migrate to v2 without a problem?

@philips
Copy link
Contributor

philips commented Dec 9, 2013

@xiangli-cmu @benbjohnson I just don't know if it actually works anymore after this change. I assumed it would not and the travis build is currently broken.

If it is all working fine then great! :)

@benbjohnson
Copy link
Contributor

@xiangli-cmu It doesn't look like the migration test has directory creation in it. I agree with @philips that this change probably breaks v1 logs.

We probably need to duplicate the store/v2 commands into a store/v1 package (but revert the change for those commands). When the v2 binary comes up for the first time it should read in the v1 commands, snapshot and then save the current version. That way v2 can start fresh.

@xiang90
Copy link
Contributor Author

xiang90 commented Dec 12, 2013

@benbjohnson You cannot create a directory in v1. You can only implicitly create directory by creating keys. That is why it probably does not break v1.

@benbjohnson
Copy link
Contributor

@xiangli-cmu Ok, I didn't realize that. Yeah, in that case it probably shouldn't break.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants