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 --dry-run-metadata #605

Merged
merged 6 commits into from
Dec 26, 2023
Merged

Add --dry-run-metadata #605

merged 6 commits into from
Dec 26, 2023

Conversation

gperciva
Copy link
Member

No description provided.

{

/* Create chunkifier. */
if (!no_chunkifier) {
if (use_chunkifier) {
Copy link
Member Author

Choose a reason for hiding this comment

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

When I looked at the code again, I really didn't like the (!no_chunkifier) part.

@cperciva
Copy link
Member

I prefer no_chunkfier as the variable name since it's the exceptional state -- it's basically a flag, and flags are things which flag non-default behaviour.

@gperciva
Copy link
Member Author

Ok, I removed the REBASE commit. As far as I know, this is ready for merging.

@cperciva
Copy link
Member

Please fix NEWS.md conflict.

The only interesting facets of this commit are:

- internally, we store this as bsdtar->option_dryrun == 2; the existing
  --dry-run option is stored as 1.

- we disallow the combination of --dry-run-metadata with --print-stats,
  because the --print-stats (generated from the chunk layer) would only
  report metadata and metaindex bytes (since no filesystem data will
  reach the chunk layer).
If we've been given --dry-run-metadata, then we only care about the
total number of bytes in each file, not the contents.
We use the same technique for storage_write.c: if we don't want to use
the storage layer (in that case, due to --dry-run), we set the storage
cookie to NULL.

The next commit will do the same for the chunk layer: if we don't want
to use it (due to --dry-run-meta), we'll set the chunkification cookie
to NULL.

chunkify_free() already does a no-op for NULL.
Disabling chunkification also stops any file or header data from
reaching the chunk layer.

Metadata and metaindex bytes are unaffected by this change; those are
still passed on.  This is not a deliberate choice; it's just a bit more
awkward to stop those bytes from going to the chunk layer, and since we
disabled the combination of --print-stats with --dry-run-metadata in
bsdtar.c, it doesn't matter if those bytes are passed on.  There's no
noticeable performance impact of metadata and metaindex bytes.
These changes were made automatically via scripts.
@gperciva
Copy link
Member Author

gperciva commented Dec 26, 2023

Rebased. Also fixed a comment in writetape_open, which would have been grammatically incorrect.

@cperciva cperciva merged commit b24e793 into master Dec 26, 2023
2 checks passed
@gperciva gperciva deleted the dry-run-metadata branch December 27, 2023 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants