2121import org .elasticsearch .action .DocWriteResponse ;
2222import org .elasticsearch .action .admin .cluster .snapshots .restore .RestoreSnapshotResponse ;
2323import org .elasticsearch .action .admin .cluster .snapshots .status .SnapshotStats ;
24- import org .elasticsearch .action .admin .cluster .snapshots .status .SnapshotsStatusResponse ;
24+ import org .elasticsearch .action .admin .cluster .snapshots .status .SnapshotStatus ;
2525import org .elasticsearch .action .admin .indices .forcemerge .ForceMergeResponse ;
2626import org .elasticsearch .action .admin .indices .stats .IndexStats ;
2727import org .elasticsearch .action .bulk .BulkItemResponse ;
4646@ ESIntegTestCase .ClusterScope (scope = ESIntegTestCase .Scope .TEST , numDataNodes = 0 )
4747public class BlobStoreIncrementalityIT extends AbstractSnapshotIntegTestCase {
4848
49- @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/54034" )
5049 public void testIncrementalBehaviorOnPrimaryFailover () throws InterruptedException , ExecutionException , IOException {
5150 internalCluster ().startMasterOnlyNode ();
5251 final String primaryNode = internalCluster ().startDataOnlyNode ();
@@ -174,10 +173,8 @@ public void testForceMergeCausesFullSnapshot() throws Exception {
174173 client ().admin ().cluster ().prepareCreateSnapshot (repo , snapshot2 ).setIndices (indexName ).setWaitForCompletion (true ).get ();
175174
176175 logger .info ("--> asserting that the two snapshots refer to different files in the repository" );
177- final SnapshotsStatusResponse response =
178- client ().admin ().cluster ().prepareSnapshotStatus (repo ).setSnapshots (snapshot2 ).get ();
179176 final SnapshotStats secondSnapshotShardStatus =
180- response . getSnapshots (). get ( 0 ).getIndices ().get (indexName ).getShards ().get (0 ).getStats ();
177+ getStats ( repo , snapshot2 ).getIndices ().get (indexName ).getShards ().get (0 ).getStats ();
181178 assertThat (secondSnapshotShardStatus .getIncrementalFileCount (), greaterThan (0 ));
182179 }
183180
@@ -191,19 +188,20 @@ private void assertCountInIndexThenDelete(String index, long expectedCount) thro
191188 private void assertTwoIdenticalShardSnapshots (String repo , String indexName , String snapshot1 , String snapshot2 ) {
192189 logger .info (
193190 "--> asserting that snapshots [{}] and [{}] are referring to the same files in the repository" , snapshot1 , snapshot2 );
194- final SnapshotsStatusResponse response =
195- client ().admin ().cluster ().prepareSnapshotStatus (repo ).setSnapshots (snapshot1 , snapshot2 ).get ();
196- final SnapshotStats firstSnapshotShardStatus =
197- response .getSnapshots ().get (0 ).getIndices ().get (indexName ).getShards ().get (0 ).getStats ();
191+ final SnapshotStats firstSnapshotShardStatus = getStats (repo , snapshot1 ).getIndices ().get (indexName ).getShards ().get (0 ).getStats ();
198192 final int totalFilesInShard = firstSnapshotShardStatus .getTotalFileCount ();
199193 assertThat (totalFilesInShard , greaterThan (0 ));
200194 assertThat (firstSnapshotShardStatus .getIncrementalFileCount (), is (totalFilesInShard ));
201195 final SnapshotStats secondSnapshotShardStatus =
202- response . getSnapshots (). get ( 1 ).getIndices ().get (indexName ).getShards ().get (0 ).getStats ();
196+ getStats ( repo , snapshot2 ).getIndices ().get (indexName ).getShards ().get (0 ).getStats ();
203197 assertThat (secondSnapshotShardStatus .getTotalFileCount (), is (totalFilesInShard ));
204198 assertThat (secondSnapshotShardStatus .getIncrementalFileCount (), is (0 ));
205199 }
206200
201+ private SnapshotStatus getStats (String repository , String snapshot ) {
202+ return client ().admin ().cluster ().prepareSnapshotStatus (repository ).setSnapshots (snapshot ).get ().getSnapshots ().get (0 );
203+ }
204+
207205 private void ensureRestoreSingleShardSuccessfully (String repo , String indexName , String snapshot , String indexSuffix ) {
208206 logger .info ("--> restoring [{}]" , snapshot );
209207 final RestoreSnapshotResponse restoreSnapshotResponse = client ().admin ().cluster ().prepareRestoreSnapshot (repo , snapshot )
0 commit comments