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): perform index compaction during repo maintenance #3651

Merged
merged 6 commits into from
Mar 27, 2024

Conversation

julio-lopez
Copy link
Collaborator

@julio-lopez julio-lopez commented Feb 16, 2024

@julio-lopez julio-lopez added performance enterprise For anything enterprise related helping reqs from the industry. resource-utilization labels Feb 16, 2024
Copy link

codecov bot commented Feb 16, 2024

Codecov Report

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

Project coverage is 77.09%. Comparing base (cb455c6) to head (f4b88af).
Report is 73 commits behind head on master.

Files Patch % Lines
repo/maintenance/maintenance_run.go 52.38% 13 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3651      +/-   ##
==========================================
+ Coverage   75.86%   77.09%   +1.22%     
==========================================
  Files         470      476       +6     
  Lines       37301    28902    -8399     
==========================================
- Hits        28299    22281    -6018     
+ Misses       7071     4693    -2378     
+ Partials     1931     1928       -3     

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

@julio-lopez julio-lopez changed the title refactor(general) perform index compaction during repo maintenance refactor(general): perform index compaction during repo maintenance Feb 16, 2024
@julio-lopez julio-lopez force-pushed the fix/epoch-maintenance branch 3 times, most recently from c133f9a to d1d670f Compare February 23, 2024 02:40
TaskIndexCompaction = "index-compaction"
TaskExtendBlobRetentionTimeFull = "extend-blob-retention-time"
TaskCleanupLogs = "cleanup-logs"
TaskEpochDeleteSupersededIndexes = "delete-superseded-epoch-indexes"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Other "epoch" cleanup tasks are added as well

@@ -593,19 +593,28 @@ func (e *Manager) loadSingleEpochCompactions(ctx context.Context, cs *CurrentSna
return nil
}

func (e *Manager) maybeGenerateNextRangeCheckpointAsync(ctx context.Context, cs CurrentSnapshot, p *Parameters) {
func getRangeToCompact(cs CurrentSnapshot, p Parameters) (low, high int, compactRange bool) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is "factored out" from maybeGenerateNextRangeCheckpointAsync
It is reused.

plar

This comment was marked as duplicate.

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.

Left a few questions, but otherwise it makes sense to me. Reviewing commit-by-commit was very helpful, thanks

repo/maintenance/maintenance_run.go Show resolved Hide resolved
internal/epoch/epoch_manager.go Outdated Show resolved Hide resolved
internal/epoch/epoch_manager.go Outdated Show resolved Hide resolved
repo/maintenance/maintenance_run.go Show resolved Hide resolved
internal/epoch/epoch_manager.go Outdated Show resolved Hide resolved
internal/epoch/epoch_manager.go Outdated Show resolved Hide resolved
internal/epoch/epoch_manager.go Outdated Show resolved Hide resolved
internal/epoch/epoch_manager.go Outdated Show resolved Hide resolved
internal/epoch/epoch_manager.go Outdated Show resolved Hide resolved
repo/maintenance/maintenance_run.go Outdated Show resolved Hide resolved
repo/maintenance/maintenance_run.go Show resolved Hide resolved
julio-lopez added a commit to kastenhq/kopia that referenced this pull request Mar 6, 2024
julio-lopez added a commit to kastenhq/kopia that referenced this pull request Mar 7, 2024
julio-lopez added a commit that referenced this pull request Mar 7, 2024
Add
- TestMabyeAdvanceEpoch
- TestMabyeAdvanceEpoch_Empty
- TestMaybeAdvanceEpoch_Error
- TestMaybeAdvanceEpoch_GetParametersError

Ref:
- #3638
- #3645
- #3651
julio-lopez added a commit to kastenhq/kopia that referenced this pull request Mar 12, 2024
julio-lopez added a commit that referenced this pull request Mar 12, 2024
Extracted from #3651.

Thanks to @plar and @redgoat650 for the suggestions.

Ref:

- #3603
- #3645
- #3638
- #3639
@julio-lopez julio-lopez force-pushed the fix/epoch-maintenance branch 2 times, most recently from a9e21c7 to ab2c592 Compare March 13, 2024 01:52
julio-lopez added a commit that referenced this pull request Mar 20, 2024
Add:
- epoch.Manager.MaybeCompactSingleEpoch
- getCompactedEpochRange helper
- oldestUncompactedEpoch helper
- TestOldestUncompactedEpoch
- Tests for MaybeCompactSingleEpoch

Ref:
- Subset and dependency of #3651
- Depends on #3735
- Avoid index (epoch) cleanup and compaction during index reads #3638
- Make "read" commands/operations really read-only.  #3639
@julio-lopez julio-lopez marked this pull request as ready for review March 26, 2024 21:45
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.

Looks good


// compact range
if err := ReportRun(ctx, runParams.rep, TaskEpochGenerateRange, s, func() error {
log(ctx).Infof("Attempting to compact a range of epoch indexes ...")
Copy link
Contributor

Choose a reason for hiding this comment

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

super nit: the other similar info logs have no space before the ellipsis. Remove for consistency?

Suggested change
log(ctx).Infof("Attempting to compact a range of epoch indexes ...")
log(ctx).Infof("Attempting to compact a range of epoch indexes...")

@julio-lopez julio-lopez enabled auto-merge (squash) March 27, 2024 04:55
@julio-lopez julio-lopez merged commit 08a593b into kopia:master Mar 27, 2024
26 of 27 checks passed
@julio-lopez julio-lopez deleted the fix/epoch-maintenance branch March 27, 2024 16:41
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
enterprise For anything enterprise related helping reqs from the industry. performance resource-utilization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants