From nobody Thu Feb 10 08:33:14 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EDD0219AE000 for ; Thu, 10 Feb 2022 08:33:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JvVPk4ycDz4csf for ; Thu, 10 Feb 2022 08:33:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 89E481D2DD for ; Thu, 10 Feb 2022 08:33:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 21A8XEvS079511 for ; Thu, 10 Feb 2022 08:33:14 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 21A8XETN079510 for bugs@FreeBSD.org; Thu, 10 Feb 2022 08:33:14 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 261855] /etc/periodic/daily/800.scrub-zfs is using `zpool history` Date: Thu, 10 Feb 2022 08:33:14 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 13.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: lapo@lapo.it X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644481994; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=NrJ5OKRJyoB+ZjgNZ7Q4wTFEeAkwZgx5qrOYZJxPbyg=; b=QAPMnco0M8d84F56pNbUWwVzu222NPfVNF7hn1DYy4S9OqGwJot+IXtdoEpMae9xmmQbUO 1m5MnEt2UuB2MKPm6c+H8Dm3ENkJ0/TNxi7vo+RhZDZL3B9F0+APMVZEK1tlIQyLwyYOmk v41+TZYnhxRajPinQenivpk28XRlIF4SKDiKFX3me5ZkIVQgcmyPGQHpuPfCSxwp5Cvkhp Lla6hQE1nk2OukOrxMCU2/hRFzegoLCHejh2hYrO3oNQUiSY5Nm7roFLzYGgyqmhk7kvb/ u5uhTas1RvR8i9IUj3riC4/gwVuKgGLQJO7H+HYKg6spnkAw/f+HQwyLtTshwQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644481994; a=rsa-sha256; cv=none; b=YIFtTGVOcyrA6rxikKWvLwNK3jjzu5TOcPHe9HRwIg/Cpqcy2f03PTkL2Y6qS93oI2t6B8 J4psQBi2h0k3afNAqmX4U22OuS8AnRrzvMD+P/jDSdw3km4bLtwMaXEbz9vq94ztG50JMp /9N1MC2sfEzpeMApYvwBRvHKEBdBZsHKTgQ8fsdCg6yy7AciT3BgqstolpZR9T+zl5ftMD 6aOFTmv8vtJHVjqIlra8e6q2dmbrrl2NC5NK+U75o0vyfimcLsA1Me5q3MuTzsKUe8Dqtm Gy0mlDY4GGjNy2atfEtyQf8Snmf5WvRSv3Nr5o4CNoRuBY0ovkP32RFs9Q0PXw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D261855 Bug ID: 261855 Summary: /etc/periodic/daily/800.scrub-zfs is using `zpool history` Product: Base System Version: 13.0-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: lapo@lapo.it Daily scrub periodic task is currently using `zpool history` to check the l= ast time a `zpool scrub` was started (note: not completed, or executed, just started). On my system, which has a lots of filesystems and hourly snapshot/send/recv/destroy jobs in order to replicate it to/from another sy= stem my `zpool history` only covers 48h of data and thus periodic scrub (configu= red to 35 days as per default) gets executed every 3 days (this is the reason I looked into it in the first place). Right now the logic is more or less: 1. check last scrub start in `zpool history` 2. calculate diff, if < 35 just stop 3. check "scan:" line from `zpool status` and do different stuff I would suggest to remove the usage of `zpool history` and replace it with a parsing of the `zpool status` "scan:" line, which can be done with `LANG=3D= C date -j -f '%a %b %d %T %Y'`. % zpool status | fgrep 'scan:' scan: scrub canceled on Thu Feb 10 08:40:04 2022 scan: scrub repaired 0B in 00:00:26 with 0 errors on Sun Jan 23 19:09:50 = 2022 This can be easily integrated in the existing `case` by adding a new match = like `*"scrub repaired"*|*"scrub canceled"*)` and calculate the end of last scrub based on that. Caveat: `zpool status` gets reset each time a (manual) scrub or pause or ca= ncel is done. But the current method has caveats too (using start time instead of end time, using a hisotry command which can not be very trustworthy in some situations) so I think this would be an overall better solution. What do you think? I can prepare a diff for this. --=20 You are receiving this mail because: You are the assignee for the bug.=