-
Notifications
You must be signed in to change notification settings - Fork 49
Optimize column_encryption_policy checks in recv_results_rows #630
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: master
Are you sure you want to change the base?
Conversation
There's no point in checking a global policy for every single value decoding, not for every row decoded. Adjusted the code to only check it once per recv_results_rows() call - decode_row() should be defined either as is today with column_encryption_policy enabled, or much simpler without all those extra checks. Added a unit test from CoPilot. Fixes: scylladb#582 Signed-off-by: Yaniv Kaul <[email protected]>
|
CI failure is unrelated, and I've seen it happening on too many PRs already :-/ |
| from cassandra.protocol import ResultMessage, RESULT_KIND_ROWS | ||
|
|
||
|
|
||
| class DecodeOptimizationTest(unittest.TestCase): |
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.
Could you please move this class to tests/unit/test_protocol.py and rename it to ResultTest
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.
Done in 76c09ae
| if __name__ == '__main__': | ||
| unittest.main() |
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.
Please drop it.
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.
Done in 76c09ae
56ef6ea to
3a9031e
Compare
…ack_row() function Very similar to the native Python code, separate the two cases, if column encryption (CE) policy is not enabled, the code is substantially simplified. If it is, it's slightly more elaborate. Decided to have two loops in two functions, one for each case, for performance reasons, even if readability-wise it's not as great. AI agreed with me: Recommendation: Keep it as is. In high-performance Cython code like this, duplicating a small block of code Fixes: scylladb#639 Signed-off-by: Yaniv Kaul <[email protected]>
3a9031e to
ad8b6f9
Compare
dkropachev
left a comment
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.
numpy_parser.pyx, parsing.pyx also needs to be fixed
Add tests, respond to review feedback on added tests. Signed-off-by: Yaniv Kaul <[email protected]>
76c09ae to
f44a9ba
Compare
It wasn't clear to me what needs to fixing there: |
Instead of changing only While Abstract classes: |
Let me see if I understand this:
Is that an accurate representation?
I'm not sure I understand the interaction between Python and Cython - I was not going to change the interfaces whatsoever.
You raise a good point about the names of the functions - that can clearly be more clear with 'plain' and 'encrypted' in them! I'll fix that. |
There's no point in checking a global policy for every single value decoding, not for every row decoded.
Adjusted the code to only check it once per recv_results_rows() call - decode_row() should be defined either as is today with column_encryption_policy enabled,
or much simpler without all those extra checks.
Added a unit test from CoPilot.
Fixes: #582
Pre-review checklist
./docs/source/.Fixes:annotations to PR description.