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

cloud_storage: add partition manifest downloader #20314

Merged
merged 2 commits into from
Jun 28, 2024

Conversation

andrwng
Copy link
Contributor

@andrwng andrwng commented Jun 27, 2024

There are various calls to download partition manifests (e.g. read replicas,
partition recovery, Raft snapshot recovery) where the application
doesn't necessarily care about the format or path of the manifest. These
callers typically use remote::try_download_partition_manifest(), which
checks for both the binary and JSON manifest.

Since the naming scheme of objects is changing, this introduces a
downloader that performs this same operation, but also takes into
account the naming scheme.

A later commit will plug this into the various users to replace
try_download_partition_manifest().

I considered moving this logic into the remote, but generally the remote
seems to have grown crowded with business logic. Naming scheme seems
like it should fall outside of the remote's concern, considering most
other methods in remote rely on callers to pass a path.

A similar method is added for checking if manifests exist, to eventually
subsume remote::partition_manifest_exists() for the same reason.

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v24.1.x
  • v23.3.x
  • v23.2.x

Release Notes

  • none

WillemKauf
WillemKauf previously approved these changes Jun 27, 2024
@andrwng andrwng dismissed WillemKauf’s stale review June 28, 2024 00:25

The merge-base changed after approval.

There are various calls to download partition manifests (e.g. read replicas,
partition recovery, Raft snapshot recovery) where the application
doesn't necessarily care about the format or path of the manifest. These
callers typically use remote::try_download_partition_manifest(), which
checks for both the binary and JSON manifest.

Since the naming scheme of objects is changing, this introduces a
downloader that performs this same operation, but also takes into
account the naming scheme.

A later commit will plug this into the various users to replace
try_download_partition_manifest().

I considered moving this logic into the remote, but generally the remote
seems to have grown crowded with business logic. Naming scheme seems
like it should fall outside of the remote's concern, considering most
other methods in remote rely on callers to pass a path.
Topic recovery validation checks if partition manifests exist, and use a
method that's built into the cloud_storage::remote. In the effort to
change our object naming scheme, this means this needs to be updated to
support the new naming.

Rather than adding more business logic into the remote, this adds a
method to the new partition_manifest_downloader to check if a given
partition's manifest exists.

A later commit will plumb this into topic recovery validation.
@andrwng
Copy link
Contributor Author

andrwng commented Jun 28, 2024

Latest push is just a rebase

Comment on lines +58 to +61
const cloud_storage_clients::bucket_name bucket_;
const remote_path_provider& remote_path_provider_;
const model::ntp ntp_;
const model::initial_revision_id rev_;
Copy link
Member

Choose a reason for hiding this comment

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

nit: does clang-tidy not complain about these const members in a movable class? https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/avoid-const-or-ref-data-members.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah it does. Movability aside I generally prefer to make things const when they can be though, for readability.

Interestingly though it still complains if I make it non-movable non-copyable. I'll leave this as is for now, unless you feel strongly about it

Copy link
Member

Choose a reason for hiding this comment

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

nah its fine leave it

@andrwng andrwng merged commit 28769ea into redpanda-data:dev Jun 28, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants