1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-16 00:04:40 +00:00

bisync: generate listings concurrently with march -- fixes #7332

Before this change, bisync needed to build a full listing for Path1, then a
full listing for Path2, then compare them -- and each of those tasks needed to
finish before the next one could start. In addition to being slow and
inefficient, it also caused real problems if a file changed between the time
bisync checked it on Path1 and the time it checked the corresponding file on
Path2.

This change solves these problems by listing both paths concurrently, using
the same March infrastructure that check and sync use to traverse two
directories in lock-step, optimized by Go's robust concurrency support.
Listings should now be much faster, and any given path is now checked
nearly-instantaneously on both sides, minimizing room for error.

Further discussion:
https://forum.rclone.org/t/bisync-bugs-and-feature-requests/37636#:~:text=4.%20Listings%20should%20alternate%20between%20paths%20to%20minimize%20errors
This commit is contained in:
nielash
2023-10-07 06:33:43 -04:00
parent 0cac5d67ab
commit fd95511091
27 changed files with 319 additions and 108 deletions

View File

@@ -16,6 +16,7 @@ INFO : Bisync successful
(07) : test sync should pass
(08) : bisync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File is newer - file1.copy1.txt
INFO : - Path1 File is newer - file1.copy2.txt
@@ -46,6 +47,7 @@ INFO : Bisync successful
(12) : test sync should fail
(13) : bisync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File is newer - RCLONE_TEST
INFO : - Path1 File is OLDER - file1.copy1.txt
@@ -64,6 +66,7 @@ Bisync error: all files were changed
(14) : test sync with force should pass
(15) : bisync force
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File is newer - RCLONE_TEST
INFO : - Path1 File is OLDER - file1.copy1.txt

View File

@@ -17,6 +17,7 @@ INFO : Bisync successful
(07) : test bisync run
(08) : bisync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File is newer - subdir/file20.txt
INFO : Path1: 1 changes: 0 new, 1 newer, 0 older, 0 deleted

View File

@@ -49,6 +49,7 @@ INFO : Bisync successful
(31) : test bisync run
(32) : bisync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File is newer - file2.txt
INFO : - Path1 File was deleted - file4.txt

View File

@@ -12,6 +12,7 @@ INFO : Bisync successful
(04) : test 1. see that check-access passes with the initial setup
(05) : bisync check-access
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : Checking access health
@@ -25,6 +26,7 @@ INFO : Bisync successful
(07) : delete-file {path2/}subdir/RCLONE_TEST
(08) : bisync check-access
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : - Path2 File was deleted - subdir/RCLONE_TEST
@@ -49,6 +51,7 @@ INFO : Bisync successful
(13) : test 4. run sync with check-access. should pass.
(14) : bisync check-access
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : Checking access health
@@ -62,6 +65,7 @@ INFO : Bisync successful
(16) : delete-file {path1/}RCLONE_TEST
(17) : bisync check-access
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File was deleted - RCLONE_TEST
INFO : Path1: 1 changes: 0 new, 0 newer, 0 older, 1 deleted
@@ -95,6 +99,7 @@ INFO : Bisync successful
(24) : test 8. run sync with --check-access. should pass.
(25) : bisync check-access
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : Checking access health

View File

@@ -18,6 +18,7 @@ INFO : Bisync successful
(07) : bisync check-access filters-file={workdir/}exclude-other-filtersfile.txt
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Using filters file {workdir/}exclude-other-filtersfile.txt
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : Checking access health
@@ -38,6 +39,7 @@ INFO : Bisync successful
(15) : bisync check-access filters-file={workdir/}exclude-other-filtersfile.txt
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Using filters file {workdir/}exclude-other-filtersfile.txt
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : Checking access health
@@ -56,6 +58,7 @@ INFO : Bisync successful
(21) : bisync check-access filters-file={workdir/}exclude-other-filtersfile.txt
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Using filters file {workdir/}exclude-other-filtersfile.txt
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File was deleted - subdir/RCLONE_TEST
INFO : Path1: 1 changes: 0 new, 0 newer, 0 older, 1 deleted
@@ -88,6 +91,7 @@ INFO : Bisync successful
(30) : bisync check-access filters-file={workdir/}include-other-filtersfile.txt
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Using filters file {workdir/}include-other-filtersfile.txt
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : Checking access health
@@ -107,6 +111,7 @@ INFO : Bisync successful
(37) : bisync check-access filters-file={workdir/}include-other-filtersfile.txt
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Using filters file {workdir/}include-other-filtersfile.txt
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : Checking access health
@@ -126,6 +131,7 @@ INFO : Bisync successful
(44) : bisync check-access filters-file={workdir/}include-other-filtersfile.txt
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Using filters file {workdir/}include-other-filtersfile.txt
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File was deleted - subdir/RCLONE_TEST
INFO : - Path1 File was deleted - subdirX/subdirX1/RCLONE_TEST
@@ -136,8 +142,8 @@ INFO : Path2: 1 changes: 0 new, 0 newer, 0 older, 1 deleted
INFO : Checking access health
ERROR : Access test failed: Path1 count 3, Path2 count 4 - RCLONE_TEST
ERROR : -  Access test failed: Path1 file not found in Path2 - RCLONE_TEST
ERROR : -  Access test failed: Path2 file not found in Path1 - subdirX/subdirX1/RCLONE_TEST
ERROR : -  Access test failed: Path2 file not found in Path1 - subdir/RCLONE_TEST
ERROR : -  Access test failed: Path2 file not found in Path1 - subdirX/subdirX1/RCLONE_TEST
ERROR : Bisync critical error: check file check failed
ERROR : Bisync aborted. Must run --resync to recover.
Bisync error: bisync aborted

