Skip to content

Commit dbca381

Browse files
authored
Merge pull request #1245 from dkropachev/dk/fix-system-local-query
Make any query on system.local go with WHERE clause
2 parents 44b5159 + a3fb2b0 commit dbca381

File tree

9 files changed

+18
-12
lines changed

9 files changed

+18
-12
lines changed

scylla/src/cluster/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ async fn query_peers(
757757
.and_then(|row_result| future::ok((NodeInfoSource::Peer, row_result)));
758758

759759
let mut local_query =
760-
Query::new("select host_id, rpc_address, data_center, rack, tokens from system.local");
760+
Query::new("select host_id, rpc_address, data_center, rack, tokens from system.local WHERE key='local'");
761761
local_query.set_page_size(METADATA_QUERY_PAGE_SIZE);
762762
let local_query_stream = conn
763763
.clone()

scylla/src/network/connection.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2586,7 +2586,7 @@ mod tests {
25862586
// As everything is normal, these queries should succeed.
25872587
for _ in 0..3 {
25882588
tokio::time::sleep(Duration::from_millis(500)).await;
2589-
conn.query_unpaged("SELECT host_id FROM system.local")
2589+
conn.query_unpaged("SELECT host_id FROM system.local WHERE key='local'")
25902590
.await
25912591
.unwrap();
25922592
}
@@ -2610,7 +2610,7 @@ mod tests {
26102610

26112611
// As the router is invalidated, all further queries should immediately
26122612
// return error.
2613-
conn.query_unpaged("SELECT host_id FROM system.local")
2613+
conn.query_unpaged("SELECT host_id FROM system.local WHERE key='local'")
26142614
.await
26152615
.unwrap_err();
26162616

scylla/src/utils/test_utils.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ pub(crate) async fn supports_feature(session: &Session, feature: &str) -> bool {
5454
}
5555

5656
let result = session
57-
.query_unpaged("SELECT supported_features FROM system.local", ())
57+
.query_unpaged(
58+
"SELECT supported_features FROM system.local WHERE key='local'",
59+
(),
60+
)
5861
.await
5962
.unwrap()
6063
.into_rows_result()

scylla/tests/integration/history.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ async fn successful_query_history() {
111111
setup_tracing();
112112
let session = create_new_session_builder().build().await.unwrap();
113113

114-
let mut query = Query::new("SELECT * FROM system.local");
114+
let mut query = Query::new("SELECT * FROM system.local WHERE key='local'");
115115
let history_collector = Arc::new(HistoryCollector::new());
116116
query.set_history_listener(history_collector.clone());
117117

scylla/tests/integration/new_session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async fn proceed_if_only_some_hostnames_are_invalid() {
2020
.await
2121
.unwrap();
2222
session
23-
.query_unpaged("SELECT host_id FROM system.local", &[])
23+
.query_unpaged("SELECT host_id FROM system.local WHERE key='local'", &[])
2424
.await
2525
.unwrap();
2626
}

scylla/tests/integration/utils.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,10 @@ pub(crate) async fn supports_feature(session: &Session, feature: &str) -> bool {
113113
}
114114

115115
let result = session
116-
.query_unpaged("SELECT supported_features FROM system.local", ())
116+
.query_unpaged(
117+
"SELECT supported_features FROM system.local WHERE key='local'",
118+
(),
119+
)
117120
.await
118121
.unwrap()
119122
.into_rows_result()

test/cluster/docker-compose-passauth.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ services:
2222
ports:
2323
- "9042:9042"
2424
healthcheck:
25-
test: [ "CMD", "cqlsh", "scylla", "-e", "select * from system.local" ]
25+
test: [ "CMD", "cqlsh", "scylla", "-e", "select * from system.local WHERE key='local'" ]
2626
interval: 5s
2727
timeout: 5s
2828
retries: 60

test/cluster/docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ services:
2323
--smp 2
2424
--memory 1G
2525
healthcheck:
26-
test: [ "CMD", "cqlsh", "scylla1", "-e", "select * from system.local" ]
26+
test: [ "CMD", "cqlsh", "scylla1", "-e", "select * from system.local WHERE key='local'" ]
2727
interval: 5s
2828
timeout: 5s
2929
retries: 60
@@ -41,7 +41,7 @@ services:
4141
--smp 2
4242
--memory 1G
4343
healthcheck:
44-
test: [ "CMD", "cqlsh", "scylla2", "-e", "select * from system.local" ]
44+
test: [ "CMD", "cqlsh", "scylla2", "-e", "select * from system.local WHERE key='local'" ]
4545
interval: 5s
4646
timeout: 5s
4747
retries: 60
@@ -62,7 +62,7 @@ services:
6262
--smp 2
6363
--memory 1G
6464
healthcheck:
65-
test: [ "CMD", "cqlsh", "scylla3", "-e", "select * from system.local" ]
65+
test: [ "CMD", "cqlsh", "scylla3", "-e", "select * from system.local WHERE key='local'" ]
6666
interval: 5s
6767
timeout: 5s
6868
retries: 60

test/tls/docker-compose-tls.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ services:
2222
- "9042:9042"
2323
- "9142:9142"
2424
healthcheck:
25-
test: [ "CMD", "cqlsh", "scylla", "-e", "select * from system.local" ]
25+
test: [ "CMD", "cqlsh", "scylla", "-e", "select * from system.local WHERE key='local'" ]
2626
interval: 5s
2727
timeout: 5s
2828
retries: 60

0 commit comments

Comments
 (0)