worryg0d commented on code in PR #1952:
URL:
https://github.com/apache/cassandra-gocql-driver/pull/1952#discussion_r3594830122
##########
conn.go:
##########
@@ -1746,9 +1759,18 @@ func (c *Conn) executeQuery(ctx context.Context, q
*internalQuery) *Iter {
// is not consistent with regards to its schema.
return iter
case *RequestErrUnprepared:
+ if unprepAttempt >= maxUnprepRetries {
+ // Pathological re-prepare loop (server-side cache
evicting
+ // our prepared statement between every attempt). Bail
with
+ // the underlying server error rather than recursing
+ // indefinitely.
+ iter.err = fmt.Errorf("gocql: failed to execute
prepared statement after %d re-prepare attempts: %w",
+ unprepAttempt+1, x)
+ return iter
Review Comment:
Previously, `RequestErrUnprepared` was never returned to the users, but this
patch changes that, so I'm concerned about inconsistencies in error wrapping
here. Similar error types are just returned as is without any wrapping, so it
is possible to type-assert for the desired error type:
```go
err := gocql.Query("...").ExecContext(ctx)
if err != nil {
if syntaxErr, ok := err.(*RequestErrSyntax); ok {
...
}
}
```
However, having this error wrapped makes type-assertion for
`*RequestErrUnprepared` impossible, but it still would work with `errors.As`,
so I'm unsure if this is problematic or not for the users
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]