Skip to content

Commit

Permalink
Merge pull request scylladb#390 from scylladb/dk/fix-system-local-query
Browse files Browse the repository at this point in the history
Fix every query to system.local to have WHERE clause
  • Loading branch information
dkropachev authored Feb 14, 2025
2 parents 597d7e3 + d6e2337 commit eef107d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cloud_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestCloudConnection(t *testing.T) {

var localAddress string
var localHostID gocql.UUID
scanner := session.Query("SELECT broadcast_address, host_id FROM system.local").Iter().Scanner()
scanner := session.Query("SELECT broadcast_address, host_id FROM system.local WHERE key='local'").Iter().Scanner()
if scanner.Next() {
if err := scanner.Scan(&localAddress, &localHostID); err != nil {
t.Fatal(err)
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ services:
source: ./testdata/pki/cassandra.key
target: /etc/scylla/db.key
healthcheck:
test: [ "CMD", "cqlsh", "-e", "select * from system.local" ]
test: [ "CMD", "cqlsh", "-e", "select * from system.local where key='local'" ]
interval: 5s
timeout: 5s
retries: 18
Expand All @@ -43,7 +43,7 @@ services:
public:
ipv4_address: 192.168.100.12
healthcheck:
test: [ "CMD", "cqlsh", "192.168.100.12", "-e", "select * from system.local" ]
test: [ "CMD", "cqlsh", "192.168.100.12", "-e", "select * from system.local where key='local'" ]
interval: 5s
timeout: 5s
retries: 18
Expand All @@ -57,7 +57,7 @@ services:
public:
ipv4_address: 192.168.100.13
healthcheck:
test: [ "CMD", "cqlsh", "192.168.100.13", "-e", "select * from system.local" ]
test: [ "CMD", "cqlsh", "192.168.100.13", "-e", "select * from system.local where key='local'" ]
interval: 5s
timeout: 5s
retries: 18
Expand All @@ -74,7 +74,7 @@ services:
public:
ipv4_address: 192.168.100.14
healthcheck:
test: [ "CMD", "cqlsh", "192.168.100.14", "-e", "select * from system.local" ]
test: [ "CMD", "cqlsh", "192.168.100.14", "-e", "select * from system.local where key='local'" ]
interval: 5s
timeout: 5s
retries: 18
Expand Down
2 changes: 1 addition & 1 deletion events_ccm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func TestEventDownQueryable(t *testing.T) {
}

var rows int
if err := session.Query("SELECT COUNT(*) FROM system.local").Scan(&rows); err != nil {
if err := session.Query("SELECT COUNT(*) FROM system.local WHERE key='local'").Scan(&rows); err != nil {
t.Fatal(err)
} else if rows != 1 {
t.Fatalf("expected to get 1 row got %d", rows)
Expand Down
2 changes: 1 addition & 1 deletion ring_describer.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (r *ringDescriber) getHostInfo(hostID UUID) (*HostInfo, error) {
iter = ch.conn.querySystem(context.TODO(), qrySystemPeers)
}
} else {
iter = ch.conn.query(context.TODO(), fmt.Sprintf("SELECT * FROM %s", table))
iter = ch.conn.query(context.TODO(), fmt.Sprintf("SELECT * FROM %s WHERE key='local'", table))
}

if iter != nil {
Expand Down

0 comments on commit eef107d

Please sign in to comment.