View File

@@ -12,6 +12,7 @@ INFO : Bisync successful
(04) : test 1. see that check-access passes with the initial setup
(05) : bisync check-access check-filename=.chk_file
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : Checking access health
@@ -26,6 +27,7 @@ INFO : Bisync successful
(08) : delete-file {path2/}subdir/.chk_file
(09) : bisync check-access check-filename=.chk_file
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : - Path2 File was deleted - subdir/.chk_file
@@ -52,6 +54,7 @@ INFO : Bisync successful
(14) : test 4. run sync with check-access. should pass.
(15) : bisync check-access check-filename=.chk_file
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : Checking access health

View File

@@ -51,6 +51,7 @@ INFO : Bisync successful
(20) : test 7. run normal sync with check-sync enabled (default)
(21) : bisync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : No changes found
@@ -61,6 +62,7 @@ INFO : Bisync successful
(22) : test 8. run normal sync with no-check-sync
(23) : bisync no-check-sync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : No changes found

View File

@@ -24,6 +24,7 @@ INFO : Bisync successful
(15) : test 2. Run bisync without --create-empty-src-dirs
(16) : bisync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : No changes found
@@ -39,6 +40,7 @@ subdir/
(20) : test 4.Run bisync WITH --create-empty-src-dirs
(21) : bisync create-empty-src-dirs
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File is new - subdir
INFO : Path1: 1 changes: 1 new, 0 newer, 0 older, 0 deleted
@@ -68,6 +70,7 @@ subdir/
(33) : test 7. Run bisync without --create-empty-src-dirs
(34) : bisync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File was deleted - RCLONE_TEST
INFO : - Path1 File was deleted - subdir
@@ -115,6 +118,7 @@ subdir/
(51) : bisync create-empty-src-dirs
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File was deleted - subdir
INFO : Path1: 1 changes: 0 new, 0 newer, 0 older, 1 deleted
@@ -134,6 +138,7 @@ INFO : Bisync successful
(55) : test 11. bisync again (because if we leave subdir in listings, test will fail due to mismatched modtime)
(56) : bisync create-empty-src-dirs
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : No changes found

View File

@@ -66,6 +66,7 @@ INFO : Bisync successful
(30) : test sync with dry-run
(31) : bisync dry-run
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File is newer - file2.txt
INFO : - Path1 File was deleted - file4.txt
@@ -120,6 +121,7 @@ INFO : Bisync successful
(33) : test sync without dry-run
(34) : bisync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File is newer - file2.txt
INFO : - Path1 File was deleted - file4.txt

View File

@@ -23,6 +23,7 @@ INFO : Bisync successful
(13) : test bisync run
(14) : bisync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File is newer - file1.txt
INFO : - Path1 File is newer - file2.txt

View File

