Skip to content

Commit f1de757

Browse files
authored
Merge pull request #1225 from Lorak-mmk/ccm-integration-v3
Minimal CCM integration
2 parents 73beaa3 + 729a898 commit f1de757

File tree

12 files changed

+1529
-36
lines changed

12 files changed

+1529
-36
lines changed

.github/workflows/ccm_tests.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CCM tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'branch-*'
8+
pull_request:
9+
branches:
10+
- '**'
11+
env:
12+
CARGO_TERM_COLOR: always
13+
RUST_BACKTRACE: full
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 60
19+
steps:
20+
- uses: actions/checkout@v3
21+
- name: Install scylla-ccm
22+
run: pip3 install https://github.com/scylladb/scylla-ccm/archive/master.zip
23+
- name: Run CCM command to create the ~/.ccm dir
24+
continue-on-error: true
25+
run: ccm status
26+
- name: Update rust toolchain
27+
run: rustup update
28+
- name: Run CCM tests
29+
run: make ccm-test

.github/workflows/rust.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313
CARGO_TERM_COLOR: always
1414
RUSTFLAGS: -Dwarnings
1515
RUST_BACKTRACE: full
16-
rust_min: 1.70.0 # <- Update this when bumping up MSRV
16+
rust_min: 1.80.0 # <- Update this when bumping up MSRV
1717

1818
jobs:
1919
build:

Cargo.lock.msrv

+75-26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ test: up
4444
SCYLLA_URI3=172.42.0.4:9042 \
4545
cargo test
4646

47+
.PHONY: ccm-test
48+
ccm-test:
49+
RUSTFLAGS="--cfg ccm_tests" RUST_LOG=trace cargo test --test ccm_integration
50+
4751
.PHONY: dockerized-test
4852
dockerized-test: up
4953
test/dockerized/run.sh

scylla/Cargo.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "scylla"
33
version = "0.15.0"
44
edition = "2021"
5-
rust-version = "1.70"
5+
rust-version = "1.80"
66
description = "Async CQL driver for Rust, optimized for Scylla, fully compatible with Apache Cassandra™"
77
repository = "https://github.com/scylladb/scylla-rust-driver"
88
readme = "../README.md"
@@ -43,7 +43,6 @@ full-serialization = [
4343
[dependencies]
4444
scylla-macros = { version = "0.7.0", path = "../scylla-macros" }
4545
scylla-cql = { version = "0.4.0", path = "../scylla-cql" }
46-
byteorder = "1.3.4"
4746
bytes = "1.0.1"
4847
futures = "0.3.6"
4948
hashbrown = "0.14"
@@ -56,7 +55,6 @@ tokio = { version = "1.34", features = [
5655
"rt",
5756
"macros",
5857
] }
59-
snap = "1.0"
6058
uuid = { version = "1.0", features = ["v4"] }
6159
rand = "0.8.3"
6260
thiserror = "2.0.6"
@@ -67,7 +65,6 @@ openssl = { version = "0.10.32", optional = true }
6765
tokio-openssl = { version = "0.6.1", optional = true }
6866
arc-swap = "1.3.0"
6967
dashmap = "5.2"
70-
lz4_flex = { version = "0.11.1" }
7168
smallvec = "1.8.0"
7269
async-trait = "0.1.56"
7370
serde = { version = "1.0", features = ["derive"], optional = true }
@@ -85,11 +82,13 @@ bigdecimal-04 = { package = "bigdecimal", version = "0.4" }
8582
scylla-proxy = { version = "0.0.3", path = "../scylla-proxy" }
8683
ntest = "0.9.3"
8784
criterion = "0.4" # Note: v0.5 needs at least rust 1.70.0
88-
tokio = { version = "1.34", features = ["test-util"] }
8985
tracing-subscriber = { version = "0.3.14", features = ["env-filter"] }
9086
assert_matches = "1.5.0"
9187
rand_chacha = "0.3.1"
9288
time = "0.3"
89+
anyhow = "1.0.95"
90+
tokio = { version = "1.34", features = ["test-util", "fs", "process"] }
91+
tempfile = "3.16"
9392

9493
[[bench]]
9594
name = "benchmark"
@@ -102,4 +101,5 @@ unexpected_cfgs = { level = "warn", check-cfg = [
102101
'cfg(scylla_cloud_tests)',
103102
'cfg(cassandra_tests)',
104103
'cfg(cpp_rust_unstable)',
104+
'cfg(ccm_tests)',
105105
] }

scylla/src/routing/sharding.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,8 @@ impl Sharder {
8484

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

9190
let before_wrap = (starting_port..=65535).step_by(self.nr_shards.get().into());
9291
let after_wrap = (first_valid_port..starting_port).step_by(self.nr_shards.get().into());
@@ -191,7 +190,7 @@ mod tests {
191190
setup_tracing();
192191
let nr_shards = 4;
193192
let max_port_num = 65535;
194-
let min_port_num = (49152 + nr_shards - 1) / nr_shards * nr_shards;
193+
let min_port_num = 49152u16.div_ceil(nr_shards) * nr_shards;
195194

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

0 commit comments

Comments
 (0)