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

[RocksJava] Fix DefaultEnvTest.incBackgroundThreadsIfNeeded test #5021

Closed
wants to merge 1 commit into from

Conversation

sagar0
Copy link
Contributor

@sagar0 sagar0 commented Feb 27, 2019

DefaultEnvTest.incBackgroundThreadsIfNeeded jtest should assert that the number of threads is greater than or equal to the minimum number of threads.

Test Plan:
This test is failing on my system with an error like:

Expected: 20
Actual: 48

All tests now pass with this fix.

@riversand963
Copy link
Contributor

Curious to know what caused the tests to fail.
Not familiar with Java part, but have a question. I checked https://github.com/facebook/rocksdb/blob/master/util/threadpool_imp.cc#L319 and https://github.com/facebook/rocksdb/blob/master/util/threadpool_imp.cc#L327, looks like we should expect the two to be equal?

Copy link
Collaborator

@adamretter adamretter left a comment

Choose a reason for hiding this comment

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

LGTM

@sagar0
Copy link
Contributor Author

sagar0 commented Feb 28, 2019

@riversand963 In my case defaultEnv.getBackgroundThreads(Priority.LOW) returns 48 even without calling incBackgroundThreadsIfNeeded(20). And since IncBackgroundThreadsIfNeeded(20) calls SetBackgroundThreadsInternal(20, /*allow_reduce*/ false), this fails for me ... as it is not supposed to reduce if it is already greater.

https://github.com/facebook/rocksdb/blob/master/util/threadpool_imp.cc#L319 happens only when allow_reduce=true for one of the conditions, on line 318. The other condition on line 317 doesn't apply here.

Hence the assert should be on isGreaterThanOrEqualTo(num) instead of just isEqualTo(num).

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@sagar0 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@sagar0 sagar0 deleted the java-inc-bgthreads branch March 2, 2019 06:53
sagar0 added a commit that referenced this pull request Mar 26, 2019
Summary:
`DefaultEnvTest.incBackgroundThreadsIfNeeded` jtest should assert that the number of threads is greater than or equal to the minimum number of threads.
Pull Request resolved: #5021

Differential Revision: D14268311

Pulled By: sagar0

fbshipit-source-id: 01fb32b5b3ce636451d162fa1a2bbc5bd1974682
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