Skip to content

Test get-snapshots API with missing details#111903

Merged
DaveCTurner merged 5 commits intoelastic:mainfrom
DaveCTurner:2024/08/14/GetSnapshotsIT-removeRandomSnapshotDetails
Aug 19, 2024
Merged

Test get-snapshots API with missing details#111903
DaveCTurner merged 5 commits intoelastic:mainfrom
DaveCTurner:2024/08/14/GetSnapshotsIT-removeRandomSnapshotDetails

Conversation

@DaveCTurner
Copy link
Copy Markdown
Member

Extends the test added in #111786 to check that the API still works
correctly even in the BwC case that the details needed are not in the
RepositoryData and must be read from the individual SnapshotInfo
blobs.

Extends the test added in elastic#111786 to check that the API still works
correctly even in the BwC case that the details needed are not in the
`RepositoryData` and must be read from the individual `SnapshotInfo`
blobs.
@DaveCTurner DaveCTurner added >test Issues or PRs that are addressing/adding tests :Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs v8.16.0 labels Aug 14, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Meta label for distributed team. label Aug 14, 2024
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

Copy link
Copy Markdown
Contributor

@DiannaHohensee DiannaHohensee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking a first pass to make sure I understand what's going on, and to improve readability / future debugging.

assertEquals(0, remaining);
}

private static Set<SnapshotId> removeRandomSnapshotDetails(List<String> repositories) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls comment method with explanation about randomly exercising backwards compatibility, and what backwards compatibility specifically.

return Set.of();
}
final var masterRepositoriesService = internalCluster().getCurrentMasterNodeInstance(RepositoriesService.class);
return safeAwait(l0 -> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea what l0 is abbreviating and thought it was a ten at first -- how about safeAwaitListener?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:) fair enough, fixed now.

final var masterRepositoriesService = internalCluster().getCurrentMasterNodeInstance(RepositoriesService.class);
return safeAwait(l0 -> {
final Set<SnapshotId> snapshotsWithoutDetails = ConcurrentCollections.newConcurrentSet();
try (var listeners = new RefCountingListener(l0.map(v -> Set.copyOf(snapshotsWithoutDetails)))) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
try (var listeners = new RefCountingListener(l0.map(v -> Set.copyOf(snapshotsWithoutDetails)))) {
// Once we finish going through the repositories, complete the safeAwait listener with a copy of snapshotsWithoutDetails.
try (var listeners = new RefCountingListener(l0.map(v -> Set.copyOf(snapshotsWithoutDetails)))) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This took me 10+ minutes to decipher all the utilities and how they work together, I'd really appreciate a comment to boost understanding/retention for the next poor sucker (possibly me again) to come along.

assertEquals(0, remaining);
}

private static Set<SnapshotId> removeRandomSnapshotDetails(List<String> repositories) {
Copy link
Copy Markdown
Contributor

@DiannaHohensee DiannaHohensee Aug 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might better to name it removeSnapshotDetailsFromRandomSnapshots, or something. Right now it suggests to me that random details will be removed -- sometimes this field, sometimes that other field. But a comment will clarify 🤷‍♀️

@DaveCTurner
Copy link
Copy Markdown
Member Author

Thanks @DiannaHohensee - this was extracted out of a larger change so yes might not make quite so much sense on its own. Hopefully the changes I just pushed improve things, please take another look.

Copy link
Copy Markdown
Contributor

@DiannaHohensee DiannaHohensee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@DaveCTurner DaveCTurner merged commit 1fbd7e9 into elastic:main Aug 19, 2024
@DaveCTurner DaveCTurner deleted the 2024/08/14/GetSnapshotsIT-removeRandomSnapshotDetails branch August 19, 2024 05:19
weizijun added a commit to weizijun/elasticsearch that referenced this pull request Aug 19, 2024
* upstream/main:
  Fail `indexDocs()` on rejection (elastic#111962)
  Move repo analyzer to its own package (elastic#111963)
  Add generated evaluators for DateNanos conversion functions (elastic#111961)
  Clean the last traces from global retention in templates (elastic#111669)
  Fix known issue docs for elastic#111866 (elastic#111956)
  x-pack/plugin/otel: introduce x-pack-otel plugin (elastic#111091)
  Improve reaction to blob store corruptions (elastic#111954)
  Introduce `StreamingXContentResponse` (elastic#111933)
  Revert "Add 8.15.0 known issue for memory locking in Windows (elastic#111949)"
  Test get-snapshots API with missing details (elastic#111903)
  Add 8.15.0 known issue for memory locking in Windows (elastic#111949)

# Conflicts:
#	server/src/main/java/org/elasticsearch/TransportVersions.java
cbuescher pushed a commit to cbuescher/elasticsearch that referenced this pull request Sep 4, 2024
Extends the test added in elastic#111786 to check that the API still works
correctly even in the BwC case that the details needed are not in the
`RepositoryData` and must be read from the individual `SnapshotInfo`
blobs.
davidkyle pushed a commit to davidkyle/elasticsearch that referenced this pull request Sep 5, 2024
Extends the test added in elastic#111786 to check that the API still works
correctly even in the BwC case that the details needed are not in the
`RepositoryData` and must be read from the individual `SnapshotInfo`
blobs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs Team:Distributed Meta label for distributed team. >test Issues or PRs that are addressing/adding tests v8.16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants