Skip to content

Commit

Permalink
Merge pull request #1225 from Lorak-mmk/ccm-integration-v3
Browse files Browse the repository at this point in the history
Minimal CCM integration
  • Loading branch information
Lorak-mmk authored Feb 11, 2025
2 parents 73beaa3 + 729a898 commit f1de757
Show file tree
Hide file tree
Showing 12 changed files with 1,529 additions and 36 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/ccm_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CCM tests

on:
push:
branches:
- main
- 'branch-*'
pull_request:
branches:
- '**'
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- name: Install scylla-ccm
run: pip3 install https://github.com/scylladb/scylla-ccm/archive/master.zip
- name: Run CCM command to create the ~/.ccm dir
continue-on-error: true
run: ccm status
- name: Update rust toolchain
run: rustup update
- name: Run CCM tests
run: make ccm-test
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: full
rust_min: 1.70.0 # <- Update this when bumping up MSRV
rust_min: 1.80.0 # <- Update this when bumping up MSRV

jobs:
build:
Expand Down
101 changes: 75 additions & 26 deletions Cargo.lock.msrv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ test: up
SCYLLA_URI3=172.42.0.4:9042 \
cargo test

.PHONY: ccm-test
ccm-test:
RUSTFLAGS="--cfg ccm_tests" RUST_LOG=trace cargo test --test ccm_integration

.PHONY: dockerized-test
dockerized-test: up
test/dockerized/run.sh
Expand Down
10 changes: 5 additions & 5 deletions scylla/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "scylla"
version = "0.15.0"
edition = "2021"
rust-version = "1.70"
rust-version = "1.80"
description = "Async CQL driver for Rust, optimized for Scylla, fully compatible with Apache Cassandra™"
repository = "https://github.com/scylladb/scylla-rust-driver"
readme = "../README.md"
Expand Down Expand Up @@ -43,7 +43,6 @@ full-serialization = [
[dependencies]
scylla-macros = { version = "0.7.0", path = "../scylla-macros" }
scylla-cql = { version = "0.4.0", path = "../scylla-cql" }
byteorder = "1.3.4"
bytes = "1.0.1"
futures = "0.3.6"
hashbrown = "0.14"
Expand All @@ -56,7 +55,6 @@ tokio = { version = "1.34", features = [
"rt",
"macros",
] }
snap = "1.0"
uuid = { version = "1.0", features = ["v4"] }
rand = "0.8.3"
thiserror = "2.0.6"
Expand All @@ -67,7 +65,6 @@ openssl = { version = "0.10.32", optional = true }
tokio-openssl = { version = "0.6.1", optional = true }
arc-swap = "1.3.0"
dashmap = "5.2"
lz4_flex = { version = "0.11.1" }
smallvec = "1.8.0"
async-trait = "0.1.56"
serde = { version = "1.0", features = ["derive"], optional = true }
Expand All @@ -85,11 +82,13 @@ bigdecimal-04 = { package = "bigdecimal", version = "0.4" }
scylla-proxy = { version = "0.0.3", path = "../scylla-proxy" }
ntest = "0.9.3"
criterion = "0.4" # Note: v0.5 needs at least rust 1.70.0
tokio = { version = "1.34", features = ["test-util"] }
tracing-subscriber = { version = "0.3.14", features = ["env-filter"] }
assert_matches = "1.5.0"
rand_chacha = "0.3.1"
time = "0.3"
anyhow = "1.0.95"
tokio = { version = "1.34", features = ["test-util", "fs", "process"] }
tempfile = "3.16"

[[bench]]
name = "benchmark"
Expand All @@ -102,4 +101,5 @@ unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(scylla_cloud_tests)',
'cfg(cassandra_tests)',
'cfg(cpp_rust_unstable)',
'cfg(ccm_tests)',
] }
7 changes: 3 additions & 4 deletions scylla/src/routing/sharding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,8 @@ impl Sharder {

// Choose smallest available port number to begin at after wrapping
// apply the formula from draw_source_port_for_shard for lowest possible gen_range result
let first_valid_port = (49152 + self.nr_shards.get() - 1) / self.nr_shards.get()
* self.nr_shards.get()
+ shard as u16;
let first_valid_port =
49152u16.div_ceil(self.nr_shards.get()) * self.nr_shards.get() + shard as u16;

let before_wrap = (starting_port..=65535).step_by(self.nr_shards.get().into());
let after_wrap = (first_valid_port..starting_port).step_by(self.nr_shards.get().into());
Expand Down Expand Up @@ -191,7 +190,7 @@ mod tests {
setup_tracing();
let nr_shards = 4;
let max_port_num = 65535;
let min_port_num = (49152 + nr_shards - 1) / nr_shards * nr_shards;
let min_port_num = 49152u16.div_ceil(nr_shards) * nr_shards;

let sharder = Sharder::new(ShardCount::new(nr_shards).unwrap(), 12);

Expand Down
Loading

0 comments on commit f1de757

Please sign in to comment.