Search action now log in debug what shards/nodes were used before moving to second phase

Added  a debug log for executing a refresh request on a shard.
This commit is contained in:
Boaz Leskes 2013-09-02 17:17:53 +02:00
parent 91c3853452
commit a48c437ffb
3 changed files with 14 additions and 1 deletions

View File

@ -113,6 +113,7 @@ public class TransportRefreshAction extends TransportBroadcastOperationAction<Re
protected ShardRefreshResponse shardOperation(ShardRefreshRequest request) throws ElasticSearchException {
IndexShard indexShard = indicesService.indexServiceSafe(request.index()).shardSafe(request.shardId());
indexShard.refresh(new Engine.Refresh().force(request.force()));
logger.debug("Refresh request executed for {}. Force: [{}].", indexShard.shardId(), request.force());
return new ShardRefreshResponse(request.index(), request.shardId());
}

View File

@ -231,6 +231,7 @@ public abstract class TransportSearchTypeAction extends TransportAction<SearchRe
void onFirstPhaseResult(int shardIndex, ShardRouting shard, FirstResult result, ShardIterator shardIt) {
result.shardTarget(new SearchShardTarget(shard.currentNodeId(), shard.index(), shard.id()));
processFirstPhaseResult(shardIndex, shard, result);
// increment all the "future" shards to update the total ops since we some may work and some may not...
// and when that happens, we break on total ops, so we must maintain them
int xTotalOps = totalOps.addAndGet(shardIt.remaining() + 1);
@ -387,6 +388,17 @@ public abstract class TransportSearchTypeAction extends TransportAction<SearchRe
}
final void innerMoveToSecondPhase() throws Exception {
if (logger.isDebugEnabled()) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < firstResults.length(); i++) {
SearchShardTarget shard = firstResults.get(i).shardTarget();
if (i > 0) {
sb.append(",");
}
sb.append(shard);
}
logger.debug("Moving to second phase, based on results from: {}", sb);
}
moveToSecondPhase();
}

View File

@ -386,7 +386,7 @@ public abstract class TransportShardReplicationOperationAction<Request extends S
continue;
}
if (!shard.active() || !clusterState.nodes().nodeExists(shard.currentNodeId())) {
logger.debug("primary shard [{}] is not yet active or we do not know that node it is assigned to [{}]. Scheduling a retry.", shard.shardId(), shard.currentNodeId());
logger.debug("primary shard [{}] is not yet active or we do not know the node it is assigned to [{}]. Scheduling a retry.", shard.shardId(), shard.currentNodeId());
retry(fromClusterEvent, null);
return false;
}