From 951d7ce33b129eec2b8f921341bb10ef77e650fc Mon Sep 17 00:00:00 2001 From: Jarek Kowalski Date: Thu, 11 Mar 2021 21:08:10 -0800 Subject: [PATCH] maintenance: enable full maintenance by default with 24h interval (#879) Tweaked default message to print on repository creation. --- cli/auto_upgrade.go | 14 +++----------- cli/command_repository_create.go | 8 ++++---- cli/update_check.go | 1 - repo/maintenance/maintenance_params.go | 5 ++--- site/content/docs/Release Notes/v0.8.md | 1 + 5 files changed, 10 insertions(+), 19 deletions(-) diff --git a/cli/auto_upgrade.go b/cli/auto_upgrade.go index 38371544d..2c84971c6 100644 --- a/cli/auto_upgrade.go +++ b/cli/auto_upgrade.go @@ -44,18 +44,10 @@ func setDefaultMaintenanceParameters(ctx context.Context, rep repo.RepositoryWri log(ctx).Noticef(` Kopia will perform quick maintenance of the repository automatically every %v -when running as %v. This operation never deletes any data. +and full maintenance every %v when running as %v. -Full maintenance (which also deletes unreferenced data) is disabled by default. - -To run it manually use: - -$ kopia maintenance run --full - -Alternatively you can schedule full maintenance to run periodically using: - -$ kopia maintenance set --enable-full=true --full-interval=4h -`, p.QuickCycle.Interval, p.Owner) +See https://kopia.io/docs/advanced/maintenance/ for more information. +`, p.QuickCycle.Interval, p.FullCycle.Interval, p.Owner) return nil } diff --git a/cli/command_repository_create.go b/cli/command_repository_create.go index d0f4d7aa9..b1aee3a92 100644 --- a/cli/command_repository_create.go +++ b/cli/command_repository_create.go @@ -104,10 +104,10 @@ func populateRepository(ctx context.Context, password string) error { return errors.Wrap(err, "unable to set global policy") } - printPolicy(policy.DefaultPolicy, nil) - printStdout("\n") - printStdout("To change the policy use:\n kopia policy set --global \n") - printStdout("or\n kopia policy set \n") + printRetentionPolicy(policy.DefaultPolicy, nil) + printCompressionPolicy(policy.DefaultPolicy, nil) + + printStderr("\nTo find more information about default policy run 'kopia policy get'.\nTo change the policy use 'kopia policy set' command.\n") if err := setDefaultMaintenanceParameters(ctx, w); err != nil { return errors.Wrap(err, "unable to set maintenance parameters") diff --git a/cli/update_check.go b/cli/update_check.go index 57808846f..971bd6f57 100644 --- a/cli/update_check.go +++ b/cli/update_check.go @@ -39,7 +39,6 @@ NOTICE: Kopia will check for updates on GitHub every 7 days, starting 24 hours after first use. To disable this behavior, set environment variable ` + checkForUpdatesEnvar + `=false Alternatively you can remove the file "%v". - ` updateAvailableNoticeFormat = ` Upgrade of Kopia from %v to %v is available. diff --git a/repo/maintenance/maintenance_params.go b/repo/maintenance/maintenance_params.go index 97a69efa7..0e5fff0e9 100644 --- a/repo/maintenance/maintenance_params.go +++ b/repo/maintenance/maintenance_params.go @@ -35,9 +35,8 @@ type SnapshotGCParams struct { func DefaultParams() Params { return Params{ FullCycle: CycleParams{ - // TODO: enable this when ready for public consumption - // Enabled: true, - Interval: 7 * 24 * time.Hour, + Enabled: true, + Interval: 24 * time.Hour, //nolint:gomnd }, QuickCycle: CycleParams{ Enabled: true, diff --git a/site/content/docs/Release Notes/v0.8.md b/site/content/docs/Release Notes/v0.8.md index 325a3474d..9cff88f89 100644 --- a/site/content/docs/Release Notes/v0.8.md +++ b/site/content/docs/Release Notes/v0.8.md @@ -12,6 +12,7 @@ There were over 130 changes by 19 contributors which represents a big growth in ### New Features: +* [Full Maintenance](https://kopia.io/docs/advanced/maintenance/) is now enabled by default with an interval of 24 hours. * Added support for scanning only one filesystem via files policy * Major improvements to ignore logic to better follow [.gitignore rules](https://git-scm.com/docs/gitignore). * Added support for [Actions](https://kopia.io/docs/advanced/actions/) which allow running custom scripts before and after a directory is snapshotted with lots of useful applications.