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

Fix create log directory thread-unsafe #5326

Merged
merged 10 commits into from
Jun 28, 2021
Merged

Conversation

poohRui
Copy link
Contributor

@poohRui poohRui commented Jun 28, 2021

No description provided.

@poohRui poohRui requested a review from lixinqi as a code owner June 28, 2021 10:39
if (IsDirectory(dirname)) { return; }
RecursivelyCreateDir(dirname);
std::string remaining_dir = dirname;
std::vector<std::string> sub_dirs;
Copy link
Collaborator

Choose a reason for hiding this comment

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

这段代码提取个函数,最好不要引入重复

void TestMultiThreadsDirOperation(FileSystem* file_system) {
std::string current_dir = GetCwd();
StringReplace(&current_dir, '\\', '/');
std::string test_root_path = JoinPath(current_dir, "/tmp_multithread_test_dir");
Copy link
Collaborator

Choose a reason for hiding this comment

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

join path 第二个参数不需要加 / 吧

@@ -86,9 +86,26 @@ void TestDirOperation(FileSystem* file_system) {
ASSERT_TRUE(!file_system->IsDirectory(test_root_path));
}

void CreateDirSimultaneously(FileSystem* file_system, const std::string& test_root_path) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个函数名字不太对?建议直接写到thread的闭包

@poohRui poohRui removed the request for review from lixinqi June 28, 2021 11:18
@oneflow-ci-bot oneflow-ci-bot self-requested a review June 28, 2021 13:30
@oneflow-ci-bot oneflow-ci-bot removed their request for review June 28, 2021 14:23
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot June 28, 2021 14:24
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot June 28, 2021 15:46
@oneflow-ci-bot oneflow-ci-bot merged commit 7ac3f0e into master Jun 28, 2021
@oneflow-ci-bot oneflow-ci-bot deleted the fix_file_is_not_exist branch June 28, 2021 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants