From fbed322d3bd8505e98d5a3b6a60a8163d04ce242 Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 7 Dec 2022 21:35:04 +0000 Subject: [PATCH] option to skip database syncs entirely --- copyparty/__main__.py | 3 +++ copyparty/authsrv.py | 1 + copyparty/up2k.py | 3 +++ copyparty/util.py | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 0fd20cc9..3463a037 100755 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -542,6 +542,8 @@ def run_argparse( \033[36mnoforget$\033[35m don't forget files when deleted from disk \033[36mnowal\033[35m guarantee zero dataloss on powerloss by disabling wal \033[36mwal\033[35m enable wal (default; overrides --no-wal) + \033[36mnosync\033[35m switch to unsafe mode for extremely fast uploads + \033[36msync\033[35m normal corruption-protected db config \033[36mxlink$\033[35m cross-volume dupe detection / linking \033[36mxdev\033[35m do not descend into other filesystems \033[36mxvol\033[35m skip symlinks leaving the volume root @@ -816,6 +818,7 @@ def run_argparse( ap2.add_argument("--no-dhash", action="store_true", help="disable rescan acceleration; do full database integrity check -- makes the db ~5%% smaller and bootup/rescans 3~10x slower") ap2.add_argument("--no-forget", action="store_true", help="never forget indexed files, even when deleted from disk -- makes it impossible to ever upload the same file twice (volflag=noforget)") ap2.add_argument("--no-wal", action="store_true", help="1%% faster searches, more reliable upload performance, and slightly more resistant to dataloss, but makes uploads up to 2x slower (volflag=nowal)") + ap2.add_argument("--no-sync", action="store_true", help="make uploads extremely fast, but removes corruption protection -- if the OS crashes, you might lose the db (volflag=nosync)") ap2.add_argument("--xlink", action="store_true", help="on upload: check all volumes for dupes, not just the target volume (volflag=xlink)") ap2.add_argument("--xdev", action="store_true", help="do not descend into other filesystems (symlink or bind-mount to another HDD, ...) (volflag=xdev)") ap2.add_argument("--xvol", action="store_true", help="skip symlinks leaving the volume root (volflag=xvol)") diff --git a/copyparty/authsrv.py b/copyparty/authsrv.py index b0c21eb5..03ed41f5 100644 --- a/copyparty/authsrv.py +++ b/copyparty/authsrv.py @@ -1124,6 +1124,7 @@ class AuthSrv(object): ("no_forget", "noforget"), ("no_dupe", "nodupe"), ("no_wal", "nowal"), + ("no_sync", "nosync"), ("magic", "magic"), ("xlink", "xlink"), ): diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 0841d213..1dc03b0e 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -666,6 +666,9 @@ class Up2k(object): except: pass + if "nosync" in flags: + cur.execute("pragma synchronous=0") + return cur, db_path except: msg = "cannot use database at [{}]:\n{}" diff --git a/copyparty/util.py b/copyparty/util.py index 74da7efe..f3b9f33b 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -202,7 +202,7 @@ if ANYWIN: UNPLICATIONS = [["no_dav", "daw"]] -DROPLICATIONS = [["wal", "nowal"]] +DROPLICATIONS = [["wal", "nowal"], ["sync", "nosync"]] MIMES = {