Skip to content

Commit

Permalink
leader-redis: Log failures to acquire leader at info level. (#593)
Browse files Browse the repository at this point in the history
Instead of logging an error when the leader is already assigned, log it at info.
If no leader was present and the transaction failed, we still log an error.
  • Loading branch information
manolama authored Nov 14, 2023
1 parent 4f5b946 commit 992133c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,12 @@ private boolean tryToAcquire(Jedis client, String key) {
if (results == null || results.isEmpty()) {
return false;
} else if (results.get(0) == null || !results.get(0).equals("OK")) {
logger.error("Failed to acquire the leader key for {}", key);
String data = client.get(key);
if (data != null && !data.equals(leaderString)) {
logger.info("Leader for {} was {}", key, data);
} else {
logger.error("Failed to acquire the leader key for {}", key);
}
return false;
} else {
String data = client.get(key);
Expand Down

0 comments on commit 992133c

Please sign in to comment.