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

Value support for Cassandra types #409

Merged
merged 7 commits into from Jan 13, 2022
Merged

Conversation

conorbros
Copy link
Member

@conorbros conorbros commented Dec 8, 2021

Pulling some changes out of #404

Done

  • Support all native and collection Cassandra types in Value
  • Add todos for conversions not yet implemented.

@conorbros conorbros requested a review from rukai December 8, 2021 04:23
@rukai
Copy link
Member

rukai commented Dec 8, 2021

I think the questions we really need to answer before trying to resolve these issues is:

  • Does the data represented in Value need to be able to read without losing precision/accuracy from the original message?
  • And a stronger requirement: Do we need to be able to roundtrip all data through Value?

@benbromhead
Copy link
Member

To answer @rukai questions. Yes to both.

We should be able to losslesly go from arbitrary Redis <=> Value and Cassandra <=> Value (thus Redis <=> Cassandra)

@benbromhead
Copy link
Member

This will result in some "less than optimal" decisions. E.g. storing certain types that use more memory than needed. E.g. if one datastores Int type is 32 bits and another is 64 bits.

For the moment, I would just continue down the path of conversion to a common Value type and using that as common intermediary. For some context, however, @Claude-at-Instaclustr and I have also had some discussions about a better way of representing internal types and presenting a nicer way to reason about them. Mainly using a resource descriptor framework (RDF triple). An RDF won't solve the above two questions, but it will provide a better way of reasoning about types... potentially.

See https://ieeexplore.ieee.org/document/7226706 for some background reading.

@Claude-at-Instaclustr
Copy link
Contributor

Claude-at-Instaclustr commented Dec 8, 2021 via email

Copy link
Member

@rukai rukai left a comment

Choose a reason for hiding this comment

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

Some initial feedback, I'll look into the BigInt and BigDecimal stuff deeper tomorrow

shotover-proxy/src/message/mod.rs Outdated Show resolved Hide resolved
shotover-proxy/src/message/mod.rs Outdated Show resolved Hide resolved
shotover-proxy/src/message/mod.rs Outdated Show resolved Hide resolved
shotover-proxy/src/message/mod.rs Outdated Show resolved Hide resolved
shotover-proxy/src/message/mod.rs Outdated Show resolved Hide resolved
Copy link
Member

@rukai rukai left a comment

Choose a reason for hiding this comment

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

Once all the feedback is addressed we can land this.

As you've said, in a follow up PR you can add tests for all functions here (Dont bother with into_str_bytes though as its implementation is currently nonsense)

shotover-proxy/src/message/mod.rs Outdated Show resolved Hide resolved
@conorbros
Copy link
Member Author

I'll implement the collections stuff in this PR too because that's blocking my other Cassandra integration test PRs

@conorbros conorbros force-pushed the message branch 2 times, most recently from 80ef3ee to 590af10 Compare December 15, 2021 10:55
@conorbros
Copy link
Member Author

Updates:

@conorbros conorbros force-pushed the message branch 3 times, most recently from 798c4ff to 415371a Compare December 16, 2021 08:34
shotover-proxy/Cargo.toml Outdated Show resolved Hide resolved
@conorbros
Copy link
Member Author

While rebasing I accidentally added into_str_bytes back so I have removed it in the most recent commit.

shotover-proxy/Cargo.toml Outdated Show resolved Hide resolved
@conorbros
Copy link
Member Author

Addressed all of the feedback. The changes to cdrs-tokio can be found here

Copy link
Member

@rukai rukai left a comment

Choose a reason for hiding this comment

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

This looks fine to me.
I can approve once the cassandra-protocol changes land upstream.

One thing I did notice: for some reason #[allow(clippy::mutable_key_type)] isnt needed if we dont store values as an intermediate variable.
Up to you if you want to make use of that.

@conorbros
Copy link
Member Author

That is strange, I've removed it so we don't have an unnecessary #[allow].

Opened a PR for the changes to cdrs-tokio: krojew/cdrs-tokio#74

Copy link
Member

@rukai rukai left a comment

Choose a reason for hiding this comment

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

LGTM

@conorbros conorbros enabled auto-merge (squash) January 13, 2022 08:00
@conorbros conorbros merged commit 2775e99 into shotover:main Jan 13, 2022
@conorbros conorbros deleted the message branch January 14, 2022 05:07
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.

None yet

4 participants