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-unsubscr...@lucene.apache.org

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



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

Reply via email to