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

Mv hot threads1 #101

Merged
merged 20 commits into from
Oct 19, 2013
Merged

Mv hot threads1 #101

merged 20 commits into from
Oct 19, 2013

Conversation

matthewvon
Copy link
Contributor

This is branch contains the threading code originally developed for the eleveldb async NIF. It was previously delivered in leveldb as part of a patch in branch 1.2.4-turner. Joe B. spotted an unlikely, but real, race condition that this branch addressed via the QueueThread object.

Today only Imm to Level-0 compactions post to a hot thread pool. The goal is to move background disk writes and all background compactions to a series of specialized hot thread pools ... but that will be a different branch.

Matthew V added 18 commits October 14, 2013 10:18
… fix ... and merged with changes already on master
… fix ... and merged with changes already on master
revert to original, fixed 20 percent for internal databasses
… fix ... and merged with changes already on master
… fix ... and merged with changes already on master
@jtuple
Copy link
Contributor

jtuple commented Oct 18, 2013

I'm reviewing this code now. Also, since most of this was previously reviewed in #97, I went spent some time reconstructing a proper change base to review this branch against to make it easier to see what's new since the last review. So, reviewing based off this changeset.

BGFileUnmapper2(ptr);
BGCloseInfo * ptr=new BGCloseInfo(fd_, base_, file_offset_, limit_-base_,
NULL, metadata_offset_);
BGFileUnmapper2(ptr);
Copy link
Contributor

Choose a reason for hiding this comment

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

In this case (the non-async close case), we don't ever delete the allocated BGCloseInfo because line 1209 was changed to assume that BGCloseInfo was submitted to/deallocated by the thread pool -- which isn't true in this case. I think we just need a delete ptr after the BGFileUnmapper2(ptr) call here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good find. I have not rerun valgrind against recent code. Will add refine and refdec pair so that same logic works in both conditions. Refdec to zero deletes object.

@jtuple
Copy link
Contributor

jtuple commented Oct 19, 2013

Ran branch through the same stress testing I did in #97. As noted above, OS X had 200% CPU usage from the safety threads that were never sleeping, but worked fine otherwise. Linux was fine across the board.

I reintroduced the changes that help trigger the known deadlock. With the sem_post in submit commented out, I could hit the deadlock as expected. With sem_post uncommented, things didn't deadlock. Adding print statements showed the safety thread picking up the slack as necessary.

All looks good other than the issues I mentioned in the diff comments above.

@jtuple
Copy link
Contributor

jtuple commented Oct 19, 2013

Looked over changes and retested on OS X and Linux. We should fix the semaphore creation issue before 2.0 final, but no reason to hold up merging now. +1 merge.

matthewvon pushed a commit that referenced this pull request Oct 19, 2013
@matthewvon matthewvon merged commit 4b5245a into master Oct 19, 2013
@ghost ghost assigned matthewvon Oct 21, 2013
@matthewvon matthewvon deleted the mv-hot-threads1 branch May 5, 2016 17:29
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.

2 participants