Skip to content

rclone sync to GPhotos backend behavior is unpredictable #3744

Open

Description

@sergey-brutsky

What is the problem you are having with rclone?

I have 4 files in the source directory.

ls -l /share/Photos/test1/
-rw-rw----    1 sir_j    everyone   2195171 Nov 17 16:33 IMG_0585.jpg
-rw-rw----    1 sir_j    everyone   3222491 Nov 17 16:34 IMG_0589.jpg
-rw-rw----    1 sir_j    everyone   1766089 Nov 17 16:34 IMG_0857.jpg
-rw-rw----    1 sir_j    everyone   1826124 Nov 17 16:33 IMG_0861.jpg

First run of rclone sync command actually uploads 4 files to gphotos backend
Second and other runs show me that it's gonna copy 2 files and then delete 2 files (why?)
Expected behavior is that second and other runs should actually do nothing, because there was no changes in the source directory

What is your rclone version (output from rclone version)

rclone version
rclone v1.50.1

  • os/arch: linux/arm
  • go version: go1.13.4

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Linux QNAP 4.2.8 #2 SMP Fri Oct 25 05:27:36 CST 2019 armv7l GNU/Linux

Which cloud storage system are you using? (eg Google Drive)

Google Photos

The command you were trying to run (eg rclone copy /tmp remote:tmp)

/usr/bin/rclone sync  "/share/Photos/test1" "gphoto:album/backups/test1" -v -n
2019/11/17 16:45:54 NOTICE: IMG_0585.jpg: Not copying as --dry-run
2019/11/17 16:45:54 NOTICE: IMG_0589.jpg: Not copying as --dry-run
2019/11/17 16:45:54 INFO  : Google Photos path "album/backups/test1": Waiting for checks to finish
2019/11/17 16:45:54 INFO  : Google Photos path "album/backups/test1": Waiting for transfers to finish
2019/11/17 16:45:54 INFO  : Waiting for deletions to finish
2019/11/17 16:45:54 NOTICE: IMG_0589.JPG: Not deleting as --dry-run
2019/11/17 16:45:54 NOTICE: IMG_0585.JPG: Not deleting as --dry-run
2019/11/17 16:45:54 INFO  : 
Transferred:   	         0 / 0 Bytes, -, 0 Bytes/s, ETA -
Errors:                 0
Checks:                 4 / 4, 100%
Transferred:            2 / 2, 100%
Elapsed time:          0s

A log from the command with the -vv flag (eg output from rclone -vv copy /tmp remote:tmp)

/usr/bin/rclone sync  "/share/Photos/test1" "gphoto:album/backups/test1" -vv -n
2019/11/17 16:46:21 DEBUG : rclone: Version "v1.50.1" starting with parameters ["/usr/bin/rclone" "sync" "/share/Photos/test1" "gphoto:album/backups/test1" "-vv" "-n"]
2019/11/17 16:46:21 DEBUG : Using config file from "/share/homes/admin/.config/rclone/rclone.conf"
2019/11/17 16:46:21 DEBUG : Google Photos path "album/backups": NewObject: remote="test1"
2019/11/17 16:46:21 DEBUG : Google Photos path "album/backups": List: dir=""
2019/11/17 16:46:41 DEBUG : Google Photos path "album/backups": >List: err=<nil>
2019/11/17 16:46:41 DEBUG : Google Photos path "album/backups": >NewObject: 
2019/11/17 16:46:41 DEBUG : Google Photos path "album/backups/test1": List: dir=""
2019/11/17 16:46:42 DEBUG : Google Photos path "album/backups/test1": >List: err=<nil>
2019/11/17 16:46:42 DEBUG : IMG_0585.JPG: Size: 
2019/11/17 16:46:42 DEBUG : IMG_0585.JPG: >Size: 
2019/11/17 16:46:42 DEBUG : IMG_0589.JPG: Size: 
2019/11/17 16:46:42 DEBUG : IMG_0589.JPG: >Size: 
2019/11/17 16:46:42 DEBUG : IMG_0857.jpg: Size: 
2019/11/17 16:46:42 DEBUG : IMG_0857.jpg: >Size: 
2019/11/17 16:46:42 DEBUG : IMG_0861.jpg: Size: 
2019/11/17 16:46:42 DEBUG : IMG_0861.jpg: >Size: 
2019/11/17 16:46:42 NOTICE: IMG_0589.jpg: Not copying as --dry-run
2019/11/17 16:46:42 NOTICE: IMG_0585.jpg: Not copying as --dry-run
2019/11/17 16:46:42 DEBUG : IMG_0857.jpg: Size: 
2019/11/17 16:46:42 DEBUG : IMG_0857.jpg: >Size: 
2019/11/17 16:46:42 DEBUG : IMG_0861.jpg: Size: 
2019/11/17 16:46:42 DEBUG : IMG_0861.jpg: >Size: 
2019/11/17 16:46:42 INFO  : Google Photos path "album/backups/test1": Waiting for checks to finish
2019/11/17 16:46:42 DEBUG : IMG_0857.jpg: Sizes identical
2019/11/17 16:46:42 DEBUG : IMG_0857.jpg: Unchanged skipping
2019/11/17 16:46:42 DEBUG : IMG_0861.jpg: Sizes identical
2019/11/17 16:46:42 DEBUG : IMG_0861.jpg: Unchanged skipping
2019/11/17 16:46:42 INFO  : Google Photos path "album/backups/test1": Waiting for transfers to finish
2019/11/17 16:46:42 INFO  : Waiting for deletions to finish
2019/11/17 16:46:42 DEBUG : IMG_0585.JPG: Size: 
2019/11/17 16:46:42 DEBUG : IMG_0585.JPG: >Size: 
2019/11/17 16:46:42 NOTICE: IMG_0585.JPG: Not deleting as --dry-run
2019/11/17 16:46:42 DEBUG : IMG_0589.JPG: Size: 
2019/11/17 16:46:42 DEBUG : IMG_0589.JPG: >Size: 
2019/11/17 16:46:42 NOTICE: IMG_0589.JPG: Not deleting as --dry-run
2019/11/17 16:46:42 INFO  : 
Transferred:   	         0 / 0 Bytes, -, 0 Bytes/s, ETA -
Errors:                 0
Checks:                 4 / 4, 100%
Transferred:            2 / 2, 100%
Elapsed time:          0s

