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

tests: introduce new test for compression #1218

Open
wants to merge 1 commit into
base: branch-hackathon
Choose a base branch
from

Conversation

fruch
Copy link

@fruch fruch commented Feb 10, 2025

test are trying both algorithms (snappy, lz4), while counting the size of the frames coming into scylla

for reference we also have one test doing the same without compression

test main structure was borrowed from java-driver, the usage of proxy to count the packets is unique to this change.

Pre-review checklist

  • I have split my patch into logically separate commits.
  • All commit messages clearly explain what they change and why.
  • [] I added relevant tests for new features and bug fixes.
  • All commits compile, pass static checks and pass test.
  • PR description sums up the changes and reasons why they should be introduced.
  • I have provided docstrings for the public items that I want to introduce.
  • I have adjusted the documentation in ./docs/source/.
  • I added appropriate Fixes: annotations to PR description.

@fruch fruch requested a review from Lorak-mmk February 10, 2025 17:07
Copy link

github-actions bot commented Feb 10, 2025

cargo semver-checks found no API-breaking changes in this PR! 🎉🥳
Checked commit: 58a623c

@fruch fruch force-pushed the hackathon-if-compresssion-tests branch from e8cf9c5 to b7db588 Compare February 10, 2025 17:38
@fruch
Copy link
Author

fruch commented Feb 10, 2025

and now, with the file :)

@roydahan roydahan changed the base branch from main to branch-hackathon February 10, 2025 17:54
Comment on lines 15 to 41
let request_rule = |tx| {
RequestRule(
Condition::or(Condition::RequestOpcode(RequestOpcode::Execute), Condition::RequestOpcode(RequestOpcode::Query)),
RequestReaction::noop().with_feedback_when_performed(tx),
)
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

❓ Isn't it erroneous that you don't filter out the control connection? Depending on when the driver issues metadata queries on it and what responses it gets, the sum of frames' lengths can vary.

Copy link
Author

Choose a reason for hiding this comment

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

I think that no all of the control parts are getting compressed, so they are less relevant

I can include everything back again, but then we'll need to re-calibrate the possible ranges of data length

Copy link
Contributor

Choose a reason for hiding this comment

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

BTW, where are these ranges taken from? Did you calculate them manually? Or these are the values from Java driver tests?

Copy link
Author

@fruch fruch Feb 11, 2025

Choose a reason for hiding this comment

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

I've removed the filters, and calibrated the expected results

Comment on lines 11 to 12

async fn test_compression(compression: Option<Compression>, text_size: usize, expected_frame_total_size_range: std::ops::Range<usize>) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

🔧 Could you please add a docstring / comment explaining the semantics of all parameters and the logic inside?

Copy link
Author

@fruch fruch Feb 11, 2025

Choose a reason for hiding this comment

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

added a docstring (I think it's in the right convention)

scylla/tests/integration/compression.rs Outdated Show resolved Hide resolved
@fruch fruch force-pushed the hackathon-if-compresssion-tests branch 2 times, most recently from 17d6fe9 to 98bcb75 Compare February 11, 2025 14:39
Comment on lines 34 to 41
let request_rule = |tx| {
RequestRule(
Condition::True,
RequestReaction::noop().with_feedback_when_performed(tx),
)
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

🤔 What has changed compared to the previous version (Or(Opcode::Query,Opcode::Execute)) is that now we also count other CQL messages (Options, Startup, etc.). What I suggest is to instead keep the previous condition but AND it with Condition::not(Condition::ConnectionRegisteredAnyEvent)) - then we filter out the control connection's activity.

Copy link
Author

Choose a reason for hiding this comment

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

It's not gonna be accurate anyhow, regardless of what filter we'll be doing

and it's the only thing we need to assess here, if it's compress or not, and we are using the estimated size (with or without control connection activity)

Copy link
Author

Choose a reason for hiding this comment

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

o.k. I've took now the logic you suggested
calibrated again the ranges, and let's see if CI is fine with that.

I think the outcome is the same either way (i.e. it's just a estimated values, and won't be completely accurate)

@fruch fruch force-pushed the hackathon-if-compresssion-tests branch 2 times, most recently from 775d7e9 to 9563038 Compare February 12, 2025 09:37
@fruch fruch requested a review from wprzytula February 12, 2025 09:40
Comment on lines 106 to 110
#[tokio::test]
#[cfg(not(scylla_cloud_tests))]
async fn should_execute_queries_without_compression_10mb() {
test_compression(None, 1024 * 10, 10000..19000).await;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just to be sure: length is given in bytes, so 1024 * 10 is 10 kiB, not 10 MiB, correct? Because the name of the test is ...mb, and this confuses me.

Copy link
Author

Choose a reason for hiding this comment

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

yes I was confusing both thing
it's doesn't make a big difference in this tests if it's MB or MiB

I hope it's a bit clearer now

@wprzytula
Copy link
Collaborator

The test has failed for Cassandra:
assertion failed: expected_frame_total_size_range.contains(&total_frame_size)

@fruch fruch force-pushed the hackathon-if-compresssion-tests branch from 9563038 to 58fcb7b Compare February 13, 2025 15:05
test are trying both algorithms (snappy, lz4), while
counting the size of the frames coming into scylla

for reference we also have one test doing the same without
compression

test main structure was borrowed from java-driver, the usage
of proxy to count the packets is unique to this change.
@fruch fruch force-pushed the hackathon-if-compresssion-tests branch from 58fcb7b to 58a623c Compare February 13, 2025 16:15
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.

3 participants