Article View: linux.kernel.git
Article #4102Re:Re: [PATCH v2] read-cache: hash the shared index even with index.skipHash
From: "Xing Xin"
Date: Mon, 30 Nov 2026 07:47
Date: Mon, 30 Nov 2026 07:47
49 lines
12110 bytes
12110 bytes
At 2026-11-29 05:41:01, "Junio C Hamano" <gitster@pobox.com> wrote: > The updated commit message explains both the failure mode and the > trade-off clearly, without overstating the savings on split-index > writes. Thanks. > It is also worth checking how concurrent-update detection behaves when > both features are active. Suppose a repository has both core.splitIndex > and index.skipHash enabled, and "git status" reads the split index and > later calls repo_verify_index() before writing back. > > Because do_write_locked_index() still writes the split index with > skip_hash enabled, the split index has a null trailing hash on disk, and > merge_base_index() does not overwrite '.oid' or '.file_stat' on the main > index_state. Thus verify_index_from() still sees a null '.oid' and > falls back to index_file_unchanged() on .git/index, so concurrent > updates are still detected correctly? Yes. read_index_from() reads .git/index into the index_state itself, where do_read_index() records its null trailer in istate->oid and its stat data in istate->file_stat, and reads the shared index into the separate istate->split_index->base. Nothing touches these two fields of the main index_state after that: merge_base_index() only copies cache entries out of istate->split_index->base, and do_write_index() sets them only on the index_state that it writes, which is istate->split_index->base for the shared index. So verify_index_from() always checks .git/index, and since every index update, with or without a new shared index, ends by renaming a new .git/index into place, index_file_unchanged() notices it. The two index.skipHash=true tests in t7508, "status keeps an index update made after it read the index" and "status refresh does not overwrite an index update made while collecting", check exactly this. This patch drops the workaround that made them unset GIT_TEST_SPLIT_INDEX, so they now also run with a split index in the linux-feature-testbed CI job, which sets it. With GIT_TEST_SPLIT_INDEX=1 they pass, and they fail when verify_index_from() skips the stat check. I also ran the first one with core.splitIndex=true instead, with the same results. > Likewise, "git fsck" runs read_index_from() with verify_index_checksum > set, so verify_hdr() accepts the null trailer on .git/index while > verifying the real hash on the shared index file. Right. do_read_index() calls verify_hdr() for both files, and with this patch the shared index always has a real trailer, so "git fsck" verifies it: flipping a byte in an entry of the shared index makes it fail with "bad index file sha1 signature". The split index, like any index written with index.skipHash, has no checksum to verify.
Technical Details
Message-ID:
<47be148e.6b3d.1a22b6cb367.Coremail.bupt_xingxin@163.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76659-linux-kernel-git=dewy.ruReferences:
<pull.2337.git.1795701443098.gitgitgadget@gmail.com> <pull.2337.v2.git.1795858039529.gitgitgadget@gmail.com> <xmqq7bhwvdle.fsf@gitster.g>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76659-linux-kernel-git=dewy.ru
From: bupt_xingxin@163.com ("Xing Xin")
Newsgroups: linux.kernel.git
Subject: Re:Re: [PATCH v2] read-cache: hash the shared index even with
index.skipHash
Date: Mon, 30 Nov 2026 15:47:53 +0800 (CST)
Organization: Usenet Network
Message-ID: <47be148e.6b3d.1a22b6cb367.Coremail.bupt_xingxin@163.com>
References: <pull.2337.git.1795701443098.gitgitgadget@gmail.com>
<pull.2337.v2.git.1795858039529.gitgitgadget@gmail.com>
<xmqq7bhwvdle.fsf@gitster.g>
MIME-Version: 1.0
Content-Type: text/plain; charset=GBK
Content-Transfer-Encoding: base64
Injection-Info: usenet.network;
logging-data="1368445"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:nw6+9Qw6RLHEf/sF3JVUGtGHdCQ= sha256:ixX/2jbKJr/zRDvo2TzfrAjgTplqmXsvTHdRXfY6Bqc=
sha1:4vMt0t/8KwpdD7H4vxhdGbddrVE= sha256:tPS05MwtJDIDJWAhixie616DQHJMDeU265u9f4o+fNE=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 9C046125FC9; Mon, 30 Nov 2026 10:48:34 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.949
X-Spam-Status: No, score=-1.949 tagged_above=-9999 required=6.31
tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
header.d=163.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 7wsIwuGU2K_t;
Mon, 30 Nov 2026 10:48:31 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-76659-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=163.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 7602B125FC8; Mon, 30 Nov 2026 10:48:23 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 9BFA625C65; Mon, 30 Nov 2026 07:48:19 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1796024899;
b=yQ2nzq1zy+0VDy2egPOf8Ddm3j2Yy6Dy36oWBA6KqLdTHym9Z5+llh9iO1tBPdc0Bv4I
1F18kG9ih4StknPvqYrJ+F97r+2v7uINT2nx28AfMLV/Ge3hVrWpsmg6sgUbc+IKa25A3
7sbFLtms7w8bh8rvavqVDs0YzY4a/LbixJnYueonJUhoix+o53EuFr/MyObY+KaD5Jgoe
dy6RkpNMOilqacKniB9k5HxBw34XRbXJwCcUqdYLiEpiskVXtK5wOHK6FlXOfX4j+FvY5
/d2erj0SyNP75NuPSEey0IBhr7MUFJILt/Cs5u2vPDbiaPVPqYtNDYF79cHw7mtpNqA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796024899;
h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Date:From:To:Cc:
Subject:X-Priority:X-Mailer:In-Reply-To:References:X-NTES-SC:
Content-Transfer-Encoding:Content-Type:X-Mailing-List:List-Id:
List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
Precedence:MIME-Version:Message-ID:X-Coremail-Locale:X-CM-TRANSID:
X-CM-SenderInfo:X-Coremail-Antispam;
bh=TR7Uqd0pOyWKIkM3qoBPFa7tj/OhQCf161k4Z2U5aag=;
b=gpqrLizOJmmcYdCN2DWju8AEafWyxYWOUIa/PyDLAYrhKs/cMUab3YdKAJ50wTjhJ6og
kcKZrzdNjAmTOcobZHbOytdWR61JRyLCWky74ox1/qGghaTrcb3xyfSpilMM60LlRhuvr
JKIsaa7RxN9kIbP6i2BB5kRSpP7lMIxVQnYnrh6gOCLddrN5iWC1UD2XokplvZNMT+j0X
q1xAOq8CDKnIOwnURW54wujyrqHVoh9z5+Rrrtb1NN4SsuLrpVIy9Pjadn6g9XsOuBZvq
WC46PnXBqWTSB8giiogCzmbBoE/d6yfmFzzLmf4p0U54hlpjBsrIYd60Sqt5o7oLcFw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=GvxO77pQ;
dmarc=pass header.from=163.com;
spf=pass smtp.mailfrom=163.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 72BB9606A320;
Mon, 30 Nov 2026 07:48:19 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=GvxO77pQ
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=220.197.31.2
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796024898;
b=soqNVGlyMVK7orp89PjinPVUWDCjL4vL70wx0kj0/gVrbm3DA/llacnvVkBCNd/gv2Gb
6Z4B8Obo2gHynEyDO2NZiEgtoDeTVZ9bfrYQzEVa//Nbom5i8/sBIBIckoEYDkWI42uYk
bv2fGZrADN+fd46vb3NffYBAVe7lKlOKDtqjlSVJTWH6e2XujFDYpdg9ECBwlJbqUGA8B
0ahNeGFLn9JItQpGa6MVANF4rBDf9TPgg8Cmozvxiyt1wVmTOQUEl6R73hFywttQ5ADEH
UvZsmDjwdPKzCA4humL/lOZrR/LIcGrriSsE9LhP7cpEMwaMbQq2R3itDym9ADWB7IA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796024898;
h=DMARC-Filter:DKIM-Signature:Date:From:To:Cc:Subject:X-Priority:
X-Mailer:In-Reply-To:References:X-NTES-SC:Content-Transfer-Encoding:
Content-Type:MIME-Version:Message-ID:X-Coremail-Locale:X-CM-TRANSID:
X-CM-SenderInfo:X-Coremail-Antispam;
bh=TR7Uqd0pOyWKIkM3qoBPFa7tj/OhQCf161k4Z2U5aag=;
b=behvJx52CcLXJW7Uok/eB5amxxyvLSEGsKERzdWCbjhg+sJ3One4I3W/hcbI0RX+XgDS
cekALX5LMl2ZrPmrI8c4sPoWRZiBs4ukWiuFuVeEu0IyJEanT7veFIq0QaX/IojxkIhg0
DehKvT7mEvtEEcWz6BHXufiK7VshU/qlZplAGvcWj/ftyU22YXqLqcQC4hmT88rLUYFy3
lclDuL1dNfvbEhwsRl/ZYd+mkhOc6gz0COiLW3S/lptXMK0jzyvwZvrqxBEHtWrv89RFf
VimEo52BjOVZhWwcnb8vFZz0EdskhGXkOfK641xJfy9Qn2t2dhL7uuRrcWEmflVaajg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=163.com;
spf=pass smtp.mailfrom=163.com;
dkim=pass header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=GvxO77pQ;
arc=none smtp.remote-ip=220.197.31.2
X-Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.2])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5295606A33A
for <git@vger.kernel.org>; Mon, 30 Nov 2026 07:48:15 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E5295606A33A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com;
s=s110527; h=Date:From:To:Subject:Content-Type:MIME-Version:
Message-ID; bh=TR7Uqd0pOyWKIkM3qoBPFa7tj/OhQCf161k4Z2U5aag=; b=G
vxO77pQx5Kg8FnDuIyB6JS0vc49yBj75y0qHyDm1YTSrWNYr0jeQIXIbwxT/iHB9
USvuvho+00BPJkmuMG1x6pEUVtkLUWJ4JC7Lnf+FyYZFExDmYHICmCxWr9WK4hzw
+cFiDvGGGswUdV+7uV3Kdm4eTjEPtXaT3saqeepnDA=
X-Cc: "blanet via GitGitGadget" <gitgitgadget@gmail.com>, git@vger.kernel.org,
"Xing Xin" <xingxin.xx@bytedance.com>
X-Priority: 3
X-Mailer: Coremail Webmail Server Version 2023.4-cmXT build
20260511(2e539873) Copyright (c) 2002-2026 www.mailtech.cn 163com
X-In-Reply-To: <xmqq7bhwvdle.fsf@gitster.g>
X-NTES-SC: AL_Qu2SBPyZu0As5SiaZukfmU4Xg+42Xsa1uf4n3oNUPJ94jCHr/RAHVnxjAV/14v6RBhmhqTmQVSBf2uBZfJZbT6MBWn3G3JXaMK5sauuGBLHItg==
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-Coremail-Locale: zh_CN
X-CM-TRANSID: lCgvCgDXz9QqKg1rpHd4AA--.269W
X-CM-SenderInfo: xexs3sp0lqw5llq6il2tof0z/xtbC7wqyIGsNKipetgAA35
X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU==