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

GEODE-8099: add dlock around cms create/delete operations. #5188

Merged
merged 5 commits into from Jun 15, 2020

Conversation

jinmeiliao
Copy link
Member

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.

@@ -114,6 +122,7 @@
private final MemberValidator memberValidator;
private final CommonConfigurationValidator commonValidator;
private final InternalCache cache;
private DistributedLockService cmsDlockService;
Copy link
Contributor

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.

Copy link
Member Author

@jinmeiliao jinmeiliao Jun 8, 2020

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

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.
@jinmeiliao jinmeiliao merged commit 0f763ea into apache:develop Jun 15, 2020
@jinmeiliao jinmeiliao deleted the cms branch June 15, 2020 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants