From 07d4946432df35947e5391f724ea1599010d30b7 Mon Sep 17 00:00:00 2001 From: timeshifter Date: Wed, 5 Jan 2022 13:37:27 +0100 Subject: [PATCH] fix: dont send if start == end --- zfs_backup.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/zfs_backup.py b/zfs_backup.py index d397225..ac6d2bc 100755 --- a/zfs_backup.py +++ b/zfs_backup.py @@ -66,6 +66,8 @@ class Manager: stream = self._send_absolute(local_dataset) else: stream = self._send_incremental(local_dataset, remote_dataset) + if stream is None: + continue ZFS.receive(stream, self._external_pool) def _get_user_filtered_dataset_backup_map(self) -> _map_type: @@ -97,12 +99,14 @@ class Manager: def _send_incremental( self, local_dataset: Dataset, remote_dataset: Dataset - ) -> Popen: + ) -> Popen | None: """Send incremental stream between two datasets to remote.""" start_snapshot = self._get_newest_common_snapshot_with_backup_tags( local_dataset, remote_dataset ) end_snapshot = self._get_newest_snapshot_with_backup_tag(local_dataset) + if start_snapshot == end_snapshot: + return None stream = ZFS.send_incremental(start_snapshot, end_snapshot) return stream @@ -742,6 +746,9 @@ class Snapshot: def __repr__(self): return str(self._path) + def __eq__(self, other: ZFSPath): + return self._path == other._path + def newer_than(self, other: Snapshot) -> bool: return self > other