From patchwork Mon Mar 25 10:02:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13601858 Received: from fout2-smtp.messagingengine.com (fout2-smtp.messagingengine.com [103.168.172.145]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96D0912B150 for ; Mon, 25 Mar 2024 10:02:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.145 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711360980; cv=none; b=E2LmCVqogwWsisjZDZFuMOox7MwFPQLnaEW/KKLn2jRnignSRPKkhxstZ/pS5BqSy62MVJuZtWTI1O7LYPLXotJeV8BDK1pMSVXH1WyqDOQB86o/Z3eO0Q8ti7pUUj5GCB2HFcIKS5B+HtEpMVaY5JRi6wTUilkVVjC63EX4Qj0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711360980; c=relaxed/simple; bh=Dag3uSfsvMAMrnQlKlshyBZUiai7vJ9CiQCu2qRrnI0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EO+XBzN2t8GHcefHu3jdzgAEdBoOMty/VRpfgRwiKYzQTkvihTM+2Ap5HlC93VpijqSkgcANmR0jupeWGRrq8V5XDJTYpwleBp2QAqQu+fj9FCJKw4ENkQYBYb2wIdSnqI5+QJ7J1ZXNyaLTE6twPdypLB2YK1PRZiiABhlt9Mo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=X0KeWTtY; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=VqKJbyUn; arc=none smtp.client-ip=103.168.172.145 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="X0KeWTtY"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="VqKJbyUn" Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.nyi.internal (Postfix) with ESMTP id 9D20D13800B7; Mon, 25 Mar 2024 06:02:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 25 Mar 2024 06:02:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1711360977; x=1711447377; bh=SngaOgt+ge Xdxk4pXVxHwT3nPVn888kE9+8fIPLEHbA=; b=X0KeWTtYI+gGELD5H+G5X2udzy a17W8mh0UTDj9QH8gpce2mIs46XhjVptAWhJq4iMHkFLioTCq3GEyJppeca5UZ3r EZu2TT3jKU3zD4WUY4AeJT/yLoC4g2dYfx49b8QCiLnQnXIPyfw/8bOq+T0vFl7r QbpD6ZwSr0uX0ars65JIIQLBkng7Z3bYDJ09yXSdFU0f+xmwePultABWDT6aWahn vvuqgwNR8/cYWBa/SLmCY/mDeu88cEQAVTWzxKa+ddlIur57ev4HrQD7QWKrV2NH UCorvc+zKwrp4wpt+J4PaD38CS33v5p4fl7/3vdWZlq4Zcxh7VX/9D2BUEpg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1711360977; x=1711447377; bh=SngaOgt+geXdxk4pXVxHwT3nPVn8 88kE9+8fIPLEHbA=; b=VqKJbyUnZtz8o5E3o/thKIDcUuD9yxldeAGi539WN+ID 6UHhbo2lZ+ty7BwdOl7I2Zdzg13w6K15QLsO8/xY2zlI3veI0iQGrVg3zrBiU3aH OhaVoFPvhpJevyk/VEcsrWilSUnSC48x4PTY5iLK3BB692nVIldDXeow82meKc8m xu+a0qU7Cnh0Bd5cc3IMATQPp8MLm1qPItQX4XCQJy8HQGp5VsO8XZctxdryZzrG KhKNKfUb8IT9s6j1/3NBApF32g8sMGPABN0S+b8FAm9Bc25/c+dldGi9wleKEOKX wlW3IoaoKgNOdR/jPPLOdNnEX3PCpX+hqBfZKFxPhQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledruddtledguddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvdenucfhrhhomheprfgrthhr ihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvg hrnhepueektdevtdffveeljeetgfehheeigeekleduvdeffeeghefgledttdehjeelffet necuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepphhsse hpkhhsrdhimh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 25 Mar 2024 06:02:56 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 73df58f9 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 25 Mar 2024 10:02:46 +0000 (UTC) Date: Mon, 25 Mar 2024 11:02:54 +0100 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Derrick Stolee , Karthik Nayak Subject: [PATCH v2 05/15] refs/reftable: print errors on compaction failure Message-ID: <6615f25b0890c934a31902bed024eaa9146ec641.1711360631.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: When git-pack-refs(1) fails in the reftable backend we end up printing no error message at all, leaving the caller puzzled as to why compaction has failed. Fix this. Signed-off-by: Patrick Steinhardt --- refs/reftable-backend.c | 6 +++++- t/t0610-reftable-basics.sh | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c index e206d5a073..694dc4845f 100644 --- a/refs/reftable-backend.c +++ b/refs/reftable-backend.c @@ -1204,8 +1204,12 @@ static int reftable_be_pack_refs(struct ref_store *ref_store, stack = refs->main_stack; ret = reftable_stack_compact_all(stack, NULL); - if (ret) + if (ret < 0) { + ret = error(_("unable to compact stack: %s"), + reftable_error_str(ret)); goto out; + } + ret = reftable_stack_clean(stack); if (ret) goto out; diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh index 5f2f9baa9b..a53d1dc493 100755 --- a/t/t0610-reftable-basics.sh +++ b/t/t0610-reftable-basics.sh @@ -375,6 +375,18 @@ test_expect_success 'pack-refs: compacts tables' ' test_line_count = 1 repo/.git/reftable/tables.list ' +test_expect_success 'pack-refs: compaction raises locking errors' ' + test_when_finished "rm -rf repo" && + git init repo && + test_commit -C repo A && + touch repo/.git/reftable/tables.list.lock && + cat >expect <<-EOF && + error: unable to compact stack: data is locked + EOF + test_must_fail git -C repo pack-refs 2>err && + test_cmp expect err +' + test_expect_success 'pack-refs: prunes stale tables' ' test_when_finished "rm -rf repo" && git init repo &&