@@ -114,24 +114,24 @@ protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
114
114
return Settings .builder ().put (super .nodeSettings (nodeOrdinal , otherSettings )).put (cacheSettings ).build ();
115
115
}
116
116
117
- @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/77753" )
118
117
public void testBlobStoreCache () throws Exception {
119
118
final String indexName = randomAlphaOfLength (10 ).toLowerCase (Locale .ROOT );
120
119
final boolean useSoftDeletes = randomBoolean ();
121
120
createIndex (indexName , Settings .builder ().put (INDEX_SOFT_DELETES_SETTING .getKey (), useSoftDeletes ).build ());
122
121
123
122
final NumShards numberOfShards = getNumShards (indexName );
124
123
125
- final int numberOfDocs = scaledRandomIntBetween (0 , 20_000 );
126
- if (numberOfDocs > 0 ) {
127
- final List <IndexRequestBuilder > indexRequestBuilders = new ArrayList <>();
128
- for (int i = numberOfDocs ; i > 0 ; i --) {
129
- XContentBuilder builder = XContentFactory .smileBuilder ();
130
- builder .startObject ().field ("text" , randomRealisticUnicodeOfCodepointLengthBetween (5 , 50 )).field ("num" , i ).endObject ();
131
- indexRequestBuilders .add (client ().prepareIndex (indexName , SINGLE_MAPPING_NAME ).setSource (builder ));
132
- }
133
- indexRandom (true , true , true , indexRequestBuilders );
124
+ final int numberOfDocs = scaledRandomIntBetween (10 , 20_000 );
125
+ logger .info ("--> indexing [{}] documents in [{}]" , numberOfDocs , indexName );
126
+
127
+ final List <IndexRequestBuilder > indexRequestBuilders = new ArrayList <>();
128
+ for (int i = numberOfDocs ; i > 0 ; i --) {
129
+ XContentBuilder builder = XContentFactory .smileBuilder ();
130
+ builder .startObject ().field ("text" , randomRealisticUnicodeOfCodepointLengthBetween (5 , 50 )).field ("num" , i ).endObject ();
131
+ indexRequestBuilders .add (client ().prepareIndex (indexName , SINGLE_MAPPING_NAME ).setSource (builder ));
134
132
}
133
+ indexRandom (true , true , true , indexRequestBuilders );
134
+
135
135
if (randomBoolean ()) {
136
136
logger .info ("--> force-merging index before snapshotting" );
137
137
final ForceMergeResponse forceMergeResponse = client ().admin ()
@@ -200,20 +200,18 @@ public void testBlobStoreCache() throws Exception {
200
200
}
201
201
202
202
logger .info ("--> verifying cached documents in system index [{}]" , SNAPSHOT_BLOB_CACHE_INDEX );
203
- if (numberOfDocs > 0 ) {
204
- ensureYellow (SNAPSHOT_BLOB_CACHE_INDEX );
205
- refreshSystemIndex ();
203
+ ensureYellow (SNAPSHOT_BLOB_CACHE_INDEX );
204
+ refreshSystemIndex ();
206
205
207
- logger .info ("--> verifying system index [{}] data tiers preference" , SNAPSHOT_BLOB_CACHE_INDEX );
208
- assertThat (
209
- systemClient ().admin ()
210
- .indices ()
211
- .prepareGetSettings (SNAPSHOT_BLOB_CACHE_INDEX )
212
- .get ()
213
- .getSetting (SNAPSHOT_BLOB_CACHE_INDEX , DataTierAllocationDecider .INDEX_ROUTING_PREFER ),
214
- equalTo ("data_content,data_hot" )
215
- );
216
- }
206
+ logger .info ("--> verifying system index [{}] data tiers preference" , SNAPSHOT_BLOB_CACHE_INDEX );
207
+ assertThat (
208
+ systemClient ().admin ()
209
+ .indices ()
210
+ .prepareGetSettings (SNAPSHOT_BLOB_CACHE_INDEX )
211
+ .get ()
212
+ .getSetting (SNAPSHOT_BLOB_CACHE_INDEX , DataTierAllocationDecider .INDEX_ROUTING_PREFER ),
213
+ equalTo ("data_content,data_hot" )
214
+ );
217
215
218
216
final long numberOfCachedBlobs = systemClient ().prepareSearch (SNAPSHOT_BLOB_CACHE_INDEX )
219
217
.setIndicesOptions (IndicesOptions .LENIENT_EXPAND_OPEN )
@@ -267,9 +265,7 @@ public void testBlobStoreCache() throws Exception {
267
265
assertHitCount (client ().prepareSearch (restoredAgainIndex ).setSize (0 ).setTrackTotalHits (true ).get (), numberOfDocs );
268
266
269
267
logger .info ("--> verifying that no extra cached blobs were indexed [{}]" , SNAPSHOT_BLOB_CACHE_INDEX );
270
- if (numberOfDocs > 0 ) {
271
- refreshSystemIndex ();
272
- }
268
+ refreshSystemIndex ();
273
269
assertHitCount (
274
270
systemClient ().prepareSearch (SNAPSHOT_BLOB_CACHE_INDEX ).setIndicesOptions (IndicesOptions .LENIENT_EXPAND_OPEN ).setSize (0 ).get (),
275
271
numberOfCachedBlobs
0 commit comments