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 condition race for ReclaimOldDBPtr #246

Merged
merged 1 commit into from
May 7, 2021
Merged

Fix condition race for ReclaimOldDBPtr #246

merged 1 commit into from
May 7, 2021

Conversation

ShooterIT
Copy link
Member

I change excuting_command_num_ memory order to std::memory_order_seq_cst, even loading can establish inter-thread sync, but i think it is not error-prone if atomic variable has sync semantic cross multi threads.

@ShooterIT ShooterIT requested a review from git-hulk May 5, 2021 13:22
Copy link
Member

@git-hulk git-hulk left a comment

Choose a reason for hiding this comment

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

LGTM

@ShooterIT
Copy link
Member Author

ShooterIT commented May 6, 2021

Actually, i don't satisfied with my PR, so it is a draft, for ReclaimOldDBPtr implementation, maybe std::shared_mutex in c++17 is our wanted way, but C++17 is too new, and i also don't want to implement read write lock

@git-hulk
Copy link
Member

git-hulk commented May 6, 2021

yeah, another alternative was the boost shared mutex for C++ 11, which we have considered before and thought too heavy for us to import the boost library. I'm not sure whether have holes if we implement a simple one.

@ShooterIT ShooterIT marked this pull request as ready for review May 7, 2021 07:00
@ShooterIT ShooterIT merged commit 9781e93 into apache:unstable May 7, 2021
@ShooterIT ShooterIT deleted the fix-condition-race branch May 7, 2021 09:15
@ShooterIT
Copy link
Member Author

@Mergifyio backport 1.3

mergify bot pushed a commit that referenced this pull request May 12, 2021
@mergify
Copy link

mergify bot commented May 12, 2021

Command backport 1.3: success

Backports have been created

ShooterIT pushed a commit that referenced this pull request May 12, 2021
This was referenced May 18, 2021
ShooterIT added a commit that referenced this pull request May 18, 2021
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.

2 participants