AmesCornish / buttersink

Buttersink is like rsync for btrfs snapshots
GNU General Public License v3.0
195 stars 18 forks source link

Diffs are not calculated correctly #45

Closed ceremcem closed 6 years ago

ceremcem commented 7 years ago

I have two distinct subvolumes and I took about 15 snapshots per subvolume. First sizes are 40 GiB and 450 GiB accordingly.

When I take another snapshot, as only a few MiB of data is changed and first ones are kept, only the changes are sent. When I take another snapshot, everything goes in the same way.

Sometimes (like minutes ago) I took another snapshot and I expect only 100 MiB of data to be changed. But buttersink decides to send nearly every snapshot again. Weird side is that, not every snapshot is really being sent because even though progress output says "1.5 GiB is sent", my laptop's wifi card is not that fast (it reports +5 Gbps).

How can I debug this situation?

ceremcem commented 7 years ago

...and interrupting the synchronization causes following error:

Syncing /mnt/erik/snapshots
my path is /mnt/aea3/snapshots/
host: aea3 directory: /mnt/aea3/snapshots/
  Remote version: {u'btrfs': u'btrfs-progs v4.11', u'buttersink': u'0.6.8-9-ga2f6548', u'linux': u'Linux-4.9.0-2-amd64-x86_64-with-debian-9.0'}
  measured size (1.268 GiB), estimated size (1.268 GiB)
  Optimal synchronization:
  1.268 GiB from 1 diffs in btrfs /mnt/erik/snapshots
  522 GiB from 17 diffs in ssh://aea3/mnt/aea3/snapshots
  523.3 GiB from 18 diffs in TOTAL
  Keep: d97c...7137 /mnt/aea3/snapshots/rootfs/rootfs.20170525T0208 from None (30.6 GiB)
  Keep: e3cd...5cf6 /mnt/aea3/snapshots/rootfs/rootfs.20170524T1135 from None (30.57 GiB)
  Keep: d46c...22a4 /mnt/aea3/snapshots/rootfs/rootfs.20170524T0207 from None (30.71 GiB)
  Keep: a259...b4f4 /mnt/aea3/snapshots/rootfs/rootfs.20170524T0617 from None (30.72 GiB)
  Keep: 4654...1bf0 /mnt/aea3/snapshots/rootfs/rootfs.20170524T1924 from None (30.6 GiB)
  Keep: 8d26...25d3 /mnt/aea3/snapshots/rootfs/rootfs.20170525T1855 from None (31.07 GiB)
  Keep: 2685...6f48 /mnt/aea3/snapshots/rootfs/rootfs.20170524T0203 from None (30.71 GiB)
  Keep: 235e...c696 /mnt/aea3/snapshots/rootfs/rootfs.20170524T0202 from None (30.71 GiB)
  Keep: ce79...cc8f /mnt/aea3/snapshots/rootfs/rootfs.20170525T0725 from None (30.69 GiB)
  Keep: 5c68...defa /mnt/aea3/snapshots/rootfs/rootfs.20170525T0651 from None (30.61 GiB)
  Keep: 4834...8bf9 /mnt/aea3/snapshots/rootfs/rootfs.20170526T0150 from None (31.07 GiB)
  Keep: f63d...bbd8 /mnt/aea3/snapshots/rootfs/rootfs.20170522T1519 from None (30.61 GiB)
  Keep: c306...172f /mnt/aea3/snapshots/rootfs/rootfs.20170525T0708 from None (30.61 GiB)
  Keep: 918e...b50f /mnt/aea3/snapshots/rootfs/rootfs.20170524T0208 from None (30.71 GiB)
  Keep: 377b...b0bc /mnt/aea3/snapshots/rootfs/rootfs.20170524T0618 from None (30.72 GiB)
  Keep: ffec...bdd0 /mnt/aea3/snapshots/rootfs/rootfs.20170524T1844 from None (30.6 GiB)
  Keep: 7749...ac3e /mnt/aea3/snapshots/rootfs/rootfs.20170524T0158 from None (30.71 GiB)
  Xfer: b118...4dec /mnt/erik/snapshots/rootfs/rootfs.20170526T1708 from 4834...8bf9 /mnt/erik/snapshots/rootfs/rootfs.20170526T0150 (1.268 GiB)
  ERROR: {u'traceback': u'  File "build/bdist.linux-x86_64/egg/buttersink/ButterStore.py", line 179, in receive', u'errorType': u'Exception', u'command': u'receive', u'server': True, u'error': u"Path /mnt/aea3/snapshots/rootfs/rootfs.20170526T1708 exists, can't receive b118c47c-3128-fc40-8999-1da4c89c4dec"}.
AmesCornish commented 6 years ago

I'm not sure I fully understand the question. Generally, buttersink uses heuristics to decide whether to send an "incremental" diff based on the most recent snapshot. If you've been doing many incremental snapshots, then a corruption problem in any of these many snapshots would ruin the last one. Therefore buttersink tries to take a diff from an earlier, less fragile snapshot.

I think there's another ticket #50 ensure this logic is only used for S3 where it's relevant.

FYI, you can get additional info with the '--logfile' option.