Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.14] Adjust SearchableSnapshotsBlobStoreCacheIntegTests.testBlobStoreCache #77848

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,24 +114,24 @@ protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
return Settings.builder().put(super.nodeSettings(nodeOrdinal, otherSettings)).put(cacheSettings).build();
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/77753")
public void testBlobStoreCache() throws Exception {
final String indexName = randomAlphaOfLength(10).toLowerCase(Locale.ROOT);
final boolean useSoftDeletes = randomBoolean();
createIndex(indexName, Settings.builder().put(INDEX_SOFT_DELETES_SETTING.getKey(), useSoftDeletes).build());

final NumShards numberOfShards = getNumShards(indexName);

final int numberOfDocs = scaledRandomIntBetween(0, 20_000);
if (numberOfDocs > 0) {
final List<IndexRequestBuilder> indexRequestBuilders = new ArrayList<>();
for (int i = numberOfDocs; i > 0; i--) {
XContentBuilder builder = XContentFactory.smileBuilder();
builder.startObject().field("text", randomRealisticUnicodeOfCodepointLengthBetween(5, 50)).field("num", i).endObject();
indexRequestBuilders.add(client().prepareIndex(indexName, SINGLE_MAPPING_NAME).setSource(builder));
}
indexRandom(true, true, true, indexRequestBuilders);
final int numberOfDocs = scaledRandomIntBetween(10, 20_000);
logger.info("--> indexing [{}] documents in [{}]", numberOfDocs, indexName);

final List<IndexRequestBuilder> indexRequestBuilders = new ArrayList<>();
for (int i = numberOfDocs; i > 0; i--) {
XContentBuilder builder = XContentFactory.smileBuilder();
builder.startObject().field("text", randomRealisticUnicodeOfCodepointLengthBetween(5, 50)).field("num", i).endObject();
indexRequestBuilders.add(client().prepareIndex(indexName, SINGLE_MAPPING_NAME).setSource(builder));
}
indexRandom(true, true, true, indexRequestBuilders);

if (randomBoolean()) {
logger.info("--> force-merging index before snapshotting");
final ForceMergeResponse forceMergeResponse = client().admin()
Expand Down Expand Up @@ -200,20 +200,18 @@ public void testBlobStoreCache() throws Exception {
}

logger.info("--> verifying cached documents in system index [{}]", SNAPSHOT_BLOB_CACHE_INDEX);
if (numberOfDocs > 0) {
ensureYellow(SNAPSHOT_BLOB_CACHE_INDEX);
refreshSystemIndex();
ensureYellow(SNAPSHOT_BLOB_CACHE_INDEX);
refreshSystemIndex();

logger.info("--> verifying system index [{}] data tiers preference", SNAPSHOT_BLOB_CACHE_INDEX);
assertThat(
systemClient().admin()
.indices()
.prepareGetSettings(SNAPSHOT_BLOB_CACHE_INDEX)
.get()
.getSetting(SNAPSHOT_BLOB_CACHE_INDEX, DataTierAllocationDecider.INDEX_ROUTING_PREFER),
equalTo("data_content,data_hot")
);
}
logger.info("--> verifying system index [{}] data tiers preference", SNAPSHOT_BLOB_CACHE_INDEX);
assertThat(
systemClient().admin()
.indices()
.prepareGetSettings(SNAPSHOT_BLOB_CACHE_INDEX)
.get()
.getSetting(SNAPSHOT_BLOB_CACHE_INDEX, DataTierAllocationDecider.INDEX_ROUTING_PREFER),
equalTo("data_content,data_hot")
);

final long numberOfCachedBlobs = systemClient().prepareSearch(SNAPSHOT_BLOB_CACHE_INDEX)
.setIndicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN)
Expand Down Expand Up @@ -267,9 +265,7 @@ public void testBlobStoreCache() throws Exception {
assertHitCount(client().prepareSearch(restoredAgainIndex).setSize(0).setTrackTotalHits(true).get(), numberOfDocs);

logger.info("--> verifying that no extra cached blobs were indexed [{}]", SNAPSHOT_BLOB_CACHE_INDEX);
if (numberOfDocs > 0) {
refreshSystemIndex();
}
refreshSystemIndex();
assertHitCount(
systemClient().prepareSearch(SNAPSHOT_BLOB_CACHE_INDEX).setIndicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN).setSize(0).get(),
numberOfCachedBlobs
Expand Down