Skip to content

Commit

Permalink
Avoid throwing unnecessarily
Browse files Browse the repository at this point in the history
  • Loading branch information
ifesdjeen committed Aug 11, 2021
1 parent 0837f84 commit 95cce89
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/java/org/apache/cassandra/cql3/QueryProcessor.java
Expand Up @@ -447,7 +447,7 @@ public static ResultMessage.Prepared prepare(String queryString, ClientState cli
// expects into cache, so that it could get PREPARED response on the second try.
ResultMessage.Prepared newBehavior = storePreparedStatement(queryString, null, prepared, forThrift);
ResultMessage.Prepared oldBehavior = clientState.getRawKeyspace() != null ? storePreparedStatement(queryString, clientState.getRawKeyspace(), prepared, forThrift) : newBehavior;
CassandraVersion minVersion = Gossiper.instance.getMinVersion(5, TimeUnit.MILLISECONDS);
CassandraVersion minVersion = Gossiper.instance.getMinVersion(20, TimeUnit.MILLISECONDS);

// Default to old behaviour in case we're not sure about the version. Even if we ever flip back to the old
// behaviour due to the gossip bug or incorrect version string, we'll end up with two re-prepare round-trips.
Expand Down
6 changes: 6 additions & 0 deletions src/java/org/apache/cassandra/gms/Gossiper.java
Expand Up @@ -1912,6 +1912,12 @@ public CassandraVersion getMinVersion(int delay, TimeUnit timeUnit)
{
return minVersionSupplier.get(delay, timeUnit);
}
catch (TimeoutException e)
{
// Timeouts here are harmless: they won't cause reprepares and may only
// cause the old version of the hash to be kept for longer
return null;
}
catch (Throwable e)
{
logger.error("Caught an exception while waiting for min version", e);
Expand Down

0 comments on commit 95cce89

Please sign in to comment.