This is an automated email from the ASF dual-hosted git repository.

joao-r-reis pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-gocql-driver.git


The following commit(s) were added to refs/heads/trunk by this push:
     new e1d69bd6 Fix system.peers_v2 fallback
e1d69bd6 is described below

commit e1d69bd6c1503ec8b20f542ece1da5f65deefc50
Author: João Reis <[email protected]>
AuthorDate: Fri May 29 18:20:29 2026 +0100

    Fix system.peers_v2 fallback
    
    The fallback to system.peers if system.peers_v2 doesn't exist doesn't work. 
This patch addresses this.
    
    Patch by João Reis; reviewed by Bohdan Siryk for CASSGO-126
---
 CHANGELOG.md | 1 +
 conn.go      | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index cba0d801..21bfbd2e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic 
Versioning](https://semver.org/spec/v2.0.0
 ### Fixed
 
 - Prevent panic when using a HostFilter and keyspace is not replicated to 
every DC (CASSGO-122)
+- system.peers fallback doesn't work in some scenarios (CASSGO-126)
 
 ## [2.1.1]
 
diff --git a/conn.go b/conn.go
index a615129d..9d36cbc3 100644
--- a/conn.go
+++ b/conn.go
@@ -1952,7 +1952,8 @@ func (c *Conn) querySystemPeers(ctx context.Context, 
version cassVersion) *Iter
 
                err := iter.checkErrAndNotFound()
                if err != nil {
-                       if errFrame, ok := err.(errorFrame); ok && 
errFrame.code == ErrCodeInvalid { // system.peers_v2 not found, try system.peers
+                       var requestErr RequestError
+                       if errors.As(err, &requestErr) && requestErr.Code() == 
ErrCodeInvalid { // system.peers_v2 not found, try system.peers
                                c.mu.Lock()
                                c.isSchemaV2 = false
                                c.mu.Unlock()


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to