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 bug that will not close _direct_fd #113

Merged
merged 1 commit into from
Oct 10, 2020

Conversation

bai-charisu
Copy link
Contributor

@bai-charisu bai-charisu commented Oct 9, 2020

What problem does this PR solve?

Fix the bug that _direct_fd will not be close when segment destructed.

Problem Summary:

What is changed and how it works?

What's Changed:

How it Works:

Side effects(Breaking backward compatibility? Performance regression?):

Check List

  • Relevant documentation/comments is changed or added
  • I acknowledge that all my contributions will be made under the project's license

@@ -90,7 +90,8 @@ int CurveSegment::create() {
<< "' with fd=" << _fd;
if (FLAGS_enableWalDirectWrite) {
_direct_fd = ::open(path.c_str(), O_RDWR|O_NOATIME|O_DIRECT, 0644);
LOG_IF(FATAL, _direct_fd < 0) << "failed to open file with O_DIRECT";
LOG_IF(FATAL, _direct_fd < 0) << "failed to open file with O_DIRECT"
", error: " << strerror(errno);
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的strerror可以考虑用一下butil::berror,strerror在多线程的情况下,存在线程安全的问题。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@bai-charisu bai-charisu closed this Oct 9, 2020
@bai-charisu bai-charisu reopened this Oct 9, 2020
@bai-charisu bai-charisu closed this Oct 9, 2020
@bai-charisu bai-charisu reopened this Oct 9, 2020
@bai-charisu bai-charisu closed this Oct 9, 2020
@bai-charisu bai-charisu reopened this Oct 9, 2020
@xu-chaojie xu-chaojie merged commit 45c97c2 into opencurve:master Oct 10, 2020
@bai-charisu bai-charisu deleted the fix-close-direct branch October 10, 2020 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants