Fix `InternalEngine#isThrottled` to not always return `false`. (#21592)
Currently it inherits from the default implementation which always returns `false`, even if indexing is being throttled.
This commit is contained in:
parent
6796464f16
commit
d7fa2eb155
|
@ -235,17 +235,13 @@ public abstract class Engine implements Closeable {
|
||||||
/**
|
/**
|
||||||
* Returns the number of milliseconds this engine was under index throttling.
|
* Returns the number of milliseconds this engine was under index throttling.
|
||||||
*/
|
*/
|
||||||
public long getIndexThrottleTimeInMillis() {
|
public abstract long getIndexThrottleTimeInMillis();
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the <code>true</code> iff this engine is currently under index throttling.
|
* Returns the <code>true</code> iff this engine is currently under index throttling.
|
||||||
* @see #getIndexThrottleTimeInMillis()
|
* @see #getIndexThrottleTimeInMillis()
|
||||||
*/
|
*/
|
||||||
public boolean isThrottled() {
|
public abstract boolean isThrottled();
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** A Lock implementation that always allows the lock to be acquired */
|
/** A Lock implementation that always allows the lock to be acquired */
|
||||||
protected static final class NoOpLock implements Lock {
|
protected static final class NoOpLock implements Lock {
|
||||||
|
|
|
@ -1224,6 +1224,12 @@ public class InternalEngine extends Engine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isThrottled() {
|
||||||
|
return throttle.isThrottled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getIndexThrottleTimeInMillis() {
|
public long getIndexThrottleTimeInMillis() {
|
||||||
return throttle.getThrottleTimeInMillis();
|
return throttle.getThrottleTimeInMillis();
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,6 +256,16 @@ public class ShadowEngine extends Engine {
|
||||||
throw new UnsupportedOperationException("ShadowEngine has no IndexWriter");
|
throw new UnsupportedOperationException("ShadowEngine has no IndexWriter");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isThrottled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getIndexThrottleTimeInMillis() {
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Engine recoverFromTranslog() throws IOException {
|
public Engine recoverFromTranslog() throws IOException {
|
||||||
throw new UnsupportedOperationException("can't recover on a shadow engine");
|
throw new UnsupportedOperationException("can't recover on a shadow engine");
|
||||||
|
|
Loading…
Reference in New Issue