tengu-alt commented on code in PR #1790: URL: https://github.com/apache/cassandra-gocql-driver/pull/1790#discussion_r2024619893
########## conn.go: ########## @@ -1689,36 +1689,37 @@ func (c *Conn) querySystemLocal(ctx context.Context) *Iter { func (c *Conn) awaitSchemaAgreement(ctx context.Context) (err error) { const localSchemas = "SELECT schema_version FROM system.local WHERE key='local'" - var versions map[string]struct{} + versions := make(map[string]struct{}) var schemaVersion string endDeadline := time.Now().Add(c.session.cfg.MaxWaitSchemaAgreement) for time.Now().Before(endDeadline) { - iter := c.querySystemPeers(ctx, c.host.version) + iter := &Iter{} + if !c.session.cfg.DisableHostLookup { + iter = c.querySystemPeers(ctx, c.host.version) - versions = make(map[string]struct{}) - - rows, err := iter.SliceMap() - if err != nil { - goto cont - } - - for _, row := range rows { - host, err := c.session.hostInfoFromMap(row, &HostInfo{connectAddress: c.host.ConnectAddress(), port: c.session.cfg.Port}) + rows, err := iter.SliceMap() if err != nil { goto cont } - if !isValidPeer(host) || host.schemaVersion == "" { - c.logger.Printf("invalid peer or peer with empty schema_version: peer=%q", host) - continue - } - versions[host.schemaVersion] = struct{}{} - } + for _, row := range rows { + host, err := c.session.hostInfoFromMap(row, &HostInfo{connectAddress: c.host.ConnectAddress(), port: c.session.cfg.Port}) + if err != nil { + goto cont + } + if !isValidPeer(host) || host.schemaVersion == "" { + c.logger.Printf("invalid peer or peer with empty schema_version: peer=%q", host) + continue + } - if err = iter.Close(); err != nil { - goto cont + versions[host.schemaVersion] = struct{}{} + } + + if err = iter.Close(); err != nil { + goto cont + } Review Comment: Agree, fixed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org