Add `cache` thread pool to handle cache loading of async caches (bloom filter), closes #1777.
This commit is contained in:
parent
c08b968246
commit
b83378f4ce
|
@ -144,7 +144,7 @@ public class SimpleBloomCache extends AbstractIndexComponent implements BloomCac
|
||||||
filter.loading.set(true);
|
filter.loading.set(true);
|
||||||
BloomFilterLoader loader = new BloomFilterLoader(reader, fieldName);
|
BloomFilterLoader loader = new BloomFilterLoader(reader, fieldName);
|
||||||
if (asyncLoad) {
|
if (asyncLoad) {
|
||||||
threadPool.generic().execute(loader);
|
threadPool.executor(ThreadPool.Names.CACHE).execute(loader);
|
||||||
} else {
|
} else {
|
||||||
loader.run();
|
loader.run();
|
||||||
filter = fieldCache.get(fieldName);
|
filter = fieldCache.get(fieldName);
|
||||||
|
@ -159,7 +159,7 @@ public class SimpleBloomCache extends AbstractIndexComponent implements BloomCac
|
||||||
// do the async loading
|
// do the async loading
|
||||||
BloomFilterLoader loader = new BloomFilterLoader(reader, fieldName);
|
BloomFilterLoader loader = new BloomFilterLoader(reader, fieldName);
|
||||||
if (asyncLoad) {
|
if (asyncLoad) {
|
||||||
threadPool.generic().execute(loader);
|
threadPool.executor(ThreadPool.Names.CACHE).execute(loader);
|
||||||
} else {
|
} else {
|
||||||
loader.run();
|
loader.run();
|
||||||
filter = fieldCache.get(fieldName);
|
filter = fieldCache.get(fieldName);
|
||||||
|
|
|
@ -66,6 +66,7 @@ public class ThreadPool extends AbstractComponent {
|
||||||
public static final String MANAGEMENT = "management";
|
public static final String MANAGEMENT = "management";
|
||||||
public static final String FLUSH = "flush";
|
public static final String FLUSH = "flush";
|
||||||
public static final String MERGE = "merge";
|
public static final String MERGE = "merge";
|
||||||
|
public static final String CACHE = "cache";
|
||||||
public static final String REFRESH = "refresh";
|
public static final String REFRESH = "refresh";
|
||||||
public static final String SNAPSHOT = "snapshot";
|
public static final String SNAPSHOT = "snapshot";
|
||||||
}
|
}
|
||||||
|
@ -96,6 +97,7 @@ public class ThreadPool extends AbstractComponent {
|
||||||
executors.put(Names.FLUSH, build(Names.FLUSH, "scaling", groupSettings.get(Names.FLUSH), settingsBuilder().put("keep_alive", "5m").put("size", 10).build()));
|
executors.put(Names.FLUSH, build(Names.FLUSH, "scaling", groupSettings.get(Names.FLUSH), settingsBuilder().put("keep_alive", "5m").put("size", 10).build()));
|
||||||
executors.put(Names.MERGE, build(Names.MERGE, "scaling", groupSettings.get(Names.MERGE), settingsBuilder().put("keep_alive", "5m").put("size", 20).build()));
|
executors.put(Names.MERGE, build(Names.MERGE, "scaling", groupSettings.get(Names.MERGE), settingsBuilder().put("keep_alive", "5m").put("size", 20).build()));
|
||||||
executors.put(Names.REFRESH, build(Names.REFRESH, "cached", groupSettings.get(Names.REFRESH), settingsBuilder().put("keep_alive", "1m").build()));
|
executors.put(Names.REFRESH, build(Names.REFRESH, "cached", groupSettings.get(Names.REFRESH), settingsBuilder().put("keep_alive", "1m").build()));
|
||||||
|
executors.put(Names.CACHE, build(Names.CACHE, "scaling", groupSettings.get(Names.CACHE), settingsBuilder().put("keep_alive", "5m").put("size", 4).build()));
|
||||||
executors.put(Names.SNAPSHOT, build(Names.SNAPSHOT, "scaling", groupSettings.get(Names.SNAPSHOT), settingsBuilder().put("keep_alive", "5m").put("size", 5).build()));
|
executors.put(Names.SNAPSHOT, build(Names.SNAPSHOT, "scaling", groupSettings.get(Names.SNAPSHOT), settingsBuilder().put("keep_alive", "5m").put("size", 5).build()));
|
||||||
executors.put(Names.SAME, new ExecutorHolder(MoreExecutors.sameThreadExecutor(), new Info(Names.SAME, "same")));
|
executors.put(Names.SAME, new ExecutorHolder(MoreExecutors.sameThreadExecutor(), new Info(Names.SAME, "same")));
|
||||||
this.executors = ImmutableMap.copyOf(executors);
|
this.executors = ImmutableMap.copyOf(executors);
|
||||||
|
|
Loading…
Reference in New Issue