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

ISPN-11845 SingleFileStore location validation should be skipped when global state is disabled #8335

Closed
wants to merge 1 commit into from

Conversation

pferraro
Copy link
Member

https://issues.redhat.com/browse/ISPN-11845

Please cherry-pick into 10.1.x.

Copy link
Contributor

@ryanemerson ryanemerson left a comment

Choose a reason for hiding this comment

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

@pferraro Thanks for the PR. If we add the check to PersitenceUtil#getLocation then the validation will be applied to all of our file based store implementations.

@pferraro
Copy link
Member Author

Makes sense. I'll update the PR.

Attribute<String> location = attributes.attribute(LOCATION);
if (location.isNull() && !globalConfig.globalState().enabled()) {
Log.CONFIG.storeLocationRequired();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove this as the error will always be thrown on startup via PersistenceUtil#getLocation.

Copy link
Member Author

@pferraro pferraro May 18, 2020

Choose a reason for hiding this comment

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

Is it not preferable to detect invalid configuration when the cache configuration is built, rather than fail (after several store startup attempts) when a cache is started?
In WF, this is equivalent to catching the error during a management operation vs failing to deploy an application.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes it is. The correct way is to validate this in the builders, I was trying to save some repetition but this approach makes more sense. The SoftIndexFileStoreConfigurationBuilder will need to be updated to check that the DATA_LOCATION and INDEX_LOCATION in their respective builders are not null. As well the LOCATION and EXPIRATION_LOCATION in the RocksDBStoreConfigurationBuilder.

@@ -2002,4 +2002,7 @@ TimeoutException coordinatorTimeoutWaitingForView(int expectedViewId, int curren

@Message(value = "A store cannot be configured with both preload and purgeOnStartup", id = 589)
CacheConfigurationException preloadAndPurgeOnStartupConflict();

@Message(value = "Store must specify a location when global state is disabled", id = 590)
CacheConfigurationException storeLocationRequired();
Copy link
Contributor

Choose a reason for hiding this comment

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

To allow for better validation of other store location attributes, we should also create an overloaded version of this message.

   @Message(value = "Store must specify the '%s' attribute when global state is disabled", id = 590)
   CacheConfigurationException storeLocationRequired(String attributeName);

@ryanemerson
Copy link
Contributor

ryanemerson commented May 19, 2020

There are lots of related test failures due to the change of behaviour.

@ryanemerson
Copy link
Contributor

Closing in favour of #8361

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