mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-20 03:45:02 +00:00
Enable prewarming by default for searchable snapshots (#56201)
Now searchable snapshots directories respect the repository rate limitations (#55952) we can enable prewarming by default for shards.
This commit is contained in:
parent
b8b4ebd089
commit
07ad742b60
@ -106,7 +106,7 @@ public class SearchableSnapshots extends Plugin implements IndexStorePlugin, Eng
|
|||||||
);
|
);
|
||||||
public static final Setting<Boolean> SNAPSHOT_CACHE_PREWARM_ENABLED_SETTING = Setting.boolSetting(
|
public static final Setting<Boolean> SNAPSHOT_CACHE_PREWARM_ENABLED_SETTING = Setting.boolSetting(
|
||||||
"index.store.snapshot.cache.prewarm.enabled",
|
"index.store.snapshot.cache.prewarm.enabled",
|
||||||
false,
|
true,
|
||||||
Setting.Property.IndexScope
|
Setting.Property.IndexScope
|
||||||
);
|
);
|
||||||
// The file extensions that are excluded from the cache
|
// The file extensions that are excluded from the cache
|
||||||
|
@ -37,6 +37,7 @@ import static org.elasticsearch.index.store.cache.TestUtils.assertCounter;
|
|||||||
import static org.elasticsearch.index.store.cache.TestUtils.createCacheService;
|
import static org.elasticsearch.index.store.cache.TestUtils.createCacheService;
|
||||||
import static org.elasticsearch.index.store.cache.TestUtils.singleBlobContainer;
|
import static org.elasticsearch.index.store.cache.TestUtils.singleBlobContainer;
|
||||||
import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING;
|
import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING;
|
||||||
|
import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_CACHE_PREWARM_ENABLED_SETTING;
|
||||||
import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_UNCACHED_CHUNK_SIZE_SETTING;
|
import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_UNCACHED_CHUNK_SIZE_SETTING;
|
||||||
import static org.hamcrest.Matchers.allOf;
|
import static org.hamcrest.Matchers.allOf;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
@ -520,7 +521,10 @@ public class SearchableSnapshotDirectoryStatsTests extends ESIndexInputTestCase
|
|||||||
private static void executeTestCase(final TriConsumer<String, byte[], SearchableSnapshotDirectory> test) {
|
private static void executeTestCase(final TriConsumer<String, byte[], SearchableSnapshotDirectory> test) {
|
||||||
executeTestCase(
|
executeTestCase(
|
||||||
createCacheService(random()),
|
createCacheService(random()),
|
||||||
Settings.builder().put(SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), randomBoolean()).build(),
|
Settings.builder()
|
||||||
|
.put(SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), randomBoolean())
|
||||||
|
.put(SNAPSHOT_CACHE_PREWARM_ENABLED_SETTING.getKey(), false) // disable prewarming as it impacts the stats
|
||||||
|
.build(),
|
||||||
test
|
test
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -554,7 +558,10 @@ public class SearchableSnapshotDirectoryStatsTests extends ESIndexInputTestCase
|
|||||||
) {
|
) {
|
||||||
executeTestCase(
|
executeTestCase(
|
||||||
new CacheService(cacheSize, cacheRangeSize),
|
new CacheService(cacheSize, cacheRangeSize),
|
||||||
Settings.builder().put(SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), true).build(),
|
Settings.builder()
|
||||||
|
.put(SNAPSHOT_CACHE_ENABLED_SETTING.getKey(), true)
|
||||||
|
.put(SNAPSHOT_CACHE_PREWARM_ENABLED_SETTING.getKey(), false) // disable prewarming as it impacts the stats
|
||||||
|
.build(),
|
||||||
test
|
test
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ public class CachedBlobContainerIndexInputTests extends ESIndexInputTestCase {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final BlobContainer blobContainer = singleBlobContainer(blobName, input);
|
final BlobContainer blobContainer = singleBlobContainer(blobName, input);
|
||||||
|
final ThreadPool threadPool = new TestThreadPool(getTestName(), SearchableSnapshots.executorBuilder());
|
||||||
final Path cacheDir = createTempDir();
|
final Path cacheDir = createTempDir();
|
||||||
try (
|
try (
|
||||||
SearchableSnapshotDirectory searchableSnapshotDirectory = new SearchableSnapshotDirectory(
|
SearchableSnapshotDirectory searchableSnapshotDirectory = new SearchableSnapshotDirectory(
|
||||||
@ -170,7 +170,7 @@ public class CachedBlobContainerIndexInputTests extends ESIndexInputTestCase {
|
|||||||
() -> 0L,
|
() -> 0L,
|
||||||
cacheService,
|
cacheService,
|
||||||
cacheDir,
|
cacheDir,
|
||||||
null
|
threadPool
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
final boolean loaded = searchableSnapshotDirectory.loadSnapshot();
|
final boolean loaded = searchableSnapshotDirectory.loadSnapshot();
|
||||||
@ -185,6 +185,8 @@ public class CachedBlobContainerIndexInputTests extends ESIndexInputTestCase {
|
|||||||
throw new AssertionError("inner EOFException not thrown", exception);
|
throw new AssertionError("inner EOFException not thrown", exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
terminate(threadPool);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user