even if engineUnsafe() is null we still must update the EngineConfig
This commit is contained in:
parent
c43ede5416
commit
9148382be0
|
@ -115,9 +115,6 @@ import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class IndexShard extends AbstractIndexShardComponent {
|
public class IndexShard extends AbstractIndexShardComponent {
|
||||||
|
|
||||||
private final ThreadPool threadPool;
|
private final ThreadPool threadPool;
|
||||||
|
@ -985,17 +982,18 @@ public class IndexShard extends AbstractIndexShardComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateBufferSize(ByteSizeValue shardIndexingBufferSize, ByteSizeValue shardTranslogBufferSize) {
|
public void updateBufferSize(ByteSizeValue shardIndexingBufferSize, ByteSizeValue shardTranslogBufferSize) {
|
||||||
Engine engine = engineUnsafe();
|
|
||||||
if (engine == null) {
|
|
||||||
logger.debug("updateBufferSize: engine is closed; skipping");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final EngineConfig config = engineConfig;
|
final EngineConfig config = engineConfig;
|
||||||
final ByteSizeValue preValue = config.getIndexingBufferSize();
|
final ByteSizeValue preValue = config.getIndexingBufferSize();
|
||||||
|
|
||||||
config.setIndexingBufferSize(shardIndexingBufferSize);
|
config.setIndexingBufferSize(shardIndexingBufferSize);
|
||||||
|
|
||||||
|
Engine engine = engineUnsafe();
|
||||||
|
if (engine == null) {
|
||||||
|
logger.debug("updateBufferSize: engine is closed; skipping");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// update engine if it is already started.
|
// update engine if it is already started.
|
||||||
if (preValue.bytes() != shardIndexingBufferSize.bytes()) {
|
if (preValue.bytes() != shardIndexingBufferSize.bytes()) {
|
||||||
if (shardIndexingBufferSize == EngineConfig.INACTIVE_SHARD_INDEXING_BUFFER) {
|
if (shardIndexingBufferSize == EngineConfig.INACTIVE_SHARD_INDEXING_BUFFER) {
|
||||||
|
@ -1278,6 +1276,8 @@ public class IndexShard extends AbstractIndexShardComponent {
|
||||||
return engine;
|
return engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** NOTE: returns null if engine is not yet started (e.g. recovery phase 1, copying over index files, is still running), or if engine is
|
||||||
|
* closed. */
|
||||||
protected Engine engineUnsafe() {
|
protected Engine engineUnsafe() {
|
||||||
return this.currentEngineReference.get();
|
return this.currentEngineReference.get();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue