From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-b8-smtp.messagingengine.com (fhigh-b8-smtp.messagingengine.com [202.12.124.159]) (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 9F9311CAA6C for ; Thu, 9 Jul 2026 03:32:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.159 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783567936; cv=none; b=ey8C/87KnUYxMo3oNjbZ+ovdoc3vIOPRSUiKt7SAm4vazfLE6hKZL6bCmPofcFOtXbtoy8IZVZ8RWloZSqPc+eYxVulBMQztMzU7RDY+dH4bfofVWxOo8zhemjbxdXaGIfFdl52mc9DQJ1/iZeFJkgYOqpHcw0Fxh7/SShLN0j0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783567936; c=relaxed/simple; bh=ywyxbHlmGDCgvRDZjFR2TbD1Pz1o3F+/L3DLeIYz+TU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=N1MTqiu+vChOe/ygZv5i591HbllbijPTjnNbrOGPpsw7GUWLa6UgVtI5ZVaJUb2HRXdRy6OlhM2eAm2g2LImCOF/V8jEFXao8YcKLHIIcunVFBBQ3aSXshuqilPVxXYySZEQY4HWxcTZ5vMl6ZAy4c1RFsoLc8DAQDRt63HRVI0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=EOtqUwj9; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=HQHtd5zl; arc=none smtp.client-ip=202.12.124.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="EOtqUwj9"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="HQHtd5zl" Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.stl.internal (Postfix) with ESMTP id E5FCA7A00AF; Wed, 8 Jul 2026 23:32:13 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-02.internal (MEProxy); Wed, 08 Jul 2026 23:32:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; 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=fm1; t=1783567933; x=1783654333; bh=McL7N5caqN 1Bern71ERE9Lvp2eTf5Drh+OSXD1K4098=; b=EOtqUwj9khdvnNNqKfGRmbtKvA 9/kFpAIKMBTbitzkWAsLTGgVRlIrA9UlBtdAQISlG5+gvgr065KtxQfK12Oi0EkF B5l02NZDxeUTOj96QPY4eQnX3h6vPXpGxqfVqUjD6VjbKOpMQ1N3WSQldl43JqOb I8hgZot0rqYghrDtuU0Funm3GvDqV23497tCnJPh5JPBhRwG0tyy3Nt4jh1aLX56 8vhzYjZLjRNyPOgcYHYvdUR9Ewl/eN3iM5bLgwVY3ZQhZV9sv5MxirZirEZBAbRO HdkaDFd95qrYwQcWt0vpdzFF/RCJ6q93tL8koMZSDuC/rpSF+2sq9MjCybAQ== 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-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1783567933; x=1783654333; bh=McL7N5caq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dt1r5gOaZAKLYiimTMwe7JYz/A5IQku9q2w X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 8 Jul 2026 23:32:13 -0400 (EDT) From: Junio C Hamano To: Justin Tobler Cc: git@vger.kernel.org, ps@pks.im Subject: Re: [PATCH v3 06/11] odb/transaction: propagate begin errors In-Reply-To: <20260708235925.3992097-7-jltobler@gmail.com> (Justin Tobler's message of "Wed, 8 Jul 2026 18:59:20 -0500") References: <20260708041412.1157499-1-jltobler@gmail.com> <20260708235925.3992097-1-jltobler@gmail.com> <20260708235925.3992097-7-jltobler@gmail.com> Date: Wed, 08 Jul 2026 20:32:11 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Justin Tobler writes: > When `odb_transaction_begin()` is invoked, the function returns the > transaction pointer directly. There is no way for the backend to > signal that it failed to set up its state, such as when creating the > temporary object directory backing the transaction. > > In a subsequent commit, git-receive-pack(1) starts using ODB > transactions and needs to be able to report such failures rather > than silently ignore them. Refactor `odb_transaction_begin()` to > return an int error code and write the resulting transaction into an > out parameter. Also introduce `odb_transaction_begin_or_die()` as a > convenience for callsites that do not need to handle errors > explicitly. > > Note that `odb_transaction_begin()` now returns an error when the ODB > already has an inflight transaction pending. ODB transaction call sites > that may encounter an inflight transaction are updated to explicitly > handle this case. > > Signed-off-by: Justin Tobler > --- > ... > diff --git a/odb/transaction.c b/odb/transaction.c > index b16e07aebf..a5fba7f908 100644 > --- a/odb/transaction.c > +++ b/odb/transaction.c > @@ -1,15 +1,20 @@ > #include "git-compat-util.h" > +#include "gettext.h" > #include "odb/source.h" > #include "odb/transaction.h" > > -struct odb_transaction *odb_transaction_begin(struct object_database *odb) > +int odb_transaction_begin(struct object_database *odb, > + struct odb_transaction **out) > { > + int ret; > + > if (odb->transaction) > - return NULL; > + return error(_("object database transaction already pending")); > > - odb_source_begin_transaction(odb->sources, &odb->transaction); > + ret = odb_source_begin_transaction(odb->sources, out); > + odb->transaction = *out; Can odb_source_begin_transaction() ever fail? If so, and when it fails, would *out be left untouched? I am wondering if we want if (!(ret = odb_source_begin_transaction(odb->sources, out))) odb->transaction = *out; or something like that.