Skip to content

Commit

Permalink
Optimizing inactive (indexing wise) shard to only happen when there a…
Browse files Browse the repository at this point in the history
…re no ongoing merges, closes elastic#1336.
  • Loading branch information
kimchy committed Sep 15, 2011
1 parent 4be11c1 commit e3691af
Showing 1 changed file with 5 additions and 4 deletions.
Expand Up @@ -141,7 +141,8 @@ class ShardsIndicesStatusChecker implements Runnable {
}
// inactive?
if (!status.inactive) {
if ((time - status.time) > inactiveTime.millis()) {
// mark it as inactive only if enough time has passed and there are no ongoing merges going on...
if ((time - status.time) > inactiveTime.millis() && ((InternalIndexShard) indexShard).mergeScheduler().stats().current() == 0) {
try {
((InternalIndexShard) indexShard).engine().updateIndexingBufferSize(Engine.INACTIVE_SHARD_INDEXING_BUFFER);
} catch (EngineClosedException e) {
Expand All @@ -154,14 +155,14 @@ class ShardsIndicesStatusChecker implements Runnable {
// inactive for this amount of time, mark it
status.inactive = true;
activeInactiveStatusChanges = true;
logger.debug("marking shard [{}][{}] as inactive (inactive_time[{}]), setting size to [{}]", indexShard.shardId().index().name(), indexShard.shardId().id(), inactiveTime, Engine.INACTIVE_SHARD_INDEXING_BUFFER);
logger.debug("marking shard [{}][{}] as inactive (inactive_time[{}]) indexing wise, setting size to [{}]", indexShard.shardId().index().name(), indexShard.shardId().id(), inactiveTime, Engine.INACTIVE_SHARD_INDEXING_BUFFER);
}
}
} else {
if (status.inactive) {
status.inactive = false;
activeInactiveStatusChanges = true;
logger.debug("marking shard [{}][{}] as active", indexShard.shardId().index().name(), indexShard.shardId().id());
logger.debug("marking shard [{}][{}] as active indexing wise", indexShard.shardId().index().name(), indexShard.shardId().id());
}
status.time = -1;
}
Expand All @@ -170,7 +171,7 @@ class ShardsIndicesStatusChecker implements Runnable {
}
}
if (activeInactiveStatusChanges) {
calcAndSetShardIndexingBuffer("shards became active/inactive");
calcAndSetShardIndexingBuffer("shards became active/inactive (indexing wise)");
}
}
}
Expand Down

0 comments on commit e3691af

Please sign in to comment.