Skip to content

Commit

Permalink
conn: unconditionally retry query execution on errUnprepared (apache#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dahankzter authored and alourie committed Jan 3, 2020
1 parent b7facab commit 68f928e
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -1193,11 +1193,8 @@ func (c *Conn) executeQuery(ctx context.Context, qry *Query) *Iter {
return iter
case *RequestErrUnprepared:
stmtCacheKey := c.session.stmtsLRU.keyFor(c.addr, c.currentKeyspace, qry.stmt)
if c.session.stmtsLRU.remove(stmtCacheKey) {
return c.executeQuery(ctx, qry)
}

return &Iter{err: x, framer: framer}
c.session.stmtsLRU.remove(stmtCacheKey)
return c.executeQuery(ctx, qry)
case error:
return &Iter{err: x, framer: framer}
default:
Expand Down Expand Up @@ -1339,12 +1336,7 @@ func (c *Conn) executeBatch(ctx context.Context, batch *Batch) *Iter {
key := c.session.stmtsLRU.keyFor(c.addr, c.currentKeyspace, stmt)
c.session.stmtsLRU.remove(key)
}

if found {
return c.executeBatch(ctx, batch)
} else {
return &Iter{err: x, framer: framer}
}
return c.executeBatch(ctx, batch)
case *resultRowsFrame:
iter := &Iter{
meta: x.meta,
Expand Down

0 comments on commit 68f928e

Please sign in to comment.