From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 6FC6073404 for ; Thu, 15 Apr 2021 10:13:59 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 64B9416FCF for ; Thu, 15 Apr 2021 10:13:29 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id EACB416FC7 for ; Thu, 15 Apr 2021 10:13:28 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id B2CFE434CE for ; Thu, 15 Apr 2021 10:13:28 +0200 (CEST) From: Thomas Lamprecht To: pbs-devel@lists.proxmox.com Date: Thu, 15 Apr 2021 10:13:22 +0200 Message-Id: <20210415081322.32556-1-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.041 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [verify.rs] Subject: [pbs-devel] applied: [PATCH backup] backup verify: re-check if we can skip a chunk in the actual verify loop X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Apr 2021 08:13:59 -0000 Fixes a non-negligible performance regression from commit 7f394c807bca3f451e77b6a1cf7de7c6e7df5f92 While we skip known-verified chunks in the stat-and-inode-sort loop, those are only the ones from previous indexes. If there's a repeated chunk in one index they would get re-verified more often as required. So, add the check again explicitly to the read+verify loop. Signed-off-by: Thomas Lamprecht --- src/backup/verify.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/backup/verify.rs b/src/backup/verify.rs index ed959813..1192821e 100644 --- a/src/backup/verify.rs +++ b/src/backup/verify.rs @@ -214,6 +214,12 @@ fn verify_index_chunks( let info = index.chunk_info(pos).unwrap(); + // we must always recheck this here, the parallel worker below alter it! + // Else we miss skipping repeated chunks from the same index, and re-verify them all + if verify_worker.verified_chunks.lock().unwrap().contains(&info.digest) { + continue; // already verified + } + match verify_worker.datastore.load_chunk(&info.digest) { Err(err) => { verify_worker.corrupt_chunks.lock().unwrap().insert(info.digest); -- 2.29.2