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
Skip namespace check for InMemoryKVS #2541
Conversation
We don't care about the namespace for InMemoryKVS, so we want to allow any namespace to be set. Previously, each product that used InMemoryKVS for their tests needed to configure the namespace to be exactly "test".
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.
This change allows products to start without both a keyspace
and a namespace
config on InMemoryKVS. If none of the configs are specified we seem to fail on startup if the timelock block is present — https://github.com/palantir/atlasdb/blob/develop/atlasdb-config/src/main/java/com/palantir/atlasdb/factory/TransactionManagers.java#L588. We should probably make this a test case in TransactionManagersTest
, as I don't know the behavior of timelock with client being empty string.
With this addition, I think this PR should be ready to merge.
Codecov Report
@@ Coverage Diff @@
## develop #2541 +/- ##
=============================================
+ Coverage 60.03% 60.07% +0.03%
+ Complexity 3389 2466 -923
=============================================
Files 860 859 -1
Lines 40119 40079 -40
Branches 4070 4073 +3
=============================================
- Hits 24084 24076 -8
+ Misses 14569 14540 -29
+ Partials 1466 1463 -3
Continue to review full report at Codecov.
|
// Special case - empty timelock and empty namespace/keyspace does not make sense | ||
boolean timelockClientNonEmpty = !timelock().get().client().orElse("").isEmpty(); | ||
Preconditions.checkState(timelockClientNonEmpty, | ||
"For InMemoryKVS, the TimeLock client should not be empty"); |
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 think we could rewrite this as:
if (kvs is InMemory) {
(namespacePresent && namespaceEqualsClientAndKeyspace) || timelockIsNotEmpty
} else {
(namespacePresent && namespaceEqualsClientAndKeyspace) || (keyspacePresent && keyspaceEqualsClient)
}
Feel free to improve it even more. My goal here was to make it as descriptive as possible.
I'm going to approve it as is now, as we could refactor it later. The tests prove that we have the behavior we want here. |
Goals (and why):
We don't care about the namespace for InMemoryKVS, so we want to allow
any namespace to be set. Previously, each product that used InMemoryKVS
for their tests needed to configure the namespace to be exactly "test".
Implementation Description (bullets):
Concerns (what feedback would you like?): Is the config check ignoring too hacky?
Where should we start reviewing?: wherever, it's pretty small
Priority (whenever / two weeks / yesterday): this week, preferably this release as it's been hurting internal testing efforts.
This change is