Skip to content

[ENH] A tool for patching logs that were deleted before a new manifest was installed. #5083

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

Merged
merged 1 commit into from
Jul 11, 2025

Conversation

rescrv
Copy link
Contributor

@rescrv rescrv commented Jul 11, 2025

Description of changes

PR #4972 fixed a bug wherein snapshots and fragments were deleted before
the manifest is installed. This has affected the dirty log on staging.

To fix it, we follow the prescription in the comments for this PR.

Test plan

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Documentation Changes

N/A

Copy link
Contributor

Add Patch Tool/Helper for Logs Deleted Before Manifest Install

This PR introduces a new tool and supporting functionality for generating garbage collection patches in WAL3 when a bug causes logs to be deleted prior to manifest installation. The core change adds the function bug_patch_construct_garbage_from_manifest to reconstruct which files should be treated as garbage, and exposes this as a command-line utility for manual recovery. Regression tests are provided based on a 'real world' failure scenario.

Key Changes

• Added bug_patch_construct_garbage_from_manifest to Garbage in gc.rs to construct a patch set for deleted logs using a manifest.
• Introduced wal3-construct-garbage-from-manifest.rs as a CLI tool for operators to create garbage cleanup patches from manifests, fragment sequence numbers, and offsets.
• Added targeted test case covering manifest state encountered in production failures.

Affected Areas

• rust/wal3/src/gc.rs
• rust/wal3/src/bin/wal3-construct-garbage-from-manifest.rs

This summary was automatically generated by @propel-code-bot

Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

Copy link
Contributor

@Sicheng-Pan Sicheng-Pan left a comment

Choose a reason for hiding this comment

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

The garbage file needs to be manually uploaded to S3

@rescrv rescrv merged commit 69cbf58 into main Jul 11, 2025
58 checks passed
@rescrv rescrv deleted the rescrv/fix-gc-missing-snapshots branch August 1, 2025 18:18
Inventrohyder pushed a commit to Inventrohyder/chroma that referenced this pull request Aug 5, 2025
…t was installed. (chroma-core#5083)

## Description of changes

PR chroma-core#4972 fixed a bug wherein snapshots and fragments were deleted before
the manifest is installed.  This has affected the dirty log on staging.

To fix it, we follow the prescription in the comments for this PR.

## Test plan

- [X] Tests pass locally with `pytest` for python, `yarn test` for js,
`cargo test` for rust

## Documentation Changes

N/A
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