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: make those gfsh commands that updates cluster configurati… #5285

Merged
merged 2 commits into from Jun 25, 2020

Conversation

jinmeiliao
Copy link
Member

…on thead safe.

  • command executor will acquire the lock when executing commands that affects cluster configuration.
  • clean up commands that doesn't need to extends implement SingleGfshCommand
  • SingleGfshCommand are for those commands that need to update cluster configuration

…on thead safe.

* command executor will acquire the lock when executing commands that affects cluster configuration.
* clean up commands that doesn't need to extends implement SingleGfshCommand
* SingleGfshCommand are for those commands that need to update cluster configuration
@@ -113,7 +113,7 @@
public class LocatorClusterManagementService implements ClusterManagementService {
@VisibleForTesting
// the dlock service name used by the CMS
static final String CMS_DLOCK_SERVICE_NAME = "CMS_DLOCK_SERVICE";
public static final String CMS_DLOCK_SERVICE_NAME = "CMS_DLOCK_SERVICE";

Choose a reason for hiding this comment

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

Since "LocatorClusterManagementService" is central to the ClusterConfigurationService; will it be better to have the cms-dlock service created in this class; and have helper method to lock and unlock. Assumption is when the lock is requested the Locator Management service will be up and running.

lockConfigForUpdate() {}
unLockConfigForUpdate() {}

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe it is created by this class, see getCmsDlockService in this class

Choose a reason for hiding this comment

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

In this PR. the Dlock is getting created in "OnlineCommandProcessor.java"; I don't have latest develop, my guess it may be getting created in rest endpoint too...

Copy link
Member Author

Choose a reason for hiding this comment

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

they both call DLockService.getOrCreateService, if it's already created, it will just get it. So, I guess whoever get to it first will create it.

Choose a reason for hiding this comment

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

Can that creating (getOrCreateService ) be done in one place, in "LocatorClusterManagementService" which seems to be right place for it...

Copy link
Member Author

Choose a reason for hiding this comment

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

Then OnlineCommandProcessor needs to get ahold of LocatorClusterManagementService and get the dLock service from there? What if CMS is not started? Gfsh still needs to have this dLockService.

Choose a reason for hiding this comment

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

My understanding was, we have centralized configuration-management class, that is used by both gfsh and rest end-point to make the configuration changes, and I thought it was LocatorClusterManagementService, I guess I am wrong...

Is it "InternalConfigurationPersistenceService" where both gfsh and end-point make the configuration changes...If so, can the dlock creation and unlocking/unlocking helper method be added there.

I am trying to see if we can have the lock creation in one place, rather than in many clients/apis that make the configuration changes...

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, the InternalConfigurationPersistenceService is used by both rest and gfsh to persist the configuration change in the region, and it already has its own dlockService to make sure update to the region is thread safe.

What are trying to. make thread-safe in here is not just "update to the region", it's the "update to the servers and then update the region", which is a level above the persistence layer. Both rest and gfsh does this and so both needs the same dlockService.

Copy link
Contributor

@jchen21 jchen21 left a comment

Choose a reason for hiding this comment

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

I have some questions about SingleGfshCommand, which is extended by commands that will update cluster config. Now in this pull request, quite a few classes used to be subclasses of SingleGfshCommand now become the subclasses of GfshCommand. Does it mean that these classes don't update cluster config any more?

By default, the subclasses of GfshCommand returns false for affectsClusterConfiguration. But some class, e.g. AlterRuntimeConfigCommand that extends GfshCommand returns true for affectsClusterConfiguration. Why is that?

@jinmeiliao
Copy link
Member Author

I have some questions about SingleGfshCommand, which is extended by commands that will update cluster config. Now in this pull request, quite a few classes used to be subclasses of SingleGfshCommand now become the subclasses of GfshCommand. Does it mean that these classes don't update cluster config any more?

They don't update cluster config at all. They don't need to extends SingleGfshCommand in the first place and they didn't even implement the updateGroupConfig method at all.

By default, the subclasses of GfshCommand returns false for affectsClusterConfiguration. But some class, e.g. AlterRuntimeConfigCommand that extends GfshCommand returns true for affectsClusterConfiguration. Why is that?

Because AlterRuntimConfigComand does affect cluster configuration. It updates the properties part of the cluster configuration.

@jinmeiliao jinmeiliao merged commit b65af0e into apache:develop Jun 25, 2020
@jinmeiliao jinmeiliao deleted the gfshLock branch June 25, 2020 20:05
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