-
Notifications
You must be signed in to change notification settings - Fork 41.1k
Verifies that the CassandraProperties default values are the same as driver built-in defaults #25130
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
Conversation
…the Cassandra driver's built-in defaults. Fixes gh-24965
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.
Thanks for the PR Chris. I've added a few comments, can you please take a look?
* <p> | ||
* <strong>NOTE:</strong> default property values generally align with the Cassandra | ||
* driver's {@link OptionsMap built-in defaults}. | ||
* |
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.
We don't need this. Whenever the team adds a property with a default value, they look for a test that checks default values and add an assertion.
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.
Cool. Yeh, I wanted to put thoughts there and then get guidance from team. I will remove.
// NOTE: If you specify a default value for one of the driver properties be sure to | ||
// add a test to CassandraPropertiesTest that verifies it is the same as the built-in | ||
// driver's default value - unless the variance in value is intentional. | ||
|
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.
We don't add comments in code like that. Please revert.
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.
Same as above.
|
||
@Test | ||
void defaultValuesAreConsistent() { | ||
String failMsg = "the default value has diverged from the driver's built-in default"; |
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.
While I can't deny it makes the assertions nicer, we're not doing there anywhere else. If you want to discuss the merit of adding such a message, I am happy to consider it but it should be part of a separate issue.
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 would only be valuable in an ecosystem where the team was not aware of defaults and what that all entails (adding an entry to this test, etc). I would definitely add this in my codebase at work but as you stated above, its not needed here. Everyone is "in the know". Removing..
@snicoll thanks for the feedback. I have made the suggested changes. Also, can you comment on the 2 points I added in the PR description?
|
Sorry, I missed those.
When we put a default back then, I based it on Taking the first property as an example, it is @adutra can you help us out?
Either a mistake, or the default change in between which is exactly what this PR is supposed to handle. |
@snicoll I will create a follow on PR that puts the values in parity and adds the test to verify. Or do you prefer that we do it in this PR? |
@Bono007 thanks for asking. This one is a task to improve our test suite and avoid a regression or an inconsistency. If a default for a property is invalid, this is a bug and we'd like another issue just that it shows up in the appropriate place in the release notes. Let's finalize this one and see what @adutra thinks about the current state of affairs. |
Hello! First of all, let's keep in mind that there is no finite set of "default values" in the driver because you can replace virtually any of its components with your own, but 3rd-party components may require different settings to be properly configured. Sometimes too, the driver itself ships with 2 or 3 alternatives of the same component, each of them having its own set of settings. This is why many settings appear commented out in reference.conf. I understand that this doesn't make it any easier to grasp which settings you need to define and when, but that was the price to pay to attain this level of customizability. The closest thing to that notion would be the notion of all the settings that the driver reads, along with their values, when nothing is customized. This is reflected by In the case of heartbeat timeouts, the problem is again JAVA-2841: a few timeouts were raised to 5 seconds by default. Just fix it by setting it to 5 seconds in Spring Boot and we should be good. I promise that we definitely do not want to touch these things again (we did it because of cloud deployments). In the case of request throttlers, there is indeed no default value for settings such as Let me know if I can help with anything else. And thanks for putting up this PR! |
Thank you @adutra for the detail and the links - it was really helpful. A couple of observations:
Here is what I am thinking:
Once we land on direction I am happy to continue this effort and implement those changes. |
No, we don't need to provide a value but we offer a higher-view on them and the default should be consistent IMO. Right now, the default for the type is Let's consider the use case of a user enabling throttling using that property to, let's say, "rate limiting". I'd expect that we have sensible defaults for the queue size and such. If we don't provide a default value for this, then the queue size is 0 which looks like it's going to reject requests almost immediately. Am I right? What I am trying to show here is that using one property enables a behaviour that should work OOB (or fail because a mandatory property isn't set). |
@Bono007 let's go ahead with what we can test (i.e. a default that is effectively available in I am not sure about the 4 throttling options yet. |
@snicoll sounds good.
I think we have that here in this PR - only exception is the discrepancy between default for HEARTBEAT_TIMEOUT (we have 120s and the 4.6 driver has 500ms). |
Can you raise another PR against |
Yes, a queue size of zero would mean queries are rejected as soon as all available permits are exhausted. Definitely not a good default value. |
@adutra thanks. So where do we go from here? Isn't a regular user of Cassandra also affected by this? They would set the property to switch the throttling type and end up with the same behaviour as far as I can see. |
Hm sorry we might have a misunderstanding here. My previous comment was referring to the hypothesis where Spring Boot would explicitly define a default value of zero for A regular driver user, on the other hand, would get an error. If they define In short: can you set max queue size to some special value, maybe Sorry I hope I've made myself more clear this time. |
Sure. Doing that now. Should be in ~30mins |
No, we would never do that of course, quoting myself
Alright so failure is the other case I was referring to in this conversation and that's good the driver behaves that way. We don't need |
Thanks a lot @Bono007 for the follow-up! |
Fixes gh-24965
Points Of Interest
Developer documentation
I was not sure the best way to document "Hey if you set a default value and it aligns w/ the driver default add a test for it in assandraPropertiesTest". For now I put an inline comment in the CasssandraProperties.
Generally align w/ defaults
I am assuming that we want to generally align w/ the driver defaults.
We have a few properties we set defaults for that have no default in the driver. The following tests would fail as the default value in the driver is null. I omitted these tests:
Also, we have a property that is divergent from the driver (test omitted as well):