jameshartig commented on code in PR #1895:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1895#discussion_r2167881542


##########
host_source.go:
##########
@@ -720,18 +770,25 @@ func (r *ringDescriber) getClusterPeerInfo(localHost 
*HostInfo) ([]*HostInfo, er
                return nil, errNoControl
        }
 
-       rows, err := iter.SliceMap()
-       if err != nil {
-               // TODO(zariel): make typed error
-               return nil, fmt.Errorf("unable to fetch peer host info: %s", 
err)
-       }
-
-       for _, row := range rows {
+       var peers []*HostInfo
+       for {
                // extract all available info about the peer
-               host, err := r.session.newHostInfoFromMap(nil, 
r.session.cfg.Port, row)
+               host, err := r.session.hostInfoFromIter(iter, nil, 
r.session.cfg.Port)
                if err != nil {
-                       return nil, err
-               } else if !isValidPeer(host) {
+                       // if the error came from the iterator then return it, 
otherwise ignore
+                       // and warn
+                       if iterErr := iter.Close(); iterErr != nil {
+                               return nil, fmt.Errorf("unable to fetch peer 
host info: %s", iterErr)
+                       }
+                       // skip over peers that we couldn't parse
+                       r.session.logger.Warning("Failed to parse peer this 
host will be ignored.", newLogFieldError("err", err))
+                       continue
+               }
+               // if nil then none left
+               if host == nil {
+                       break

Review Comment:
   It can now return `nil, nil`. I documented that:
   > // this will return nil, nil if there were no rows left in the Iter



-- 
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

Reply via email to