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

HDDS-2368. TestOzoneManagerDoubleBufferWithDummyResponse failing intermittently #93

Merged
merged 1 commit into from Oct 27, 2019

Conversation

adoroszlai
Copy link
Contributor

What changes were proposed in this pull request?

Fix TestOzoneManagerDoubleBufferWithDummyResponse, which (very) intermittently fails at:

testDoubleBufferWithDummyResponse(TestOzoneManagerDoubleBufferWithDummyResponse.java:116)

Variables are set in one thread (OzoneManagerDoubleBuffer#daemon):

https://github.com/apache/hadoop-ozone/blob/6a6558025ec35203bfd61839aadf7b2a26520222/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerDoubleBuffer.java#L160-L186

and checked in the test thread:

https://github.com/apache/hadoop-ozone/blob/6a6558025ec35203bfd61839aadf7b2a26520222/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/ratis/TestOzoneManagerDoubleBufferWithDummyResponse.java#L110-L117

The test waits for the first variable (flushedTransactionCount) to reach bucketCount. The other variable (totalNumOfFlushedTransactions) is set later, so the test thread may reach the assertion before the updater thread reaches updateMetrics.

The proposed fix swaps check of variables in the test: wait for the second variable and let the assertion check the first one. This guarantees that both of them are updated by the time waitFor returns.

https://issues.apache.org/jira/browse/HDDS-2368

How was this patch tested?

Reproduced the failure by adding some sleep in OzoneManagerDoubleBuffer#updateMetrics. Verified the test passes with the fix despite the sleep.

Copy link
Contributor

@bharatviswa504 bharatviswa504 left a comment

Choose a reason for hiding this comment

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

+1 LGTM.
Thank You @adoroszlai for the nice catch and the contribution.

@bharatviswa504 bharatviswa504 merged commit 8541c56 into apache:master Oct 27, 2019
@adoroszlai adoroszlai deleted the HDDS-2368 branch October 27, 2019 15:49
@adoroszlai
Copy link
Contributor Author

Thanks @bharatviswa504 for reviewing and merging it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants