mirror of https://github.com/apache/lucene.git
LUCENE-10143: Delegate primitive writes in RateLimitedIndexOutput (#352)
This commit is contained in:
parent
5d2a031159
commit
9e0f3758d2
|
@ -292,6 +292,9 @@ Improvements
|
|||
* LUCENE-10125: Optimize primitive writes in OutputStreamIndexOutput.
|
||||
(Uwe Schindler, Robert Muir, Adrien Grand)
|
||||
|
||||
* LUCENE-10143: Delegate primitive writes in RateLimitedIndexOutput.
|
||||
(Uwe Schindler, Robert Muir, Adrien Grand)
|
||||
|
||||
Bug fixes
|
||||
|
||||
* LUCENE-9686: Fix read past EOF handling in DirectIODirectory. (Zach Chen,
|
||||
|
|
|
@ -73,6 +73,27 @@ public final class RateLimitedIndexOutput extends IndexOutput {
|
|||
delegate.writeBytes(b, offset, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeInt(int i) throws IOException {
|
||||
bytesSinceLastPause += Integer.BYTES;
|
||||
checkRate();
|
||||
delegate.writeInt(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeShort(short i) throws IOException {
|
||||
bytesSinceLastPause += Short.BYTES;
|
||||
checkRate();
|
||||
delegate.writeShort(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeLong(long i) throws IOException {
|
||||
bytesSinceLastPause += Long.BYTES;
|
||||
checkRate();
|
||||
delegate.writeLong(i);
|
||||
}
|
||||
|
||||
private void checkRate() throws IOException {
|
||||
if (bytesSinceLastPause > currentMinPauseCheckBytes) {
|
||||
rateLimiter.pause(bytesSinceLastPause);
|
||||
|
|
Loading…
Reference in New Issue