You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/03/10 14:13:51 UTC

[GitHub] [lucene] msokolov commented on a change in pull request #738: LUCENE-10448: Avoid instant rate write bursts by writing bytes buffer in chunks

msokolov commented on a change in pull request #738:
URL: https://github.com/apache/lucene/pull/738#discussion_r823760258



##########
File path: lucene/core/src/java/org/apache/lucene/store/RateLimitedIndexOutput.java
##########
@@ -68,9 +68,14 @@ public void writeByte(byte b) throws IOException {
 
   @Override
   public void writeBytes(byte[] b, int offset, int length) throws IOException {
-    bytesSinceLastPause += length;
-    checkRate();
-    delegate.writeBytes(b, offset, length);
+    while (length > 0) {
+      int chunk = (int) Math.min(currentMinPauseCheckBytes + 1, length);

Review comment:
       we could get in an infinite loop or throw an error or something if `currentMinPauseCheckBytes` is negative. We should prevent that where it is set and add an assertion here. I guess this is pre-existing, but this does add a new failure mode. Maybe just add an assert?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org