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

Fixing SnapshotResiliencyTests.testTransportGetSnapshotsAction #9189

Merged
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2eb5e97
Moving get snapshot requests to listener based async calls
indrajohn7 Jun 30, 2023
04569cf
Adding test coverage for TransportGetSnapshotsAction
indrajohn7 Jul 2, 2023
41af99a
Merge remote-tracking branch 'upstream/main' into get_snapshot_async_…
indrajohn7 Jul 2, 2023
312fa4c
Adding Changelog
indrajohn7 Jul 2, 2023
0c47fa5
Merging from main
indrajohn7 Jul 7, 2023
77f4876
Adding TransportGetSnapshotsAction integ tests
cenation07 Jul 10, 2023
f99596a
Merge remote-tracking branch 'upstream/main' into get_snapshot_async_…
cenation07 Jul 10, 2023
dbc4884
Adding Minor test fix
cenation07 Jul 12, 2023
19dc525
Merging from main
cenation07 Jul 12, 2023
1d7bf94
Adding minor typo fix
cenation07 Jul 12, 2023
f0b3834
Removing stale tests
cenation07 Jul 17, 2023
8d14c06
Merging from main
cenation07 Jul 17, 2023
5bb2e39
Cleaning transport tests
cenation07 Jul 17, 2023
ef5aab8
Cleaning up Changelog
cenation07 Jul 17, 2023
b9954c0
Adding getRepositoryData call when isCurrentSnapshotsOnly is false
cenation07 Jul 17, 2023
b947da2
Adding listener callback restricted to nonCurrentSnapshotsOnly
cenation07 Jul 21, 2023
6d25f8e
Merging from main
cenation07 Jul 21, 2023
891648d
Calling getRepositoryData when CurrentSnapshotOnly is false
cenation07 Jul 23, 2023
3661e4f
Merge remote-tracking branch 'upstream/main' into get_snapshot_async_…
cenation07 Jul 23, 2023
c4a668e
refactoring getRepositoryData
cenation07 Jul 24, 2023
7cee224
Adding current in-progress snapshots tests
cenation07 Aug 4, 2023
0ce4fe2
Merging from main
cenation07 Aug 4, 2023
3440908
refactoring tests
cenation07 Aug 5, 2023
63ab279
Merge remote-tracking branch 'upstream/main' into get_snapshot_async_…
cenation07 Aug 5, 2023
bf039ec
Merge remote-tracking branch 'upstream/main' into get_snapshot_async_…
cenation07 Aug 7, 2023
0d7e7fb
Fixing typo error of adding back comment
cenation07 Aug 7, 2023
8fa723e
Fixing flaky test testTransportGetSnapshotsAction with single steplis…
cenation07 Aug 9, 2023
6a443fc
Merging from main
cenation07 Aug 9, 2023
cb72ba5
Fixing the flaky tests and adding change logs
cenation07 Aug 9, 2023
3f56819
Removing change log and updating assertions
cenation07 Aug 9, 2023
73ac6b6
Update CHANGELOG.md to remove the extra new line
indrajohn7 Aug 9, 2023
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Replace the deprecated IndexReader APIs with new storedFields() & termVectors() ([#7792](https://github.com/opensearch-project/OpenSearch/pull/7792))
- [Remote Store] Restrict user override for remote store index level settings ([#8812](https://github.com/opensearch-project/OpenSearch/pull/8812))
- Removed blocking wait in TransportGetSnapshotsAction which was exhausting generic threadpool ([#8377](https://github.com/opensearch-project/OpenSearch/pull/8377))
- Fixed Flaky test testTransportGetSnapshotsAction ([#9189](https://github.com/opensearch-project/OpenSearch/pull/9189))
indrajohn7 marked this conversation as resolved.
Show resolved Hide resolved

### Deprecated

Expand Down Expand Up @@ -129,4 +130,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Security

[Unreleased 3.0]: https://github.com/opensearch-project/OpenSearch/compare/2.x...HEAD
[Unreleased 2.x]: https://github.com/opensearch-project/OpenSearch/compare/2.10...2.x
[Unreleased 2.x]: https://github.com/opensearch-project/OpenSearch/compare/2.10...2.x
shwetathareja marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -798,43 +798,41 @@ public void testTransportGetSnapshotsAction() {
setupTestCluster(randomFrom(1, 3, 5), randomIntBetween(2, 10));

String repoName = "repo";
final String[] snapshotsList = { "snapshot-1", "snapshot-2" };
final String[] indexList = { "index-1", "index-2" };
final String[] snapshotsList = { "snapshot-1" };
final String index = "index-1";
final int shards = randomIntBetween(1, 10);
shwetathareja marked this conversation as resolved.
Show resolved Hide resolved

TestClusterNodes.TestClusterNode clusterManagerNode = testClusterNodes.currentClusterManager(
testClusterNodes.nodes.values().iterator().next().clusterService.state()
);

for (int i = 0; i < snapshotsList.length; i++) {
final StepListener<CreateSnapshotResponse> createSnapshotResponseStepListener = new StepListener<>();
final String snapshot = snapshotsList[i];
final String index = indexList[i];
continueOrDie(
createRepoAndIndex(repoName, index, shards),
createSnapshotResponse -> client().admin()
.cluster()
.prepareCreateSnapshot(repoName, snapshot)
.setWaitForCompletion(true)
.execute(createSnapshotResponseStepListener)
);
}
deterministicTaskQueue.runAllRunnableTasks();
final StepListener<CreateSnapshotResponse> createSnapshotResponseStepListener = new StepListener<>();
final String snapshot = snapshotsList[0];
continueOrDie(
createRepoAndIndex(repoName, index, shards),
createSnapshotResponse -> client().admin()
.cluster()
.prepareCreateSnapshot(repoName, snapshot)
.setWaitForCompletion(true)
.execute(createSnapshotResponseStepListener)
);

continueOrDie(createSnapshotResponseStepListener, createSnapshotResponse -> {

TransportAction getSnapshotsAction = clusterManagerNode.actions.get(GetSnapshotsAction.INSTANCE);
TransportGetSnapshotsAction transportGetSnapshotsAction = (TransportGetSnapshotsAction) getSnapshotsAction;
GetSnapshotsRequest repoSnapshotRequest = new GetSnapshotsRequest().repository(repoName).snapshots(snapshotsList);
TransportAction getSnapshotsAction = clusterManagerNode.actions.get(GetSnapshotsAction.INSTANCE);
TransportGetSnapshotsAction transportGetSnapshotsAction = (TransportGetSnapshotsAction) getSnapshotsAction;
GetSnapshotsRequest repoSnapshotRequest = new GetSnapshotsRequest().repository(repoName).snapshots(snapshotsList);

transportGetSnapshotsAction.execute(null, repoSnapshotRequest, ActionListener.wrap(repoSnapshotResponse -> {
assertNotNull("Snapshot list should not be null", repoSnapshotResponse.getSnapshots());
assertThat(repoSnapshotResponse.getSnapshots(), hasSize(2));
List<SnapshotInfo> snapshotInfos = repoSnapshotResponse.getSnapshots();
for (SnapshotInfo snapshotInfo : snapshotInfos) {
transportGetSnapshotsAction.execute(null, repoSnapshotRequest, ActionListener.wrap(repoSnapshotResponse -> {
assertNotNull("Snapshot list should not be null", repoSnapshotResponse.getSnapshots());
assertThat(repoSnapshotResponse.getSnapshots(), hasSize(1));
List<SnapshotInfo> snapshotInfos = repoSnapshotResponse.getSnapshots();
SnapshotInfo snapshotInfo = snapshotInfos.get(0);
assertEquals(SnapshotState.SUCCESS, snapshotInfo.state());
assertEquals(0, snapshotInfo.failedShards());
assertTrue(Arrays.stream(snapshotsList).anyMatch(snapshotInfo.snapshotId().getName()::equals));
}
}, exception -> { throw new AssertionError(exception); }));
assertTrue(snapshotInfo.snapshotId().getName().equals(snapshotsList[0]));
indrajohn7 marked this conversation as resolved.
Show resolved Hide resolved
}, exception -> { throw new AssertionError(exception); }));
});
}

public void testTransportGetCurrentSnapshotsAction() {
Expand Down