Skip to content

Commit

Permalink
HBASE-27881 The sleep time in checkQuota of replication WAL reader sh…
Browse files Browse the repository at this point in the history
…ould be controlled independently
  • Loading branch information
sunhelly committed May 25, 2023
1 parent 22526a6 commit fcf98a0
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class ReplicationSourceWALReader extends Thread {
// position in the WAL to start reading at
private long currentPosition;
private final long sleepForRetries;
private final long sleepForQuotaCheck;
private final int maxRetriesMultiplier;

// Indicates whether this particular worker is running
Expand Down Expand Up @@ -102,6 +103,8 @@ public ReplicationSourceWALReader(FileSystem fs, Configuration conf,
int batchCount = conf.getInt("replication.source.nb.batches", 1);
// 1 second
this.sleepForRetries = this.conf.getLong("replication.source.sleepforretries", 1000);
// 300ms
this.sleepForQuotaCheck = this.conf.getLong("replication.source.sleepforquotacheck", 300);
// 5 minutes @ 1 sec per
this.maxRetriesMultiplier = this.conf.getInt("replication.source.maxretriesmultiplier", 300);
this.entryBatchQueue = new LinkedBlockingQueue<>(batchCount);
Expand Down Expand Up @@ -270,7 +273,9 @@ public Path getCurrentPath() {
private boolean checkBufferQuota() {
// try not to go over total quota
if (!this.getSourceManager().checkBufferQuota(this.source.getPeerId())) {
Threads.sleep(sleepForRetries);
LOG.warn("PeerId={}, sleep {}ms for source reader, current WAL is {}",
this.source.getPeerId(), sleepForQuotaCheck, this.getCurrentPath());
Threads.sleep(sleepForQuotaCheck);
return false;
}
return true;
Expand Down

0 comments on commit fcf98a0

Please sign in to comment.