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
GEODE-8099: add dlock around cms create/delete operations. #5188
Conversation
.../test/java/org/apache/geode/management/internal/api/LocatorClusterManagementServiceTest.java
Outdated
Show resolved
Hide resolved
.../src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java
Outdated
Show resolved
Hide resolved
...pache/geode/distributed/internal/InternalLocatorClusterManagementServiceIntegrationTest.java
Show resolved
Hide resolved
@@ -114,6 +122,7 @@ | |||
private final MemberValidator memberValidator; | |||
private final CommonConfigurationValidator commonValidator; | |||
private final InternalCache cache; | |||
private DistributedLockService cmsDlockService; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move away from lazy-initializing and mutable fields and just make it final.
I'm assuming you made it mutable for testing. This is where you typically want to chain more than one constructor. One of the constructors needs @VisibleForTesting
and pass in the DistributedLockService (as a mock or whatever). The main public constructor can then create the DistributedLockService and pass it as a parameter to the next constructor. The test would use the next constructor that accepts a DistributedLockService.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried your approach, but that affects lots of other integration tests that uses some API in InternalLocator that would start the cms service and hit error when they can't get the dlockservice to inject to it. So I had to revert it back
...pache/geode/distributed/internal/InternalLocatorClusterManagementServiceIntegrationTest.java
Show resolved
Hide resolved
So many tests are affected by the previous change set. They are lots of integration tests that is not easy to update to inject the dlock service.
Thank you for submitting a contribution to Apache Geode.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?
Has your PR been rebased against the latest commit within the target branch (typically
develop
)?Is your initial contribution a single, squashed commit?
Does
gradlew build
run cleanly?Have you written or updated unit tests to verify your changes?
If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
Note:
Please ensure that once the PR is submitted, check Concourse for build issues and
submit an update to your PR as soon as possible. If you need help, please send an
email to dev@geode.apache.org.