Skip to content

Conversation

@tengu-alt
Copy link
Contributor

@tengu-alt tengu-alt commented Oct 25, 2024

Fix for the #910.
This PR fixes issue, when the driver is unable to unmarshal Cassandra version, which contains additional annotation.

host_source.go Outdated

type cassVersion struct {
Major, Minor, Patch int
AdditionalNotation string

Choose a reason for hiding this comment

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

In Cassandra (and many Java-based projects), the bit after the dash is often called a qualifier or sometimes a suffix. In semantic versioning, it might be part of a pre-release segment or a build meta after a plus sign. However, Cassandra uses variations like snapshot, rc, etc., which are typically called qualifiers.

So, I suggest changing the name of the AdditionalNotation field to the Qualifier.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to this suggestion

Copy link
Contributor

@joao-r-reis joao-r-reis left a comment

Choose a reason for hiding this comment

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

Added some comments. Let's get this in gocql 2.0, can you create a JIRA?

host_source.go Outdated
if err != nil {
return fmt.Errorf("invalid minor version %v: %v", v[1], err)
}
c.AdditionalNotation = vMinor[1]
Copy link
Contributor

Choose a reason for hiding this comment

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

Should return here as we're parsing the qualifier which should always be at the end.

Also if the "suffix" of the version is something like -qualifier1-qualifier2 we want this field to either contain the full suffix string -qualifier1-qualifier2 or this field should be of type []string and the slice should be [qualifier1,qualifier2]. Here's the relevant code in the java driver.

Personally I think it's fine if we just parse the full suffix string including the first -, if anyone is actually interested in parsing these qualifiers then they can do it on their app. In this case the name of the field should probably be Suffix instead of Qualifier though I think?

Copy link
Contributor

Choose a reason for hiding this comment

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

How common will there be multiple qualifiers? I'm fine with Suffix but if there isn't realistically going to be more than one qualifier, then I think Qualifier is still more appropriate.

Copy link
Contributor

Choose a reason for hiding this comment

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

Honestly I don't know, I just noticed there's logic to handle this in the java driver and thought we would do the same here but I don't remember the last time I saw a C* version with multiple qualifiers.

@tengu-alt tengu-alt changed the title fix for the cassandra version unmarshal CASSGO-49 fix for the cassandra version unmarshal Jan 28, 2025
@tengu-alt
Copy link
Contributor Author

@joao-r-reis , @testisnullus I have renamed the AdditionalNotation field to the Suffix, and refactored the way we parse it in case it has more than one qualifier. I decided to retrieve it as one string.

Personally I think it's fine if we just parse the full suffix string including the first -

Could you please clarify why we need to contain the first -? I don't get the point of it.

@jameshartig
Copy link
Contributor

I'm fine with including the - if its being called Suffix but I also don't know if its a big deal either way. It does look like the java driver removes the leading dashes but it also exposes an array.

@joao-r-reis
Copy link
Contributor

James suggested we should keep Qualifier because we don't see versions with multiple qualifiers often (or at all recently). I think we can keep the first - out of it as it is currently on this PR and maybe just renaming it Qualifier, are you ok with this @jameshartig ?

@jameshartig
Copy link
Contributor

James suggested we should keep Qualifier because we don't see versions with multiple qualifiers often (or at all recently). I think we can keep the first - out of it as it is currently on this PR and maybe just renaming it Qualifier, are you ok with this @jameshartig ?

Yep! That sounds good to me

@joao-r-reis
Copy link
Contributor

👍 @tengu-alt all we need is to rename Suffix to Qualifier and we're good to go then

FIx for the issue, when the driver is unable to unmarshal Cassandra version,
which contains additional annotation (suffix).

patch by Oleksandr Luzhniy; reviewed by João Reis, James Hartig, Danylo Savchenko, for CASSGO-49
@tengu-alt
Copy link
Contributor Author

Done, also updated the commit message and the changelog.

@tengu-alt
Copy link
Contributor Author

@joao-r-reis should it be merged?

@joao-r-reis joao-r-reis merged commit 4ad7479 into apache:trunk Feb 3, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants