org.apache.lucene.index

## Class MergeRateLimiter

- java.lang.Object
- - org.apache.lucene.store.RateLimiter
  - - org.apache.lucene.index.MergeRateLimiter

-     public class MergeRateLimiter
      extends RateLimiter

  This is the `RateLimiter` that `IndexWriter` assigns to each running merge, to give `MergeScheduler`s ionice like control.
  NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.lucene.store.RateLimiter

      `RateLimiter.SimpleRateLimiter`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MergeRateLimiter(MergePolicy.OneMergeProgress mergeProgress)` Sole constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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` | `setMBPerSec(double mbPerSec)` Sets an updated MB per second rate limit.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MergeRateLimiter

          public MergeRateLimiter(MergePolicy.OneMergeProgress mergeProgress)

      Sole constructor.

  - ### Method Detail

    - #### setMBPerSec

          public void setMBPerSec(double mbPerSec)

      Description copied from class: `RateLimiter`
      Sets an updated MB per second rate limit. A subclass is allowed to perform dynamic updates of the rate limit during use.
      Specified by:
        `setMBPerSec` in class `RateLimiter`

    - #### getMBPerSec

          public double getMBPerSec()

      Description copied from class: `RateLimiter`
      The current MB per second rate limit.
      Specified by:
        `getMBPerSec` in class `RateLimiter`

    - #### getTotalBytesWritten

          public long getTotalBytesWritten()

      Returns total bytes written by this merge.

    - #### pause

          public long pause(long bytes)
                     throws MergePolicy.MergeAbortedException

      Description copied from class: `RateLimiter`
      Pauses, if necessary, to keep the instantaneous IO rate at or below the target.

      Note: the implementation is thread-safe

      Specified by:
        `pause` in class `RateLimiter`
      Returns:
        the pause time in nano seconds
      Throws:
        `MergePolicy.MergeAbortedException`

    - #### getTotalStoppedNS

          public long getTotalStoppedNS()

      Total NS merge was stopped.

    - #### getTotalPausedNS

          public long getTotalPausedNS()

      Total NS merge was paused to rate limit IO.

    - #### getMinPauseCheckBytes

          public long getMinPauseCheckBytes()

      Description copied from class: `RateLimiter`
      How many bytes caller should add up itself before invoking `RateLimiter.pause(long)`. NOTE: The value returned by this method may change over time and is not guaranteed to be constant throughout the lifetime of the RateLimiter. Users are advised to refresh their local values with calls to this method to ensure consistency.
      Specified by:
        `getMinPauseCheckBytes` in class `RateLimiter`

Copyright © 2000-2022 Apache Software Foundation. All Rights Reserved.