Skip to content

Commit 09efae1

Browse files
committed
Update leaseTimeMs logic
1 parent 4f62751 commit 09efae1

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/OmConfig.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ public class OmConfig extends ReconfigurableConfig {
167167
type = ConfigType.LONG,
168168
tags = {ConfigTag.OM, ConfigTag.PERFORMANCE, ConfigTag.HA, ConfigTag.RATIS},
169169
description = "If the log lag between leader OM and follower OM is larger " +
170-
"than this number, the follower OM is not up-to-date."
170+
"than this number, the follower OM is not up-to-date. Setting this to -1 " +
171+
"allows read to return immediately (infinity log lag)."
171172
)
172173
private long followerReadLocalLeaseLogLimit;
173174

@@ -178,7 +179,8 @@ public class OmConfig extends ReconfigurableConfig {
178179
tags = {ConfigTag.OM, ConfigTag.PERFORMANCE, ConfigTag.HA, ConfigTag.RATIS},
179180
description = " If the lag time Ms between leader OM and follower OM is larger " +
180181
"than this number, the follower OM is not up-to-date. " +
181-
"By default, it's set to Ratis RPC timeout value."
182+
"By default, it's set to Ratis RPC timeout value." +
183+
"Setting this to -1 allows read to return immediately."
182184
)
183185
private long followerReadLocalLeaseTimeMs;
184186

hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/protocolPB/OzoneManagerProtocolServerSideTranslatorPB.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ boolean allowFollowerReadLocalLease(Division ratisDivision, long leaseLogLimit,
391391
return false; // no leader
392392
}
393393

394-
if (leaseTimeMsLimit != -1 && leaderInfo.getLastRpcElapsedTimeMs() > leaseTimeMsLimit) {
394+
if (leaseTimeMsLimit >= -1 && leaderInfo.getLastRpcElapsedTimeMs() > leaseTimeMsLimit) {
395395
LOG.debug("FollowerRead Local Lease not allowed: Local lease Time expired. ");
396396
ozoneManager.getMetrics().incNumFollowerReadLocalLeaseFailTime();
397397
return false; // lease time expired

0 commit comments

Comments
 (0)