Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Wolfgang Hoschek <[email protected]>
  • Loading branch information
whoschek committed Jan 7, 2025
1 parent beb37db commit 4075ebc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions bzfs/bzfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@ def __init__(
self.max_snapshots_per_minibatch_on_delete_snaps = int(
getenv_any("max_snapshots_per_minibatch_on_delete_snaps", 2**29)
)
self.dedicated_tcp_connection_per_zfssend = getenv_bool("dedicated_tcp_connection_per_zfssend", True)
self.dedicated_tcp_connection_per_zfs_send = getenv_bool("dedicated_tcp_connection_per_zfs_send", True)
self.threads: Tuple[int, bool] = args.threads
self.no_estimate_send_size: bool = args.no_estimate_send_size

Expand Down Expand Up @@ -1554,7 +1554,7 @@ def __init__(self):
self.max_exceptions_to_summarize = 10000
self.first_exception: Optional[BaseException] = None
self.remote_conf_cache: Dict[Tuple, RemoteConfCacheItem] = {}
self.dedicated_tcp_connection_per_zfssend: bool = True
self.dedicated_tcp_connection_per_zfs_send: bool = True
self.max_datasets_per_minibatch_on_list_snaps: Dict[str, int] = {}
self.max_workers: Dict[str, int] = {}
self.re_suffix = r"(?:/.*)?" # also match descendants of a matching dataset
Expand Down Expand Up @@ -1853,8 +1853,8 @@ def run_task(self) -> None:
if len(src_datasets) == 0:
die(f"Source dataset does not exist: {src.basis_root_dataset}")
selected_src_datasets = isorted(self.filter_datasets(src, src_datasets)) # apply include/exclude policy
self.dedicated_tcp_connection_per_zfssend = (
p.dedicated_tcp_connection_per_zfssend
self.dedicated_tcp_connection_per_zfs_send = (
p.dedicated_tcp_connection_per_zfs_send
and len(selected_src_datasets) > 1
and min(self.max_workers[p.src.location], self.max_workers[p.dst.location]) > 1
)
Expand Down Expand Up @@ -2429,7 +2429,7 @@ def run_zfs_send_receive(

src_pipe = self.squote(p.src, src_pipe)
dst_pipe = self.squote(p.dst, dst_pipe)
conn_pool_name = DEDICATED if self.dedicated_tcp_connection_per_zfssend else SHARED
conn_pool_name = DEDICATED if self.dedicated_tcp_connection_per_zfs_send else SHARED
src_conn_pool: ConnectionPool = p.connection_pools["src"].pool(conn_pool_name)
src_conn: Connection = src_conn_pool.get_connection()
dst_conn_pool: ConnectionPool = p.connection_pools["dst"].pool(conn_pool_name)
Expand Down
14 changes: 7 additions & 7 deletions bzfs_tests/test_integrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,14 +451,14 @@ def run_bzfs(
max_datasets_per_minibatch_on_list_snaps
)

old_dedicated_tcp_connection_per_zfssend = os.environ.get(
bzfs.env_var_prefix + "dedicated_tcp_connection_per_zfssend"
old_dedicated_tcp_connection_per_zfs_send = os.environ.get(
bzfs.env_var_prefix + "dedicated_tcp_connection_per_zfs_send"
)
if platform.platform().startswith("FreeBSD-13") or platform.system() == "SunOS":
# workaround for spurious hangs during zfs send/receive in ~30% of Github Action jobs on QEMU
# probably caused by https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=283101
# via https://github.com/openzfs/zfs/issues/16731#issuecomment-2561987688
os.environ[bzfs.env_var_prefix + "dedicated_tcp_connection_per_zfssend"] = "false"
os.environ[bzfs.env_var_prefix + "dedicated_tcp_connection_per_zfs_send"] = "false"

if control_persist_margin_secs is not None:
job.control_persist_margin_secs = control_persist_margin_secs
Expand Down Expand Up @@ -498,11 +498,11 @@ def run_bzfs(
old_max_datasets_per_minibatch_on_list_snaps
)

if old_dedicated_tcp_connection_per_zfssend is None:
os.environ.pop(bzfs.env_var_prefix + "dedicated_tcp_connection_per_zfssend", None)
if old_dedicated_tcp_connection_per_zfs_send is None:
os.environ.pop(bzfs.env_var_prefix + "dedicated_tcp_connection_per_zfs_send", None)
else:
os.environ[bzfs.env_var_prefix + "dedicated_tcp_connection_per_zfssend"] = (
old_dedicated_tcp_connection_per_zfssend
os.environ[bzfs.env_var_prefix + "dedicated_tcp_connection_per_zfs_send"] = (
old_dedicated_tcp_connection_per_zfs_send
)

if isinstance(expected_status, list):
Expand Down

0 comments on commit 4075ebc

Please sign in to comment.