Repository: borgbackup/borg

Issue:
remove compression mode default?
following the same reasoning why we do not have a encryption mode default any more in borg 1.1, we should remove the compression mode default and thus require the user to give `--compression X` for `borg create`.

Having `--compression none` as default (as now) is similarly bad as having `--encryption none` as default (as in early borg/attic).


Discussion:
let's discuss here whether we want to remove the default (see top post) or switch the default to lz4.

Pro remove:
- makes people read the docs and be able to do an informed decision about what the best compression for their usecase is

Contra remove:
- is a bit of a pain, `--compression X` needs to be always specified (interactive use, unit tests, ...)

Pro lz4:
- lz4 is super fast, often it saves more time (because needing to transfer/store less) than it needs time for compressing.
- lz4 also deals ok with already compressed data.

Contra lz4:
- if we do the decision by defining it as default, people won't necessarily decide about the best compression for their use case but just use the default (which is not the best for every use case).
Thumbs up here for "removing the default".
Thumbs up here for "lz4 as default".
> Contra remove:
>
>   is a bit of a pain, --compression X needs to be always specified (interactive use, unit tests, ...)

I think that initializing new repositories is not done often, so it's a very minor annoyance, as is having to choose a value for --encryption.

Edit: Never mind, I forgot about the possibility of using different compression methods for each archive. It's a different situation from --encryption.
I think having some default compression level (lz4 or zlib) is the right choice.  Having to specify it every time a backup is done is annoying, and for most regular users, one of those two will be fine.  Just like we don't force people to read up on chunker parameters and set them, we can allow those who care to read the docs and adjust as needed.

(As a separate issue, I think it might be good to allow a per-repo default to be specified at repo creation time.)
Since I use a cron job -> wrapper script for my backups (and I kind of feel borg is ment to be scripted) I see the removal of a default as a non issue to everyday use, with some positives (which you already listed).
I vote having a compression as default however removing the default is still better than how it is currently.
ok, looks like lz4 as default compression is much more welcome (than having no default), so we'll take that.

Resolving patch:
diff --git a/src/borg/archiver.py b/src/borg/archiver.py
--- a/src/borg/archiver.py
+++ b/src/borg/archiver.py
@@ -1629,17 +1629,17 @@ def do_break_lock(self, args, repository):
             borg create /path/to/repo::{hostname}-{now:%Y-%m-%d_%H:%M:%S} ...
             borg prune --prefix '{hostname}-' ...\n\n''')
     helptext['compression'] = textwrap.dedent('''
-        Compression is off by default, if you want some, you have to specify what you want.
+        Compression is lz4 by default. If you want something else, you have to specify what you want.
 
         Valid compression specifiers are:
 
         none
 
-            Do not compress. (default)
+            Do not compress.
 
         lz4
 
-            Use lz4 compression. High speed, low compression.
+            Use lz4 compression. High speed, low compression. (default)
 
         zlib[,L]
 
@@ -2276,7 +2276,7 @@ def process_epilog(epilog):
                                    help='specify the chunker parameters (CHUNK_MIN_EXP, CHUNK_MAX_EXP, '
                                         'HASH_MASK_BITS, HASH_WINDOW_SIZE). default: %d,%d,%d,%d' % CHUNKER_PARAMS)
         archive_group.add_argument('-C', '--compression', dest='compression',
-                                   type=CompressionSpec, default=dict(name='none'), metavar='COMPRESSION',
+                                   type=CompressionSpec, default=dict(name='lz4'), metavar='COMPRESSION',
                                    help='select compression algorithm, see the output of the '
                                         '"borg help compression" command for details.')
         archive_group.add_argument('--compression-from', dest='compression_files',
diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py
--- a/src/borg/testsuite/archiver.py
+++ b/src/borg/testsuite/archiver.py
@@ -262,7 +262,7 @@ def cmd(self, *args, **kw):
         return output
 
     def create_src_archive(self, name):
-        self.cmd('create', self.repository_location + '::' + name, src_dir)
+        self.cmd('create', '--compression=none', self.repository_location + '::' + name, src_dir)
 
     def open_archive(self, name):
         repository = Repository(self.repository_path, exclusive=True)


Test patch: