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

Add a manifest introspection utility #247

Merged
merged 3 commits into from
Oct 17, 2024
Merged

Conversation

dmitry-potepalov
Copy link
Contributor

@dmitry-potepalov dmitry-potepalov commented Oct 16, 2024

Add a command-line tool that can be used to list/dump backup manifests in object storage without interacting with the server. Useful when debugging manifest compatibility issues/restoration bugs.

List example:

# astacus manifest -c astacus.conf list
backup-2024-10-15T13:54:19+00:00
backup-2024-10-16T13:54:20+00:00

Describe example:

# astacus manifest -c astacus.conf describe backup-2024-10-16T13:54:20+00:00
clickhouse manifest backup-2024-10-16T13:54:20+00:00
===============================
Started at: 2024-10-16T13:54:20.802652+00:00
Finished at: 2024-10-16T13:54:21.873076+00:00
Attempts: 1
Snapshot #0 created at 2024-10-16T13:54:20.875002+00:00 contains 11 files (25145965 bytes)
Node #0 uploaded 13605207 bytes out of 25145547
References 0 objects in tiered storage totalling 0 bytes

Dump example:

# astacus manifest -c /run/aiven/astacus.conf dump --hashes backup-2024-10-16T13:54:20+00:00
{
  "start": "2024-10-16T13:54:20.802652Z",
  "end": "2024-10-16T13:54:21.873076Z",
  "attempt": 1,
  "snapshot_results": [
    {
      "start": "2024-10-16T13:54:20.875002Z",
      "end": "2024-10-16T13:54:21.008648Z",
      "state": {
        "root_globs": [
          "disks/remote_storage/shadow/astacus/store/**/*",
          "shadow/astacus/store/**/*"
        ],
        "files": "<redacted, has 11 entries>"
      },
      "files": 11,
      "total_size": 25145965,
      "hashes": [
        {
          "hexdigest": "c5414b9c932f41fcfa3ef9051aff2bcde4520f9bcec4f171321cff019491ebf1",
          "size": 356
        },
...

Add a tool to list manifests directly from object storage. Can be
useful if Astacus is not running/unresponsive.
Add a command that prints some high-level info about the manifest
without recursing into snapshot contents.
@dmitry-potepalov dmitry-potepalov marked this pull request as ready for review October 16, 2024 15:45
@dmitry-potepalov dmitry-potepalov requested a review from a team October 16, 2024 15:48

def _run_dump(args):
rohmu_storage = _create_rohmu_storage(args.config, args.storage)
with rohmu_storage.open_json_bytes(args.manifest) as mapped_file:
Copy link
Contributor

Choose a reason for hiding this comment

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

How is performance in general here?

if indent is 0 and we are not redacting, we can just copy the contents of the file to stdout. Maybe for very large manifests this would be a good performance optimization.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, changed to "dump to stdout without parsing" by default, set all the formatting to be an optional extra

Useful when debugging. By default does not dump the biggest parts of
the manifest (lists of hashes and lists of files), includes options
to dump files and hashes as well.
@dmitry-potepalov dmitry-potepalov force-pushed the dmitry-potepalov/manifest-tool branch from 99a9819 to b9b9b4a Compare October 17, 2024 08:48
@joelynch joelynch merged commit d76fb8f into main Oct 17, 2024
2 checks passed
@joelynch joelynch deleted the dmitry-potepalov/manifest-tool branch October 17, 2024 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants