From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.235 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796307744; b=SlO6zpPZz4N99cZkKp68qx23+xKB2JwMRft4YCNbkuM4sy6Bs3gLKpmZ5Ut8Wif+4VCS QemKW5NCmctHWQ2uwCLx7chVX6P5KZ2HUpSoUXaixTesQA1daepnf0XxTMcX+5dsX9E1q 9+qUwgZRR0wUvygm48nGwEaoQ03xJBTlWuQDh1MiK+6tnTF9vMrUd5y8j2ptDSSZyNSiq 376QGiQDek0jE9TSY2LaCKfLEtdxUJsENX+8pGkLCDwHTQTQvUsQSDd6lpy7l5cSRpGSV 5yhnDoozSFnRXC4MmcV5GBlUhfDnkAwZiHzdoXDssp9FBqyT6eDpH9Rfv7qE5X0KQzw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796307744; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:In-Reply-To: References:Date:Message-ID:MIME-Version:Content-Type; bh=t2dG6Hk6xKy6IcK0OwinqsBluHlySbiBLHYF2YJibE0=; b=rIz8lwPm+ifUj3zx9hp7HLj89pl/tldkRx3176xyBSZA0MFEGu9Q2QEg/S817ug4HlvL ZbKljGVaaHAURSqTxUppuI0Hii5eyu1m5IlDJLANFh0ndRsQturradg45zNMwKHR5hEFe K17S3gKb0L//sQuF/Ni8OrD+mTRCp6pky5j7C262ytqW3yjK6WWanSI6O/hIcLTz9IPvp hyBBcrDDcBGlkVvtUdDZHLqqKWIHStfWc6Qb/XophtXSvyvBsaZ/ft+RfLZxPTflUMHJl 31wpx86rcMRxfx/UUniE9aTesWryLBNWmFWW3bW/6LRoZgs3kmKbBp+BLhcYUTrWeow== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=iotcl.com; spf=fail smtp.mailfrom=iotcl.com; dkim=pass header.d=iotcl.com header.i=@iotcl.com header.a=rsa-sha256 header.s=key1 header.b=1wBcZqhB; arc=none smtp.remote-ip=95.215.58.235 Received: from mta1.migadu.com (out-235.mta1.migadu.com [95.215.58.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 806E4606A322 for ; Thu, 3 Dec 2026 14:22:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 806E4606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=iotcl.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=iotcl.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=iotcl.com header.i=@iotcl.com header.a=rsa-sha256 header.s=key1 header.b=1wBcZqhB X-Envelope-To: git@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=fj4MfqkRJ9rZj6QQ09AJzXyAT5xWq5i3u7DAtfkN1mQ=; c=simple/simple; d=iotcl.com; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796307740; v=1; x=1796912540; b=1wBcZqhBCy3NP2cXAQ3LLfBxVX6cSwTnkuvanlI8WGY53Thd+81HbuFW5JY5Lz+o8mYfaImE OrWlMUGpaWSx8qqNawryIL+tlHCepEIGmfcqWFAeUGfMzgZ/W4/1Ver8RKmP7aoYsjXgq3zWfKE QO1qPw7QuIj1HUF27WZY4tRM= X-Envelope-To: git@vger.kernel.org Received: by mta10.migadu.com with ESMTPS id b812c24ae066c41b; Thu, 03 Dec 2026 14:22:20 +0000 X-Mizu-Trace-ID: b812c24ae066c41b X-Migadu-Flow: FLOW_OUT From: Toon Claes To: Patrick Steinhardt , git@vger.kernel.org Cc: Junio C Hamano Subject: Re: [PATCH v2 3/4] builtin/maintenance: only consider `gc.reflogExpire` for "--auto" In-Reply-To: <20261202-pks-reflog-expire-performance-v2-3-17b2d6dd4867@pks.im> References: <20261202-pks-reflog-expire-performance-v2-0-17b2d6dd4867@pks.im> <20261202-pks-reflog-expire-performance-v2-3-17b2d6dd4867@pks.im> Date: Thu, 03 Dec 2026 15:22:13 +0100 Message-ID: <87ik1aqwa2.fsf@dev.null.iotcl.com.invalid> X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain Patrick Steinhardt writes: > The "reflog-expire" maintenance task is responsible for expiring reflog > entries that are older than either "gc.reflogExpire" for entries that > are still reachable, or "gc.reflogExpireUnreachable" for those that are > not reachable. > > When executed with "--auto", the condition that we use to trigger this > task verifies whether the number of reflog entries that we would prune > is larger than "maintenance.reflog-expire.auto". This is evaluated by > walking the "HEAD" reflog, where we then check every entry by calling > `should_expire_reflog_ent()`. That function will then check whether the > reflog entry refers to a commit that is reachable or not, and depending > on the outcome compares against either "gc.reflogExpire", or against > both "gc.reflogExpire" and "gc.reflogExpireUnreachable". > > To decide reachability the caller has to call `reflog_expiry_prepare()`, > which amongst other things also performs a reachability walk for a given > refname. But we don't do that in the "reflog-expire" maintenance task, > and hence every single reflog entry will be considered unreachable and > thus we'd consider many reachable entries prunable even though they > won't be pruned. So we overcount the number of prunable entries quite a > bit and will thus trigger `git reflog expire` even though it won't do > anything. > > Now we could easiliy fix that by calling `reflog_expiry_prepare()`. But s/easiliy/easily/ > in the case of auto-maintenance it has the big downside that we now have > to perform a reachability walk in the foreground, and that may be quite > expensive. The whole point of those auto-conditions is to use heuristics > that are fast to evaluate though so that the time we have to block is > reduced as much as possible. > > Instead, adapt the heuristic to only evaluate reflog entries against > "gc.reflogExpire". This of course means that we're now undercounting the > number of prunable entries. But as part of background maintenance that > feels like a reasonable tradeoff, and a user that really wants to prune > unreachable reflog entries can either execute git-maintenance(1) without > "--auto", or they can run `git reflog expire` directly. So this commit doesn't include any test changes. Simply put that's because `test_commit` writes really old commits, so they are older than both "gc.reflogExpire" and "gc.reflogExpireUnreachable". Now we could add a test that sets "gc.reflogExpire=never" and "gc.reflogExpireUnreachable=now" and test the overcounting, but I don't insist on that because that's not really the point of this change. I'm happy to accept this series as-is. -- Laters, Toon