fold feedback

This commit is contained in:
Michael McCandless 2015-10-06 03:59:37 -04:00 committed by mikemccand
parent 19ab16b9a5
commit c5971272ee
3 changed files with 8 additions and 6 deletions

View File

@ -999,7 +999,8 @@ public class IndexShard extends AbstractIndexShardComponent implements IndexSett
this.failedEngineListener.delegates.add(failedEngineListener); this.failedEngineListener.delegates.add(failedEngineListener);
} }
/** Returns true if the indexing buffer size did change */ /** Change the indexing and translog buffer sizes. If {@code IndexWriter} is currently using more than
* the new buffering indexing size then we do a refresh to free up the heap. */
public void updateBufferSize(ByteSizeValue shardIndexingBufferSize, ByteSizeValue shardTranslogBufferSize) { public void updateBufferSize(ByteSizeValue shardIndexingBufferSize, ByteSizeValue shardTranslogBufferSize) {
final EngineConfig config = engineConfig; final EngineConfig config = engineConfig;
@ -1046,6 +1047,8 @@ public class IndexShard extends AbstractIndexShardComponent implements IndexSett
} }
} }
/** Returns {@code true} if this shard is active (has seen indexing ops in the last {@link
* IndexingMemoryController#SHARD_INACTIVE_TIME_SETTING} (default 5 minutes), else {@code false}. */
public boolean getActive() { public boolean getActive() {
return active.get(); return active.get();
} }

View File

@ -161,7 +161,6 @@ public class IndexingMemoryController extends AbstractLifecycleComponent<Indexin
this.statusChecker = new ShardsIndicesStatusChecker(); this.statusChecker = new ShardsIndicesStatusChecker();
logger.debug("using indexing buffer size [{}], with {} [{}], {} [{}], {} [{}], {} [{}]", logger.debug("using indexing buffer size [{}], with {} [{}], {} [{}], {} [{}], {} [{}]",
this.indexingBuffer, this.indexingBuffer,
MIN_SHARD_INDEX_BUFFER_SIZE_SETTING, this.minShardIndexBufferSize, MIN_SHARD_INDEX_BUFFER_SIZE_SETTING, this.minShardIndexBufferSize,
@ -251,7 +250,7 @@ public class IndexingMemoryController extends AbstractLifecycleComponent<Indexin
} }
} }
protected boolean isShardInactive(ShardId shardId, long inactiveTimeNS) { protected boolean isShardIdle(ShardId shardId, long inactiveTimeNS) {
final IndexShard shard = getShard(shardId); final IndexShard shard = getShard(shardId);
if (shard == null) { if (shard == null) {
return false; return false;
@ -260,7 +259,7 @@ public class IndexingMemoryController extends AbstractLifecycleComponent<Indexin
} }
/** returns the current translog status (generation id + ops) for the given shard id. Returns null if unavailable. */ /** returns {@link IndexShard#getActive} if the shard exists, else null */
protected Boolean getShardActive(ShardId shardId) { protected Boolean getShardActive(ShardId shardId) {
final IndexShard indexShard = getShard(shardId); final IndexShard indexShard = getShard(shardId);
if (indexShard == null) { if (indexShard == null) {
@ -325,7 +324,7 @@ public class IndexingMemoryController extends AbstractLifecycleComponent<Indexin
logger.debug("marking shard {} as active indexing wise", shardId); logger.debug("marking shard {} as active indexing wise", shardId);
shardWasActive.put(shardId, true); shardWasActive.put(shardId, true);
} else if (isShardInactive(shardId, inactiveTime.nanos())) { } else if (isShardIdle(shardId, inactiveTime.nanos())) {
// Make shard inactive now // Make shard inactive now
changes.add(ShardStatusChangeType.BECAME_INACTIVE); changes.add(ShardStatusChangeType.BECAME_INACTIVE);
logger.debug("marking shard {} as inactive (inactive_time[{}]) indexing wise", logger.debug("marking shard {} as inactive (inactive_time[{}]) indexing wise",

View File

@ -109,7 +109,7 @@ public class IndexingMemoryControllerTests extends ESTestCase {
} }
@Override @Override
protected boolean isShardInactive(ShardId shardId, long inactiveTimeNS) { protected boolean isShardIdle(ShardId shardId, long inactiveTimeNS) {
return currentTimeInNanos() - lastIndexTimeNanos.get(shardId) >= inactiveTimeNS; return currentTimeInNanos() - lastIndexTimeNanos.get(shardId) >= inactiveTimeNS;
} }