From 6e37c7f7678bcf070d4a2f975701f50c12328b9a Mon Sep 17 00:00:00 2001 From: Conor Brosnan Date: Tue, 22 Nov 2022 17:04:06 +1000 Subject: [PATCH] fix cdrs list/set eq --- Cargo.lock | 84 ++++++++++--------- shotover-proxy/Cargo.toml | 4 +- .../cluster/single_rack_v4.rs | 10 +-- shotover-proxy/tests/helpers/cassandra.rs | 7 ++ 4 files changed, 60 insertions(+), 45 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 41a060d1e..9a28daba3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,9 +40,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.19" +version = "0.7.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" dependencies = [ "memchr", ] @@ -228,9 +228,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" [[package]] name = "bytes-utils" @@ -302,7 +302,7 @@ checksum = "8234d29d30873ab5a41e3557b8515d3ecbaefb1ea5be579425b3b0074b6d0e40" [[package]] name = "cassandra-protocol" version = "2.0.1" -source = "git+https://github.com/conorbros/cdrs-tokio?branch=8.0-dev#c207f4ea0c268dc5b1a8031aa820c0f103377ed8" +source = "git+https://github.com/krojew/cdrs-tokio?branch=8.0-dev#546b7b3128682bd23cfab9a8f47465e11bb51598" dependencies = [ "arc-swap", "arrayref", @@ -330,14 +330,14 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.76" +version = "1.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" +checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" [[package]] name = "cdrs-tokio" version = "7.0.2" -source = "git+https://github.com/conorbros/cdrs-tokio?branch=8.0-dev#c207f4ea0c268dc5b1a8031aa820c0f103377ed8" +source = "git+https://github.com/krojew/cdrs-tokio?branch=8.0-dev#546b7b3128682bd23cfab9a8f47465e11bb51598" dependencies = [ "arc-swap", "atomic", @@ -652,22 +652,22 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.11" +version = "0.9.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348" +checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset", + "memoffset 0.7.1", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.12" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ "cfg-if", ] @@ -717,9 +717,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97abf9f0eca9e52b7f81b945524e76710e6cb2366aead23b7d4fbf72e281f888" +checksum = "d4a41a86530d0fe7f5d9ea779916b7cadd2d4f9add748b99c2c029cbbdfaf453" dependencies = [ "cc", "cxxbridge-flags", @@ -729,9 +729,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc32cc5fea1d894b77d269ddb9f192110069a8a9c1f1d441195fba90553dea3" +checksum = "06416d667ff3e3ad2df1cd8cd8afae5da26cf9cec4d0825040f88b5ca659a2f0" dependencies = [ "cc", "codespan-reporting", @@ -744,15 +744,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ca220e4794c934dc6b1207c3b42856ad4c302f2df1712e9f8d2eec5afaacf1f" +checksum = "820a9a2af1669deeef27cb271f476ffd196a2c4b6731336011e0ba63e2c7cf71" [[package]] name = "cxxbridge-macro" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b846f081361125bfc8dc9d3940c84e1fd83ba54bbca7b17cd29483c828be0704" +checksum = "a08a6e2fcc370a089ad3b4aaf54db3b1b4cee38ddabce5896b33eb693275f470" dependencies = [ "proc-macro2", "quote", @@ -1507,6 +1507,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + [[package]] name = "metrics" version = "0.20.1" @@ -1639,7 +1648,7 @@ dependencies = [ "bitflags", "cfg-if", "libc", - "memoffset", + "memoffset 0.6.5", "pin-utils", ] @@ -1931,9 +1940,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.4.0" +version = "6.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5bf27447411e9ee3ff51186bf7a08e16c341efdde93f4d823e8844429bed7e" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" [[package]] name = "overload" @@ -2263,11 +2272,10 @@ dependencies = [ [[package]] name = "rayon" -version = "1.5.3" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" +checksum = "1e060280438193c554f654141c9ea9417886713b7acd75974c85b18a69a88e0b" dependencies = [ - "autocfg", "crossbeam-deque", "either", "rayon-core", @@ -2275,9 +2283,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.9.3" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" +checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -2618,7 +2626,7 @@ checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" [[package]] name = "scylla" version = "0.6.1" -source = "git+https://github.com/scylladb/scylla-rust-driver#61402422a19fdbebe4fb89da1ea8fe297773f34b" +source = "git+https://github.com/scylladb/scylla-rust-driver#30e8f7129eac86bb3da470f52acf359879979eed" dependencies = [ "arc-swap", "async-trait", @@ -2651,7 +2659,7 @@ dependencies = [ [[package]] name = "scylla-cql" version = "0.0.2" -source = "git+https://github.com/scylladb/scylla-rust-driver#61402422a19fdbebe4fb89da1ea8fe297773f34b" +source = "git+https://github.com/scylladb/scylla-rust-driver#30e8f7129eac86bb3da470f52acf359879979eed" dependencies = [ "bigdecimal 0.2.2", "byteorder", @@ -2670,7 +2678,7 @@ dependencies = [ [[package]] name = "scylla-macros" version = "0.1.1" -source = "git+https://github.com/scylladb/scylla-rust-driver#61402422a19fdbebe4fb89da1ea8fe297773f34b" +source = "git+https://github.com/scylladb/scylla-rust-driver#30e8f7129eac86bb3da470f52acf359879979eed" dependencies = [ "quote", "syn", @@ -2727,9 +2735,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.87" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" +checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" dependencies = [ "itoa 1.0.4", "ryu", @@ -2938,9 +2946,9 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "snap" -version = "1.0.5" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45456094d1983e2ee2a18fdfebce3189fa451699d0502cb8e3b49dba5ba41451" +checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" [[package]] name = "socket2" @@ -3182,9 +3190,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.21.2" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" +checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3" dependencies = [ "autocfg", "bytes", diff --git a/shotover-proxy/Cargo.toml b/shotover-proxy/Cargo.toml index bceade53d..cce09973d 100644 --- a/shotover-proxy/Cargo.toml +++ b/shotover-proxy/Cargo.toml @@ -64,7 +64,7 @@ halfbrown = "0.1.11" # Transform dependencies redis-protocol = { version = "4.0.1", features = ["decode-mut"] } -cassandra-protocol = { git = "https://github.com/conorbros/cdrs-tokio", branch = "8.0-dev" } +cassandra-protocol = { git = "https://github.com/krojew/cdrs-tokio", branch = "8.0-dev" } crc16 = "0.4.0" ordered-float = { version = "3.0.0", features = ["serde"] } @@ -91,7 +91,7 @@ hex-literal = "0.3.3" nix = "0.25.0" reqwest = "0.11.6" metrics-util = "0.14.0" -cdrs-tokio = { git = "https://github.com/conorbros/cdrs-tokio", branch = "8.0-dev" } +cdrs-tokio = { git = "https://github.com/krojew/cdrs-tokio", branch = "8.0-dev" } scylla = { git = "https://github.com/scylladb/scylla-rust-driver", features = ["ssl"] } rstest = "0.15.0" diff --git a/shotover-proxy/tests/cassandra_int_tests/cluster/single_rack_v4.rs b/shotover-proxy/tests/cassandra_int_tests/cluster/single_rack_v4.rs index 94eef8741..294fc3586 100644 --- a/shotover-proxy/tests/cassandra_int_tests/cluster/single_rack_v4.rs +++ b/shotover-proxy/tests/cassandra_int_tests/cluster/single_rack_v4.rs @@ -63,7 +63,7 @@ async fn test_rewrite_system_peers_dummy_peers(connection: &CassandraConnection) ResultValue::Any, // Unfortunately token generation appears to be non-deterministic but we can at least assert that // there are 128 tokens per node - ResultValue::Set(std::iter::repeat(ResultValue::Any).take(3 * 128).collect()), + ResultValue::AnyList(std::iter::repeat(ResultValue::Any).take(3 * 128).collect()), ]; let star_results2 = [ ResultValue::Inet("127.0.0.1".parse().unwrap()), @@ -78,7 +78,7 @@ async fn test_rewrite_system_peers_dummy_peers(connection: &CassandraConnection) ResultValue::Any, // Unfortunately token generation appears to be non-deterministic but we can at least assert that // there are 128 tokens per node - ResultValue::Set(std::iter::repeat(ResultValue::Any).take(3 * 128).collect()), + ResultValue::AnyList(std::iter::repeat(ResultValue::Any).take(3 * 128).collect()), ]; let all_columns = "peer, data_center, host_id, preferred_ip, rack, release_version, rpc_address, schema_version, tokens"; @@ -121,7 +121,7 @@ async fn test_rewrite_system_peers_v2_dummy_peers(connection: &CassandraConnecti ResultValue::Any, // Unfortunately token generation appears to be non-deterministic but we can at least assert that // there are 128 tokens per node - ResultValue::Set(std::iter::repeat(ResultValue::Any).take(3 * 128).collect()), + ResultValue::AnyList(std::iter::repeat(ResultValue::Any).take(3 * 128).collect()), ]; let star_results2 = [ ResultValue::Inet("127.0.0.1".parse().unwrap()), @@ -138,7 +138,7 @@ async fn test_rewrite_system_peers_v2_dummy_peers(connection: &CassandraConnecti ResultValue::Any, // Unfortunately token generation appears to be non-deterministic but we can at least assert that // there are 128 tokens per node - ResultValue::Set(std::iter::repeat(ResultValue::Any).take(3 * 128).collect()), + ResultValue::AnyList(std::iter::repeat(ResultValue::Any).take(3 * 128).collect()), ]; let all_columns = "peer, peer_port, data_center, host_id, native_address, native_port, preferred_ip, preferred_port, rack, release_version, schema_version, tokens"; @@ -190,7 +190,7 @@ async fn test_rewrite_system_local(connection: &CassandraConnection) { ResultValue::Any, // Unfortunately token generation appears to be non-deterministic but we can at least assert that // there are 128 tokens per node - ResultValue::Set(std::iter::repeat(ResultValue::Any).take(3 * 128).collect()), + ResultValue::AnyList(std::iter::repeat(ResultValue::Any).take(3 * 128).collect()), // truncated_at is non deterministic so we cant assert on it. ResultValue::Any, ]; diff --git a/shotover-proxy/tests/helpers/cassandra.rs b/shotover-proxy/tests/helpers/cassandra.rs index 7038ce30f..160565ab7 100644 --- a/shotover-proxy/tests/helpers/cassandra.rs +++ b/shotover-proxy/tests/helpers/cassandra.rs @@ -753,6 +753,8 @@ pub enum ResultValue { /// Can be used by the user in assertions to allow any value. #[allow(dead_code)] Any, + #[allow(dead_code)] + AnyList(Vec), } impl PartialEq for ResultValue { @@ -785,6 +787,11 @@ impl PartialEq for ResultValue { (Self::Null, Self::Null) => true, (Self::Any, _) => true, (_, Self::Any) => true, + (Self::AnyList(l0), Self::AnyList(r0)) => l0 == r0, + (Self::AnyList(l0), Self::Set(r0)) => l0 == r0, + (Self::AnyList(l0), Self::List(r0)) => l0 == r0, + (Self::Set(l0), Self::AnyList(r0)) => l0 == r0, + (Self::List(l0), Self::AnyList(r0)) => l0 == r0, _ => false, } }