mirror of
https://github.com/psy0rz/zfs_autobackup.git
synced 2025-06-01 01:20:58 +03:00
cleaned up debug output.
This commit is contained in:
parent
01f0078ccf
commit
e33e47c10c
@ -393,6 +393,8 @@ To be bold I created 2500 datasets, but that also was no problem. So it seems it
|
|||||||
|
|
||||||
If you need more performance let me know.
|
If you need more performance let me know.
|
||||||
|
|
||||||
|
NOTE: The is actually a performance regression in ZFS versions 2: https://github.com/openzfs/zfs/issues/11560 (I commented out line 1652: '# args.progress = True' as temporary workaround)
|
||||||
|
|
||||||
#### Less work
|
#### Less work
|
||||||
|
|
||||||
You can make zfs-autobackup generate less work by using --no-holds and --allow-empty.
|
You can make zfs-autobackup generate less work by using --no-holds and --allow-empty.
|
||||||
|
@ -660,7 +660,7 @@ class ZfsDataset:
|
|||||||
Use force to force a specific value to be cached, if you already know. Useful for performance reasons"""
|
Use force to force a specific value to be cached, if you already know. Useful for performance reasons"""
|
||||||
|
|
||||||
if self.force_exists is not None:
|
if self.force_exists is not None:
|
||||||
self.debug("Checking if filesystem exists: forced to {}".format(self.force_exists))
|
self.debug("Checking if filesystem exists: was forced to {}".format(self.force_exists))
|
||||||
return self.force_exists
|
return self.force_exists
|
||||||
else:
|
else:
|
||||||
self.debug("Checking if filesystem exists")
|
self.debug("Checking if filesystem exists")
|
||||||
@ -701,7 +701,6 @@ class ZfsDataset:
|
|||||||
@CachedProperty
|
@CachedProperty
|
||||||
def properties(self):
|
def properties(self):
|
||||||
"""all zfs properties"""
|
"""all zfs properties"""
|
||||||
self.debug("Getting zfs properties")
|
|
||||||
|
|
||||||
cmd = [
|
cmd = [
|
||||||
"zfs", "get", "-H", "-o", "property,value", "-p", "all", self.name
|
"zfs", "get", "-H", "-o", "property,value", "-p", "all", self.name
|
||||||
@ -710,8 +709,9 @@ class ZfsDataset:
|
|||||||
if not self.exists:
|
if not self.exists:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
ret = {}
|
self.debug("Getting zfs properties")
|
||||||
|
|
||||||
|
ret = {}
|
||||||
for pair in self.zfs_node.run(tab_split=True, cmd=cmd, readonly=True, valid_exitcodes=[0]):
|
for pair in self.zfs_node.run(tab_split=True, cmd=cmd, readonly=True, valid_exitcodes=[0]):
|
||||||
if len(pair) == 2:
|
if len(pair) == 2:
|
||||||
ret[pair[0]] = pair[1]
|
ret[pair[0]] = pair[1]
|
||||||
@ -800,11 +800,12 @@ class ZfsDataset:
|
|||||||
def snapshots(self):
|
def snapshots(self):
|
||||||
"""get all snapshots of this dataset"""
|
"""get all snapshots of this dataset"""
|
||||||
|
|
||||||
self.debug("Getting snapshots")
|
|
||||||
|
|
||||||
if not self.exists:
|
if not self.exists:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
self.debug("Getting snapshots")
|
||||||
|
|
||||||
cmd = [
|
cmd = [
|
||||||
"zfs", "list", "-d", "1", "-r", "-t", "snapshot", "-H", "-o", "name", self.name
|
"zfs", "list", "-d", "1", "-r", "-t", "snapshot", "-H", "-o", "name", self.name
|
||||||
]
|
]
|
||||||
@ -854,10 +855,10 @@ class ZfsDataset:
|
|||||||
@CachedProperty
|
@CachedProperty
|
||||||
def written_since_ours(self):
|
def written_since_ours(self):
|
||||||
"""get number of bytes written since our last snapshot"""
|
"""get number of bytes written since our last snapshot"""
|
||||||
self.debug("Getting bytes written since our last snapshot")
|
|
||||||
|
|
||||||
latest_snapshot = self.our_snapshots[-1]
|
latest_snapshot = self.our_snapshots[-1]
|
||||||
|
|
||||||
|
self.debug("Getting bytes written since our last snapshot")
|
||||||
cmd = ["zfs", "get", "-H", "-ovalue", "-p", "written@" + str(latest_snapshot), self.name]
|
cmd = ["zfs", "get", "-H", "-ovalue", "-p", "written@" + str(latest_snapshot), self.name]
|
||||||
|
|
||||||
output = self.zfs_node.run(readonly=True, tab_split=False, cmd=cmd, valid_exitcodes=[0])
|
output = self.zfs_node.run(readonly=True, tab_split=False, cmd=cmd, valid_exitcodes=[0])
|
||||||
@ -936,7 +937,7 @@ class ZfsDataset:
|
|||||||
|
|
||||||
# progress output
|
# progress output
|
||||||
if show_progress:
|
if show_progress:
|
||||||
# cmd.append("-v")
|
cmd.append("-v")
|
||||||
cmd.append("-P")
|
cmd.append("-P")
|
||||||
|
|
||||||
# resume a previous send? (don't need more parameters in that case)
|
# resume a previous send? (don't need more parameters in that case)
|
||||||
@ -1057,10 +1058,10 @@ class ZfsDataset:
|
|||||||
|
|
||||||
def rollback(self):
|
def rollback(self):
|
||||||
"""rollback to latest existing snapshot on this dataset"""
|
"""rollback to latest existing snapshot on this dataset"""
|
||||||
self.debug("Rolling back")
|
|
||||||
|
|
||||||
for snapshot in reversed(self.snapshots):
|
for snapshot in reversed(self.snapshots):
|
||||||
if snapshot.exists:
|
if snapshot.exists:
|
||||||
|
self.debug("Rolling back")
|
||||||
self.zfs_node.run(["zfs", "rollback", snapshot.name])
|
self.zfs_node.run(["zfs", "rollback", snapshot.name])
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -1210,8 +1211,8 @@ class ZfsDataset:
|
|||||||
source_snapshot = self.find_next_snapshot(source_snapshot, other_snapshots)
|
source_snapshot = self.find_next_snapshot(source_snapshot, other_snapshots)
|
||||||
|
|
||||||
# now let thinner decide what we want on both sides as final state (after all transfers are done)
|
# now let thinner decide what we want on both sides as final state (after all transfers are done)
|
||||||
self.debug("Create thinning list")
|
|
||||||
if self.our_snapshots:
|
if self.our_snapshots:
|
||||||
|
self.debug("Create thinning list")
|
||||||
(source_keeps, source_obsoletes) = self.thin_list(keeps=[self.our_snapshots[-1]])
|
(source_keeps, source_obsoletes) = self.thin_list(keeps=[self.our_snapshots[-1]])
|
||||||
else:
|
else:
|
||||||
source_obsoletes = []
|
source_obsoletes = []
|
||||||
@ -1473,7 +1474,7 @@ class ZfsNode(ExecuteNode):
|
|||||||
pools = {}
|
pools = {}
|
||||||
|
|
||||||
# collect snapshots that we want to make, per pool
|
# collect snapshots that we want to make, per pool
|
||||||
self.debug(datasets)
|
# self.debug(datasets)
|
||||||
for dataset in datasets:
|
for dataset in datasets:
|
||||||
if not dataset.is_changed_ours(min_changed_bytes):
|
if not dataset.is_changed_ours(min_changed_bytes):
|
||||||
dataset.verbose("No changes since {}".format(dataset.our_snapshots[-1].snapshot_name))
|
dataset.verbose("No changes since {}".format(dataset.our_snapshots[-1].snapshot_name))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user