-
Notifications
You must be signed in to change notification settings - Fork 3.8k
CASSANDRA-20883: Add support in the binary protocol to allow transactions to have multiple conditions #4362
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
base: trunk
Are you sure you want to change the base?
Conversation
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.
think i should likely rename this to call out its really only safe for CAS since it has 1 condition
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.
where is this used?
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 spoke in slack
It used to be used but after moving off the all/non bit sets, nothing uses and i forgot to cleanup
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.
do we use this hashCode, or can we throw UnsupportedOperationException? If not, can we just use id?
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.
suggest: new line
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.
code has changed a lot since this comment, i assume you changed this in your feedback branch? I assume you wanted a newline above this?
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.
should this use TxnCondition.None instead of null? Can simplify some other logic then.
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.
outter is a typo, but I prefer superset/subset for this kind of logic as it makes clearer the relationship. Also, we already have this logic in various places. The most obvious is AbstractWithKeysSerializer, though this is more annoying to use that we might like. Surely we at least have the subset bitset logic somewhere already? If not, let's at least consider adding that, but it's a shame this form of logic is getting fragmented and reproduced in different ways.
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.
why not standardise(ish) the two serializers? They're basically the same, we just have an implicit capacity for the small bitset. Then for this serializer we can avoid writing a kind and instead write the capacity, which implies if it can be created as a SmallBitSet or must be a LargeBitSet.
The large serializer can avoid writing out wordsInUse if <= 1, and always serialize at least one long (with value 0 if empty), and then the two are serialied identically, and we would just need the large serializer to expose methods that accept/assume the capacity so we can invoke that directly for this use case.
1b6da45 to
6a27f2b
Compare
| { | ||
| long size = TypeSizes.sizeofUnsignedVInt(t.id); | ||
| size += serializedSizeWithVIntLength(t.condition.bytes()); | ||
| size += TypeSizes.sizeof(t.condition != null); |
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.
Why is condition nullable? I don't believe we assign it anything non-null in real codepaths, and I don't think we should either, since we have the None condition (which takes up 1 byte rather than zero).
…iple conditions patch by David Capwell and Benedict for CASSANDRA-20883
d52dc12 to
0bac600
Compare
No description provided.