diff --git a/policies.go b/policies.go index 0fec485b4..3927878be 100644 --- a/policies.go +++ b/policies.go @@ -982,10 +982,7 @@ func (d *dcAwareRR) IsOperational(session *Session) error { return nil } - hosts, _, err := session.hostSource.GetHosts() - if err != nil { - return fmt.Errorf("gocql: unable to check if session is operational: %v", err) - } + hosts := session.hostSource.allHosts() for _, host := range hosts { if !session.cfg.filterHost(host) && host.DataCenter() == d.local { // Policy can work properly only if there is at least one host from target DC @@ -1103,10 +1100,7 @@ func (d *rackAwareRR) IsOperational(session *Session) error { if session.cfg.disableInit || session.cfg.disableControlConn { return nil } - hosts, _, err := session.hostSource.GetHosts() - if err != nil { - return fmt.Errorf("gocql: unable to check if session is operational: %v", err) - } + hosts := session.hostSource.allHosts() for _, host := range hosts { if !session.cfg.filterHost(host) && host.DataCenter() == d.localDC && host.Rack() == d.localRack { // Policy can work properly only if there is at least one host from target DC+Rack diff --git a/tablet_integration_test.go b/tablet_integration_test.go index 1419a3c00..ce81f5e07 100644 --- a/tablet_integration_test.go +++ b/tablet_integration_test.go @@ -24,8 +24,7 @@ func TestTablets(t *testing.T) { panic(fmt.Sprintf("unable to create table: %v", err)) } - hosts, _, err := session.hostSource.GetHosts() - assertTrue(t, "err == nil", err == nil) + hosts := session.hostSource.allHosts() hostAddresses := []string{} for _, host := range hosts { @@ -37,7 +36,7 @@ func TestTablets(t *testing.T) { i := 0 for i < 50 { i = i + 1 - err = session.Query(`INSERT INTO test1.table1 (pk, ck, v) VALUES (?, ?, ?);`, i, i%5, i%2).WithContext(ctx).Exec() + err := session.Query(`INSERT INTO test1.table1 (pk, ck, v) VALUES (?, ?, ?);`, i, i%5, i%2).WithContext(ctx).Exec() if err != nil { t.Fatal(err) } @@ -52,7 +51,7 @@ func TestTablets(t *testing.T) { var ck int var v int - err = session.Query(`SELECT pk, ck, v FROM test1.table1 WHERE pk = ?;`, i).WithContext(ctx).Consistency(One).Trace(trace).Scan(&pk, &ck, &v) + err := session.Query(`SELECT pk, ck, v FROM test1.table1 WHERE pk = ?;`, i).WithContext(ctx).Consistency(One).Trace(trace).Scan(&pk, &ck, &v) if err != nil { t.Fatal(err) }