2019/11/17 16:46:42 DEBUG : 4 go routines active
2019/11/17 16:46:42 DEBUG : rclone: Version "v1.50.1" finishing with parameters ["/usr/bin/rclone" "sync" "/share/Photos/test1" "gphoto:album/backups/test1" "-vv" "-n"]

Activity

  1. ncw commented on Nov 17, 2019

    @ncw
    Member

    I tried to replicate this but I couldn't.

    What do you get if you do rclone lsf gphoto:album/backups/test1 does it show the 4 files?

    I wonder if you have a duplicate there which has {id} appended onto it - that would probably explain the symptoms.

  2. sergey-brutsky commented on Nov 17, 2019

    @sergey-brutsky
    Author

    After a lot of experiments I found the root cause of the issue.
    The problem is that Google Photos doesn't have such domain object as "folder" they operate just with photos and tags.

    Let's consider the following situation:
    There is a folder let's say "test1" it contains 2 files a.jpg and b.jpg
    And we successfully synced this folder to gphoto:albums/test1 folder (this is not true, this is just a tag)
    Now we decided to create another folder "test2" and copied to this folder files a.jpg and b.jpg from folder "test1"
    Now in the folder "test2" we renamed a.jpg to aaa.jpg
    And we are trying to run rclone sync test2 to gphoto:albums/test2
    Google Photos somehow detects that aaa.jpg is actually a.jpg and after syncing in remote backend
    we will have a.jpg and b.jpg instead of aaa.jpg and b.jpg

    And this leads to the problems with syncing, because rclone tries to sync files aaa.jpg and b.jpg but actually it sees in remote files a.jpg and b.jpg so it will try to remove a.jpg and upload aaa.jpg everytime we run sync process.

    @ncw could you please advise any fix for this behavior ?

  3. added this to the v1.51 milestone on Nov 20, 2019
  4. ncw commented on Nov 20, 2019

    @ncw
    Member

    Wow! I think I'd noticed that during testing but somehow erased it from my mind...

    could you please advise any fix for this behavior ?

    What would you think if rclone added metadata to the description of the photo?

    I wonder if adding a different description to the photo would cause it to be de-duplicated... no is the answer to that question (I just tried).

    I guess rclone could adjust the description with the name mapping for the new album... no that won't work - there is no api for changing the description of an image.

    Rclone could certainly notice that the filename it uploaded was different to the filename received back after the upload so there is an opportunity to do something, I'm just not sure what... At minimum rclone could emit a warning.

    rclone could store the renamed image mappings locally in a cache. This will go very wrong on a new computer so I'm not a big fan of this.

    There are some other things like enrichments which can be added to albums but you don't seem to be able to read them back via the API.

    Any other ideas?

  5. sergey-brutsky commented on Nov 20, 2019

    @sergey-brutsky
    Author

    From my perspective the most convinient way to mitigate this is to emit a warning like
    You tried to upoad file aaa.jpg but it looks like this file was already uploaded as a.jpg

    And in the ideal case rclone could introduce a new gphoto flag like --rename-local-file-after-syncing-to-gphoto.
    So my local file names are in sync with remote file names and sync command will work as expected.

    Does it makes sense ?

  6. modified the milestones: v1.51, v1.52 on Feb 1, 2020
  7. modified the milestones: v1.52, v1.53 on May 29, 2020
  8. modified the milestones: v1.53, v1.54 on Sep 5, 2020
  9. modified the milestones: v1.54, v1.55 on Feb 3, 2021
  10. modified the milestones: v1.55, v1.56 on Apr 3, 2021
  11. modified the milestones: v1.56, v1.57 on Jul 20, 2021
  12. modified the milestones: v1.57, Known Problem on Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions