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

refactor(general): add epoch.Manager.MaybeCompactSingleEpoch #3728

Merged
merged 9 commits into from
Mar 20, 2024

Conversation

julio-lopez
Copy link
Collaborator

@julio-lopez julio-lopez commented Mar 13, 2024

Copy link

codecov bot commented Mar 13, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 77.10%. Comparing base (cb455c6) to head (432fab0).
Report is 64 commits behind head on master.

Files Patch % Lines
internal/epoch/epoch_manager.go 80.00% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3728      +/-   ##
==========================================
+ Coverage   75.86%   77.10%   +1.23%     
==========================================
  Files         470      476       +6     
  Lines       37301    28837    -8464     
==========================================
- Hits        28299    22234    -6065     
+ Misses       7071     4678    -2393     
+ Partials     1931     1925       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@julio-lopez julio-lopez force-pushed the fix/compact-single-epoch branch 3 times, most recently from cc654d9 to 303da76 Compare March 19, 2024 05:04
julio-lopez added a commit that referenced this pull request Mar 19, 2024
Refactoring for the original implementation with intRange and
getKeyRange from closed-open ranges [lo, hi) to closed ranges: [lo, hi].
The primary motivation is for consistency with the implementation
of epoch.RangeMetadata in the same package, and thus avoid
confusion and reduce cognitive load.

Changes:

- adds a getContiguousKeyRange wrapper that checks for contiguity.
- getKeyRange simply returns a range with minimum and maximum
  values for the keys in the map.
- changes the range implementation from closed-open ranges [lo, hi)
   to closed ranges: [lo, hi] where both lo and hi are included in the range.
- Additional unit tests are included.
- renames intRange to closedIntRange to reflect new functionality.

Ref:
- Follow up refactor(general): add epoch.getKeyRange helper #3721
- Needed for refactor(general): add epoch.Manager.MaybeCompactSingleEpoch #3728
- Avoid index (epoch) cleanup and compaction during index reads #3638
Copy link
Collaborator

@plar plar left a comment

Choose a reason for hiding this comment

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

LGTM

internal/epoch/epoch_utils.go Outdated Show resolved Hide resolved
Copy link
Contributor

@redgoat650 redgoat650 left a comment

Choose a reason for hiding this comment

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

Some comment nits and a question, but looks good

internal/epoch/epoch_manager.go Outdated Show resolved Hide resolved
internal/epoch/epoch_manager_test.go Outdated Show resolved Hide resolved
return err
}

if !cs.isSettledEpochNumber(uncompacted) {
Copy link
Contributor

Choose a reason for hiding this comment

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

So if I'm not mistaken, this has to do with the ordering of compaction vs epoch advancement we discussed, right? I.e. if we only advance epoch after successful compaction we only ever expect compaction-eligible epochs to be within the unsettled range.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@redgoat650 Yes, it's related. See the check right below.

In short, the current snapshot cs only loads the last 3 uncompacted epochs, that is, the current write epoch, and the previous 2. So, there may be some uncompacted epochs for which the blob metadata is not included in cs. The block below accounts for that and explicitly loads the list of the blobs for the "missing epochs".

@julio-lopez julio-lopez marked this pull request as ready for review March 20, 2024 00:43
@julio-lopez julio-lopez merged commit 6236ff7 into kopia:master Mar 20, 2024
27 checks passed
@julio-lopez julio-lopez deleted the fix/compact-single-epoch branch March 20, 2024 00:46
julio-lopez added a commit that referenced this pull request Mar 27, 2024
…3651)

Perform index epoch compaction and cleanup during repository maintenance

* refactor: rename maintenance task for deleting superseded indexes
* maintenance task to cleanup epoch markers
* maintenance task to advance write index epoch
* maintenance task to compact epoch ranges
* quick maintenance task to compact a single (index) epoch
* full maintenance task to compact a single (index) epoch

Ref:
- #3638
- #3639

Followup to:
- #3603
- #3645

Related helpers and changes:
- #3721
- #3735
- #3709
- #3728
- #3727
- #3726
Lyndon-Li pushed a commit to Lyndon-Li/kopia that referenced this pull request Mar 29, 2024
…opia#3651)

Perform index epoch compaction and cleanup during repository maintenance

* refactor: rename maintenance task for deleting superseded indexes
* maintenance task to cleanup epoch markers
* maintenance task to advance write index epoch
* maintenance task to compact epoch ranges
* quick maintenance task to compact a single (index) epoch
* full maintenance task to compact a single (index) epoch

Ref:
- kopia#3638
- kopia#3639

Followup to:
- kopia#3603
- kopia#3645

Related helpers and changes:
- kopia#3721
- kopia#3735
- kopia#3709
- kopia#3728
- kopia#3727
- kopia#3726
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.

None yet

3 participants