Skip to content

Commit

Permalink
RATIS-1884. Fix retry cache warning condition (#915)
Browse files Browse the repository at this point in the history
(cherry picked from commit 4e5443a)
  • Loading branch information
SzyWilliam authored and szetszwo committed Sep 5, 2023
1 parent 1dc6c35 commit a483bd4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ratis-docs/src/site/markdown/configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,8 @@ Note that `slowness.timeout` is use in two places:
| **Description** | expire time of retry cache entry |
| **Type** | TimeDuration |
| **Default** | 60s |
Note that we should set an expiration time longer than the total retry waiting duration of clients
in order to ensure exactly-once semantic.

| **Property** | `raft.server.retrycache.statistics.expire-time` |
|:----------------|:------------------------------------------------|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,7 @@ static void setSlownessTimeout(RaftProperties properties, TimeDuration expiryTim
interface RetryCache {
String PREFIX = RaftServerConfigKeys.PREFIX + ".retrycache";

/** We should set expiry time longer than total client retry to guarantee exactly-once semantic */
String EXPIRY_TIME_KEY = PREFIX + ".expirytime";
TimeDuration EXPIRY_TIME_DEFAULT = TimeDuration.valueOf(60, TimeUnit.SECONDS);
static TimeDuration expiryTime(RaftProperties properties) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1777,7 +1777,7 @@ private CompletableFuture<Message> replyPendingRequest(
// update the retry cache
final CacheEntry cacheEntry = retryCache.getOrCreateEntry(invocationId);
Preconditions.assertTrue(cacheEntry != null);
if (getInfo().isLeader() && !cacheEntry.isCompletedNormally()) {
if (getInfo().isLeader() && cacheEntry.isCompletedNormally()) {
LOG.warn("{} retry cache entry of leader should be pending: {}", this, cacheEntry);
}
if (cacheEntry.isFailed()) {
Expand Down

0 comments on commit a483bd4

Please sign in to comment.