You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test: introduce new tests for balanced query routing
The new tests that DefaultPolicy was as expected for LWT and regular queries for tablets and vnodes.
The different configurations will be tested here.
For current stage were added 3 tests for next configurations:
- tablets ON; token_awere policy; node preferences None; permit falover ON
- tablets ON; token_awere policy; node preferences None; permit falover OFF
- tablets ON; token_awere policy; node preferences DC; permit falover ON
More tests will be added later
// running_nodes_amount: cluster state - how much alive nodes (maximum is 3)
45
+
46
+
setup_tracing();
47
+
48
+
// This is just to increase the likelihood that only intended prepared statements (which contain this mark) are captured by the proxy.
49
+
constMAGIC_MARK:i32 = 123;
50
+
let cluster = cluster.lock().await;
51
+
52
+
let handle = ExecutionProfile::builder()
53
+
.load_balancing_policy(policy.clone())
54
+
.retry_policy(Arc::new(FallthroughRetryPolicy))
55
+
.build()
56
+
.into_handle();
57
+
58
+
let history_listener = Arc::new(HistoryCollector::new());
59
+
60
+
// DB preparation phase
61
+
let session:Session = cluster.make_session_builder()
62
+
.await
63
+
.default_execution_profile_handle(handle)
64
+
.build()
65
+
.await
66
+
.unwrap();
67
+
68
+
// *** This is part of original test "lwt_optimisation.rs", uses proxy. Check may be need be implemented with CCM
69
+
// let (supported_frame, _shard) = supported_rx.recv().await.unwrap();
70
+
// let supported_options = types::read_string_multimap(&mut &*supported_frame.body).unwrap();
71
+
// let supported_features = ProtocolFeatures::parse_from_supported(&supported_options);
72
+
73
+
// This will branch our test for cases both when cluster supports the optimisations and when it does not.
74
+
// let supports_optimisation_mark = supported_features.lwt_optimization_meta_bit_mask.is_some();
75
+
// *** END - This is part of original test "lwt_optimisation.rs", uses proxy. Check may be need be implemented with CCM
76
+
77
+
// Create schema
78
+
let ks = unique_keyspace_name();
79
+
80
+
// Enable or disable tablets for the keyspace
81
+
letmut tablets_clause = "";
82
+
ifscylla_supports_tablets(&session).await{
83
+
if tablets_enabled{
84
+
tablets_clause = " AND tablets = {'enabled': true}";
85
+
}else{
86
+
tablets_clause = " AND tablets = {'enabled': false}";
87
+
}
88
+
}
89
+
90
+
let create_ks = format!("CREATE KEYSPACE IF NOT EXISTS {} WITH REPLICATION = {{'class' : 'NetworkTopologyStrategy', 'replication_factor' : 3}}{}", ks, tablets_clause);
91
+
92
+
session.ddl(create_ks).await.unwrap();
93
+
session.use_keyspace(ks,false).await.unwrap();
94
+
95
+
session
96
+
.ddl("CREATE TABLE t (a int primary key, b int)")
97
+
.await
98
+
.unwrap();
99
+
100
+
letmut non_lwt_query:Query = Query::new("INSERT INTO t (a, b) VALUES (?, 1)");
101
+
letmut lwt_query:Query = Query::new("UPDATE t SET b=3 WHERE a=? IF b=2");
0 commit comments