From 682ad7e2fc69ff2377de11bdd930b39bce1bada2 Mon Sep 17 00:00:00 2001 From: kimchy Date: Thu, 3 Mar 2011 23:53:28 +0200 Subject: [PATCH] Indices Status / Node Stats: Add (Lucene) index merge stats, closes #745. --- .../TrackingConcurrentMergeScheduler.java | 62 ++++++++++ .../index/TrackingSerialMergeScheduler.java | 71 ++++++++++++ .../indices/status/IndexShardStatus.java | 19 ++++ .../admin/indices/status/IndexStatus.java | 19 ++++ .../admin/indices/status/ShardStatus.java | 28 +++++ .../status/TransportIndicesStatusAction.java | 2 + .../elasticsearch/index/merge/MergeStats.java | 107 ++++++++++++++++++ .../ConcurrentMergeSchedulerProvider.java | 29 ++++- .../scheduler/MergeSchedulerProvider.java | 3 + .../SerialMergeSchedulerProvider.java | 32 +++++- .../shard/service/InternalIndexShard.java | 10 +- .../indices/InternalIndicesService.java | 5 +- .../indices/NodeIndicesStats.java | 29 ++++- .../status/RestIndicesStatusAction.java | 21 ++++ 14 files changed, 428 insertions(+), 9 deletions(-) create mode 100644 modules/elasticsearch/src/main/java/org/apache/lucene/index/TrackingConcurrentMergeScheduler.java create mode 100644 modules/elasticsearch/src/main/java/org/apache/lucene/index/TrackingSerialMergeScheduler.java create mode 100644 modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/MergeStats.java diff --git a/modules/elasticsearch/src/main/java/org/apache/lucene/index/TrackingConcurrentMergeScheduler.java b/modules/elasticsearch/src/main/java/org/apache/lucene/index/TrackingConcurrentMergeScheduler.java new file mode 100644 index 00000000000..aa6b2713aeb --- /dev/null +++ b/modules/elasticsearch/src/main/java/org/apache/lucene/index/TrackingConcurrentMergeScheduler.java @@ -0,0 +1,62 @@ +/* + * Licensed to Elastic Search and Shay Banon under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. Elastic Search licenses this + * file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.lucene.index; + +import java.io.IOException; +import java.util.concurrent.atomic.AtomicLong; + +/** + * An extension to the {@link ConcurrentMergeScheduler} that provides tracking on merge times, total + * and current merges. + */ +public class TrackingConcurrentMergeScheduler extends ConcurrentMergeScheduler { + + private AtomicLong totalMerges = new AtomicLong(); + private AtomicLong totalMergeTime = new AtomicLong(); + private AtomicLong currentMerges = new AtomicLong(); + + public TrackingConcurrentMergeScheduler() { + super(); + } + + public long totalMerges() { + return totalMerges.get(); + } + + public long totalMergeTime() { + return totalMergeTime.get(); + } + + public long currentMerges() { + return currentMerges.get(); + } + + @Override protected void doMerge(MergePolicy.OneMerge merge) throws IOException { + long time = System.currentTimeMillis(); + currentMerges.incrementAndGet(); + try { + super.doMerge(merge); + } finally { + currentMerges.decrementAndGet(); + totalMerges.incrementAndGet(); + totalMergeTime.addAndGet(System.currentTimeMillis() - time); + } + } +} \ No newline at end of file diff --git a/modules/elasticsearch/src/main/java/org/apache/lucene/index/TrackingSerialMergeScheduler.java b/modules/elasticsearch/src/main/java/org/apache/lucene/index/TrackingSerialMergeScheduler.java new file mode 100644 index 00000000000..1bee6b6b8d4 --- /dev/null +++ b/modules/elasticsearch/src/main/java/org/apache/lucene/index/TrackingSerialMergeScheduler.java @@ -0,0 +1,71 @@ +/* + * Licensed to Elastic Search and Shay Banon under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. Elastic Search licenses this + * file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.lucene.index; + +import java.io.IOException; +import java.util.concurrent.atomic.AtomicLong; + +// LUCENE MONITOR - Copied from SerialMergeScheduler +public class TrackingSerialMergeScheduler extends MergeScheduler { + + private AtomicLong totalMerges = new AtomicLong(); + private AtomicLong totalMergeTime = new AtomicLong(); + private AtomicLong currentMerges = new AtomicLong(); + + public long totalMerges() { + return totalMerges.get(); + } + + public long totalMergeTime() { + return totalMergeTime.get(); + } + + public long currentMerges() { + return currentMerges.get(); + } + + /** + * Just do the merges in sequence. We do this + * "synchronized" so that even if the application is using + * multiple threads, only one merge may run at a time. + */ + @Override + synchronized public void merge(IndexWriter writer) throws CorruptIndexException, IOException { + while (true) { + MergePolicy.OneMerge merge = writer.getNextMerge(); + if (merge == null) + break; + + long time = System.currentTimeMillis(); + currentMerges.incrementAndGet(); + try { + writer.merge(merge); + } finally { + currentMerges.decrementAndGet(); + totalMerges.incrementAndGet(); + totalMergeTime.addAndGet(System.currentTimeMillis() - time); + } + } + } + + @Override + public void close() { + } +} \ No newline at end of file diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/IndexShardStatus.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/IndexShardStatus.java index 67efcdd7d3c..ec041534cdb 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/IndexShardStatus.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/IndexShardStatus.java @@ -21,6 +21,7 @@ package org.elasticsearch.action.admin.indices.status; import org.elasticsearch.common.collect.Iterators; import org.elasticsearch.common.unit.ByteSizeValue; +import org.elasticsearch.index.merge.MergeStats; import org.elasticsearch.index.shard.ShardId; import java.util.Iterator; @@ -162,6 +163,24 @@ public class IndexShardStatus implements Iterable { return docs(); } + /** + * Total merges of this shard replication group. + */ + public MergeStats mergeStats() { + MergeStats mergeStats = new MergeStats(); + for (ShardStatus shard : shards) { + mergeStats.add(shard.mergeStats()); + } + return mergeStats; + } + + /** + * Total merges of this shard replication group. + */ + public MergeStats getMergeStats() { + return this.mergeStats(); + } + @Override public Iterator iterator() { return Iterators.forArray(shards); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/IndexStatus.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/IndexStatus.java index 39e9b730f5a..4ed5504c189 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/IndexStatus.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/IndexStatus.java @@ -22,6 +22,7 @@ package org.elasticsearch.action.admin.indices.status; import org.elasticsearch.common.collect.Maps; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeValue; +import org.elasticsearch.index.merge.MergeStats; import java.util.Iterator; import java.util.List; @@ -182,6 +183,24 @@ public class IndexStatus implements Iterable { return docs(); } + /** + * Total merges of this index. + */ + public MergeStats mergeStats() { + MergeStats mergeStats = new MergeStats(); + for (IndexShardStatus shard : this) { + mergeStats.add(shard.mergeStats()); + } + return mergeStats; + } + + /** + * Total merges of this index. + */ + public MergeStats getMergeStats() { + return this.mergeStats(); + } + @Override public Iterator iterator() { return indexShards.values().iterator(); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/ShardStatus.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/ShardStatus.java index 21be6f876a5..996194469c4 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/ShardStatus.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/ShardStatus.java @@ -24,6 +24,7 @@ import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.unit.ByteSizeValue; +import org.elasticsearch.index.merge.MergeStats; import org.elasticsearch.index.shard.IndexShardState; import java.io.IOException; @@ -50,6 +51,8 @@ public class ShardStatus extends BroadcastShardOperationResponse { DocsStatus docs; + MergeStats mergeStats; + PeerRecoveryStatus peerRecoveryStatus; GatewayRecoveryStatus gatewayRecoveryStatus; @@ -148,6 +151,20 @@ public class ShardStatus extends BroadcastShardOperationResponse { return docs(); } + /** + * Index merge statistics. + */ + public MergeStats mergeStats() { + return this.mergeStats; + } + + /** + * Index merge statistics. + */ + public MergeStats getMergeStats() { + return this.mergeStats; + } + /** * Peer recovery status (null if not applicable). Both real time if an on going recovery * is in progress and summary once it is done. @@ -256,6 +273,13 @@ public class ShardStatus extends BroadcastShardOperationResponse { out.writeVLong(gatewaySnapshotStatus.indexSize); out.writeVInt(gatewaySnapshotStatus.expectedNumberOfOperations()); } + + if (mergeStats == null) { + out.writeBoolean(false); + } else { + out.writeBoolean(true); + mergeStats.writeTo(out); + } } @Override public void readFrom(StreamInput in) throws IOException { @@ -287,5 +311,9 @@ public class ShardStatus extends BroadcastShardOperationResponse { gatewaySnapshotStatus = new GatewaySnapshotStatus(GatewaySnapshotStatus.Stage.fromValue(in.readByte()), in.readVLong(), in.readVLong(), in.readVLong(), in.readVInt()); } + + if (in.readBoolean()) { + mergeStats = MergeStats.readMergeStats(in); + } } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/TransportIndicesStatusAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/TransportIndicesStatusAction.java index 80309db3b6d..408412647af 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/TransportIndicesStatusAction.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/TransportIndicesStatusAction.java @@ -166,6 +166,8 @@ public class TransportIndicesStatusAction extends TransportBroadcastOperationAct } finally { searcher.release(); } + + shardStatus.mergeStats = indexShard.mergeScheduler().stats(); } // check on going recovery (from peer or gateway) RecoveryStatus peerRecoveryStatus = indexShard.peerRecoveryStatus(); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/MergeStats.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/MergeStats.java new file mode 100644 index 00000000000..6c20ca794d8 --- /dev/null +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/MergeStats.java @@ -0,0 +1,107 @@ +/* + * Licensed to Elastic Search and Shay Banon under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. Elastic Search licenses this + * file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.elasticsearch.index.merge; + +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.io.stream.Streamable; +import org.elasticsearch.common.unit.TimeValue; + +import java.io.IOException; + +/** + * + */ +public class MergeStats implements Streamable { + + private long totalMerges; + + private long currentMerges; + + private long totalMergeTime; + + public MergeStats() { + + } + + public MergeStats(long totalMerges, long currentMerges, long totalMergeTime) { + this.totalMerges = totalMerges; + this.currentMerges = currentMerges; + this.totalMergeTime = totalMergeTime; + } + + public void add(long totalMerges, long currentMerges, long totalMergeTime) { + this.totalMerges += totalMerges; + this.currentMerges += currentMerges; + this.totalMergeTime += totalMergeTime; + } + + public void add(MergeStats mergeStats) { + this.totalMerges += mergeStats.totalMerges; + this.currentMerges += mergeStats.currentMerges; + this.totalMergeTime += mergeStats.totalMergeTime; + } + + /** + * The total number of merges executed. + */ + public long totalMerges() { + return this.totalMerges; + } + + /** + * The current number of merges executing. + */ + public long currentMerges() { + return this.currentMerges; + } + + /** + * The total time merges have been executed (in milliseconds). + */ + public long totalMergeTimeInMillis() { + return this.totalMergeTime; + } + + /** + * The total time merges have been executed. + */ + public TimeValue totalMergeTime() { + return new TimeValue(totalMergeTime); + } + + public static MergeStats readMergeStats(StreamInput in) throws IOException { + MergeStats stats = new MergeStats(); + stats.readFrom(in); + return stats; + } + + @Override public void readFrom(StreamInput in) throws IOException { + totalMerges = in.readVLong(); + currentMerges = in.readVLong(); + totalMergeTime = in.readVLong(); + } + + @Override public void writeTo(StreamOutput out) throws IOException { + out.writeVLong(totalMerges); + out.writeVLong(currentMerges); + out.writeVLong(totalMergeTime); + } +} \ No newline at end of file diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/scheduler/ConcurrentMergeSchedulerProvider.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/scheduler/ConcurrentMergeSchedulerProvider.java index f5513314b03..8e7064a01a1 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/scheduler/ConcurrentMergeSchedulerProvider.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/scheduler/ConcurrentMergeSchedulerProvider.java @@ -23,12 +23,15 @@ import org.apache.lucene.index.*; import org.apache.lucene.store.AlreadyClosedException; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.index.merge.MergeStats; import org.elasticsearch.index.merge.policy.EnableMergePolicy; import org.elasticsearch.index.settings.IndexSettings; import org.elasticsearch.index.shard.AbstractIndexShardComponent; import org.elasticsearch.index.shard.ShardId; import java.io.IOException; +import java.util.Set; +import java.util.concurrent.CopyOnWriteArraySet; /** * @author kimchy (shay.banon) @@ -37,6 +40,8 @@ public class ConcurrentMergeSchedulerProvider extends AbstractIndexShardComponen private final int maxThreadCount; + private Set schedulers = new CopyOnWriteArraySet(); + @Inject public ConcurrentMergeSchedulerProvider(ShardId shardId, @IndexSettings Settings indexSettings) { super(shardId, indexSettings); @@ -46,17 +51,30 @@ public class ConcurrentMergeSchedulerProvider extends AbstractIndexShardComponen } @Override public MergeScheduler newMergeScheduler() { - ConcurrentMergeScheduler concurrentMergeScheduler = new CustomConcurrentMergeScheduler(shardId); + CustomConcurrentMergeScheduler concurrentMergeScheduler = new CustomConcurrentMergeScheduler(shardId, this); concurrentMergeScheduler.setMaxThreadCount(maxThreadCount); + schedulers.add(concurrentMergeScheduler); return concurrentMergeScheduler; } - private static class CustomConcurrentMergeScheduler extends ConcurrentMergeScheduler { + @Override public MergeStats stats() { + MergeStats mergeStats = new MergeStats(); + for (CustomConcurrentMergeScheduler scheduler : schedulers) { + mergeStats.add(scheduler.totalMerges(), scheduler.currentMerges(), scheduler.totalMergeTime()); + } + return mergeStats; + } + + public static class CustomConcurrentMergeScheduler extends TrackingConcurrentMergeScheduler { private final ShardId shardId; - private CustomConcurrentMergeScheduler(ShardId shardId) { + private final ConcurrentMergeSchedulerProvider provider; + + private CustomConcurrentMergeScheduler(ShardId shardId, ConcurrentMergeSchedulerProvider provider) { + super(); this.shardId = shardId; + this.provider = provider; } @Override public void merge(IndexWriter writer) throws CorruptIndexException, IOException { @@ -81,5 +99,10 @@ public class ConcurrentMergeSchedulerProvider extends AbstractIndexShardComponen thread.setName("[" + shardId.index().name() + "][" + shardId.id() + "]: " + thread.getName()); return thread; } + + @Override public void close() { + super.close(); + provider.schedulers.remove(this); + } } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/scheduler/MergeSchedulerProvider.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/scheduler/MergeSchedulerProvider.java index d07e6f21d47..3755444166a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/scheduler/MergeSchedulerProvider.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/scheduler/MergeSchedulerProvider.java @@ -20,6 +20,7 @@ package org.elasticsearch.index.merge.scheduler; import org.apache.lucene.index.MergeScheduler; +import org.elasticsearch.index.merge.MergeStats; import org.elasticsearch.index.shard.IndexShardComponent; /** @@ -28,4 +29,6 @@ import org.elasticsearch.index.shard.IndexShardComponent; public interface MergeSchedulerProvider extends IndexShardComponent { T newMergeScheduler(); + + MergeStats stats(); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/scheduler/SerialMergeSchedulerProvider.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/scheduler/SerialMergeSchedulerProvider.java index b561c0525fa..f690486500f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/scheduler/SerialMergeSchedulerProvider.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/merge/scheduler/SerialMergeSchedulerProvider.java @@ -22,32 +22,53 @@ package org.elasticsearch.index.merge.scheduler; import org.apache.lucene.index.CorruptIndexException; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.MergeScheduler; -import org.apache.lucene.index.SerialMergeScheduler; +import org.apache.lucene.index.TrackingSerialMergeScheduler; import org.apache.lucene.store.AlreadyClosedException; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.index.merge.MergeStats; import org.elasticsearch.index.merge.policy.EnableMergePolicy; import org.elasticsearch.index.settings.IndexSettings; import org.elasticsearch.index.shard.AbstractIndexShardComponent; import org.elasticsearch.index.shard.ShardId; import java.io.IOException; +import java.util.Set; +import java.util.concurrent.CopyOnWriteArraySet; /** * @author kimchy (shay.banon) */ public class SerialMergeSchedulerProvider extends AbstractIndexShardComponent implements MergeSchedulerProvider { + private Set schedulers = new CopyOnWriteArraySet(); + @Inject public SerialMergeSchedulerProvider(ShardId shardId, @IndexSettings Settings indexSettings) { super(shardId, indexSettings); logger.trace("using [serial] merge scheduler"); } @Override public MergeScheduler newMergeScheduler() { - return new CustomSerialMergeScheduler(); + CustomSerialMergeScheduler scheduler = new CustomSerialMergeScheduler(this); + schedulers.add(scheduler); + return scheduler; } - public static class CustomSerialMergeScheduler extends SerialMergeScheduler { + @Override public MergeStats stats() { + MergeStats mergeStats = new MergeStats(); + for (CustomSerialMergeScheduler scheduler : schedulers) { + mergeStats.add(scheduler.totalMerges(), scheduler.currentMerges(), scheduler.totalMergeTime()); + } + return mergeStats; + } + + public static class CustomSerialMergeScheduler extends TrackingSerialMergeScheduler { + + private final SerialMergeSchedulerProvider provider; + + public CustomSerialMergeScheduler(SerialMergeSchedulerProvider provider) { + this.provider = provider; + } @Override public void merge(IndexWriter writer) throws CorruptIndexException, IOException { try { @@ -65,5 +86,10 @@ public class SerialMergeSchedulerProvider extends AbstractIndexShardComponent im } super.merge(writer); } + + @Override public void close() { + super.close(); + provider.schedulers.remove(this); + } } } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java index 51c38a407e9..46d61f3395a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java @@ -41,6 +41,7 @@ import org.elasticsearch.common.util.concurrent.ThreadSafe; import org.elasticsearch.index.cache.IndexCache; import org.elasticsearch.index.engine.*; import org.elasticsearch.index.mapper.*; +import org.elasticsearch.index.merge.scheduler.MergeSchedulerProvider; import org.elasticsearch.index.query.IndexQueryParser; import org.elasticsearch.index.query.IndexQueryParserMissingException; import org.elasticsearch.index.query.IndexQueryParserService; @@ -79,6 +80,8 @@ public class InternalIndexShard extends AbstractIndexShardComponent implements I private final Store store; + private final MergeSchedulerProvider mergeScheduler; + private final Engine engine; private final Translog translog; @@ -103,12 +106,13 @@ public class InternalIndexShard extends AbstractIndexShardComponent implements I private CopyOnWriteArrayList listeners = null; - @Inject public InternalIndexShard(ShardId shardId, @IndexSettings Settings indexSettings, IndicesLifecycle indicesLifecycle, Store store, Engine engine, Translog translog, + @Inject public InternalIndexShard(ShardId shardId, @IndexSettings Settings indexSettings, IndicesLifecycle indicesLifecycle, Store store, Engine engine, MergeSchedulerProvider mergeScheduler, Translog translog, ThreadPool threadPool, MapperService mapperService, IndexQueryParserService queryParserService, IndexCache indexCache) { super(shardId, indexSettings); this.indicesLifecycle = (InternalIndicesLifecycle) indicesLifecycle; this.store = store; this.engine = engine; + this.mergeScheduler = mergeScheduler; this.translog = translog; this.threadPool = threadPool; this.mapperService = mapperService; @@ -145,6 +149,10 @@ public class InternalIndexShard extends AbstractIndexShardComponent implements I } } + public MergeSchedulerProvider mergeScheduler() { + return this.mergeScheduler; + } + public Store store() { return this.store; } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/InternalIndicesService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/InternalIndicesService.java index d7719116a11..f5823a21c4a 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/InternalIndicesService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/InternalIndicesService.java @@ -49,6 +49,7 @@ import org.elasticsearch.index.engine.IndexEngineModule; import org.elasticsearch.index.gateway.IndexGateway; import org.elasticsearch.index.gateway.IndexGatewayModule; import org.elasticsearch.index.mapper.MapperServiceModule; +import org.elasticsearch.index.merge.MergeStats; import org.elasticsearch.index.percolator.PercolatorModule; import org.elasticsearch.index.percolator.PercolatorService; import org.elasticsearch.index.query.IndexQueryParserModule; @@ -165,6 +166,7 @@ public class InternalIndicesService extends AbstractLifecycleComponent