Mike Percy has posted comments on this change.

Change subject: env_util: Implement CreateDirsRecursively()
......................................................................


Patch Set 1:

(6 comments)

http://gerrit.cloudera.org:8080/#/c/5618/1/src/kudu/util/env_util-test.cc
File src/kudu/util/env_util-test.cc:

Line 72:   // Relative path. We should clean this up manually.
> hrm, do we have any guarantee about what the cwd is in the test context? I 
We don't always have a guarantee, but on Jenkins it's ENV['TEST_TMPDIR'] which 
defaults to /tmp/kudutest-$uid/

I'll add a chdir()


Line 81: }
> how about some test cases for failure cases? mkdir on top of an existing fi
Good idea, I'll add those.


http://gerrit.cloudera.org:8080/#/c/5618/1/src/kudu/util/env_util.cc
File src/kudu/util/env_util.cc:

Line 196:     if (env->FileExists(path)) break;
> this seems like it will return Status::OK even if 'path' exists and is a fi
Good catch. Will do.


PS1, Line 199: dir_name.empty()
> I don't think this can happen. Take the path "/foo/bar/baz". Successive Dir
Ah, you are right, dirname("foo") == ".". I'll remove this check.


Line 202:   for (auto path = paths.crbegin(); path != paths.crend(); ++path) {
> Nit: I think it'd be clearer to explicitly reverse the vector (there's prob
I was trying to write it to abstract away the details of what a path is, and 
only focus on path components, to make it potentially more portable in the 
future.


http://gerrit.cloudera.org:8080/#/c/5618/1/src/kudu/util/env_util.h
File src/kudu/util/env_util.h:

Line 75: Status CreateDirsRecursively(Env* env, std::string path);
> Pass 'path' by cref?
I didn't do that because I'm reusing the variable in the function body and it 
gives the user the option of passing it in as a movable string.


-- 
To view, visit http://gerrit.cloudera.org:8080/5618
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia664708a09493923abbf2ff4e56e3d49c62cf97e
Gerrit-PatchSet: 1
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Mike Percy <[email protected]>
Gerrit-Reviewer: Adar Dembo <[email protected]>
Gerrit-Reviewer: Dinesh Bhat <[email protected]>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Lars Volker <[email protected]>
Gerrit-Reviewer: Mike Percy <[email protected]>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <[email protected]>
Gerrit-HasComments: Yes

Reply via email to