@@ -19,6 +19,7 @@ INFO : Bisync successful
(09) : test normal sync of subdirs with extended chars
(10) : bisync subdir=測試_Русский_{spc}_{spc}_ě_áñ
INFO : Synching Path1 "{path1/}測試_Русский_ _ _ě_áñ/" with Path2 "{path2/}測試_Русский_ _ _ě_áñ/"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File is new - 測試_file1p1
INFO : Path1: 1 changes: 1 new, 0 newer, 0 older, 0 deleted
@@ -45,6 +46,7 @@ INFO : Bisync successful
(14) : delete-file {path1/}測試_Русский_{spc}_{spc}_ě_áñ/測試_check{spc}file
(15) : bisync check-access check-filename=測試_check{spc}file
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File was deleted - 測試_Русский_ _ _ě_áñ/測試_check file
INFO : Path1: 1 changes: 0 new, 0 newer, 0 older, 1 deleted
@@ -68,6 +70,7 @@ INFO : Resync updating listings
INFO : Bisync successful
(19) : bisync check-access check-filename=測試_check{spc}file
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : Checking access health
@@ -92,6 +95,7 @@ INFO : Bisync successful
(25) : bisync filters-file={workdir/}測試_filtersfile.txt
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Using filters file {workdir/}測試_filtersfile.txt
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : No changes found

View File

@@ -38,6 +38,7 @@ INFO : Bisync successful
(26) : test bisync run
(27) : bisync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File was deleted - Русский.txt
INFO : - Path1 File is new - file1_with white space.txt

View File

@@ -24,6 +24,7 @@ INFO : Bisync successful
(11) : bisync filters-file={workdir/}filtersfile.flt
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Using filters file {workdir/}filtersfile.flt
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File is new - subdir/fileZ.txt
INFO : Path1: 1 changes: 1 new, 0 newer, 0 older, 0 deleted

View File

@@ -41,6 +41,7 @@ INFO : Bisync successful
(13) : bisync filters-file={workdir/}filtersfile.txt
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Using filters file {workdir/}filtersfile.txt
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : No changes found

View File

@@ -23,6 +23,7 @@ INFO : Bisync successful
(08) : test bisync run
(09) : bisync ignore-listing-checksum
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File is newer - subdir/file20.txt
INFO : Path1: 1 changes: 0 new, 1 newer, 0 older, 0 deleted

View File

@@ -19,6 +19,7 @@ INFO : Bisync successful
(10) : test sync should fail due to too many local deletes
(11) : bisync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File was deleted - file1.txt
INFO : - Path1 File was deleted - file2.txt
@@ -35,6 +36,7 @@ Bisync error: too many deletes
(13) : test change max-delete limit to 60%. sync should run.
(14) : bisync max-delete=60
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File was deleted - file1.txt
INFO : - Path1 File was deleted - file2.txt

View File

@@ -19,6 +19,7 @@ INFO : Bisync successful
(10) : test sync should fail due to too many path2 deletes
(11) : bisync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : - Path2 File was deleted - file1.txt
@@ -35,6 +36,7 @@ Bisync error: too many deletes
(13) : test apply force option. sync should run.
(14) : bisync force
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : - Path2 File was deleted - file1.txt

View File

@@ -23,6 +23,7 @@ INFO : Bisync successful
(10) : test run bisync with custom options
(11) : bisync size-only
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File is newer - file1.txt
INFO : - Path1 File is newer - subdir/file20.txt

View File

@@ -72,6 +72,7 @@ INFO : Bisync successful
(32) : test run normal bisync
(33) : bisync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : No changes found
@@ -83,6 +84,7 @@ INFO : Bisync successful
(35) : purge-children {path2/}
(36) : bisync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
ERROR : Empty current Path2 listing. Cannot sync to an empty directory: {workdir/}{session}.path2.lst-new

View File

@@ -15,6 +15,7 @@ INFO : Bisync successful
(06) : test 2. run bisync without remove-empty-dirs
(07) : bisync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File was deleted - subdir/file20.txt
INFO : Path1: 1 changes: 0 new, 0 newer, 0 older, 1 deleted
@@ -35,6 +36,7 @@ subdir/
(11) : test 4. run bisync with remove-empty-dirs
(12) : bisync remove-empty-dirs
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : Path2 checking for diffs
INFO : No changes found

View File

@@ -18,6 +18,7 @@ INFO : Bisync successful
(10) : test-func
(11) : bisync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File is newer - file5.txt
INFO : Path1: 1 changes: 0 new, 1 newer, 0 older, 0 deleted
@@ -51,6 +52,7 @@ INFO : Bisync successful
(18) : test-func
(19) : bisync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File is new - file100.txt
INFO : - Path1 File is new - file5.txt
@@ -268,6 +270,7 @@ INFO : Bisync successful
(26) : test-func
(27) : bisync
INFO : Synching Path1 "{path1/}" with Path2 "{path2/}"
INFO : Building Path1 and Path2 listings
INFO : Path1 checking for diffs
INFO : - Path1 File is new - file5.txt
INFO : Path1: 1 changes: 1 new, 0 newer, 0 older, 0 deleted