public class MergeRateLimiter extends RateLimiter
RateLimiter
that IndexWriter
assigns to each running merge, to
give MergeScheduler
s ionice like control.
This is similar to RateLimiter.SimpleRateLimiter
, except it's merge-private,
it will wake up if its rate changes while it's paused, it tracks how
much time it spent stopped and paused, and it supports aborting.RateLimiter.SimpleRateLimiter
Constructor and Description |
---|
MergeRateLimiter(MergePolicy.OneMerge merge)
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
checkAbort()
Throws
MergePolicy.MergeAbortedException if this merge was aborted. |
boolean |
getAbort()
Returns true if this merge was aborted.
|
double |
getMBPerSec()
The current MB per second rate limit.
|
long |
getMinPauseCheckBytes()
How many bytes caller should add up itself before invoking
RateLimiter.pause(long) . |
long |
getTotalBytesWritten()
Returns total bytes written by this merge.
|
long |
getTotalPausedNS()
Total NS merge was paused to rate limit IO.
|
long |
getTotalStoppedNS()
Total NS merge was stopped.
|
long |
pause(long bytes)
Pauses, if necessary, to keep the instantaneous IO
rate at or below the target.
|
void |
setAbort()
Mark this merge aborted.
|
void |
setMBPerSec(double mbPerSec)
Sets an updated MB per second rate limit.
|
public MergeRateLimiter(MergePolicy.OneMerge merge)
public void setMBPerSec(double mbPerSec)
RateLimiter
setMBPerSec
in class RateLimiter
public double getMBPerSec()
RateLimiter
getMBPerSec
in class RateLimiter
public long getTotalBytesWritten()
public long pause(long bytes) throws MergePolicy.MergeAbortedException
RateLimiter
Note: the implementation is thread-safe
pause
in class RateLimiter
MergePolicy.MergeAbortedException
public long getTotalStoppedNS()
public long getTotalPausedNS()
public void checkAbort() throws MergePolicy.MergeAbortedException
MergePolicy.MergeAbortedException
if this merge was aborted.public void setAbort()
public boolean getAbort()
public long getMinPauseCheckBytes()
RateLimiter
RateLimiter.pause(long)
.getMinPauseCheckBytes
in class RateLimiter
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.