From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 3F6911F8C6 for ; Tue, 27 Jul 2021 17:42:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229729AbhG0Rmh (ORCPT ); Tue, 27 Jul 2021 13:42:37 -0400 Received: from cloud.peff.net ([104.130.231.41]:58896 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbhG0Rmg (ORCPT ); Tue, 27 Jul 2021 13:42:36 -0400 Received: (qmail 31100 invoked by uid 109); 27 Jul 2021 17:42:36 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 27 Jul 2021 17:42:36 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 1025 invoked by uid 111); 27 Jul 2021 17:42:36 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Tue, 27 Jul 2021 13:42:36 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 27 Jul 2021 13:42:35 -0400 From: Jeff King To: Taylor Blau Cc: git@vger.kernel.org, dstolee@microsoft.com, gitster@pobox.com, jonathantanmy@google.com Subject: Re: [PATCH v2 08/24] midx: respect 'core.multiPackIndex' when writing Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Tue, Jul 27, 2021 at 01:36:34PM -0400, Taylor Blau wrote: > > But now the internal midx writing code can never call close_midx() on > > that, because it does not own it to close. Can we simply drop the > > close_midx() call there? > > > > This would all make much more sense to me if write_midx_internal() > > simply took a conceptually read-only midx as a parameter, and the caller > > passed in the appropriate one (probably even using > > prepare_multi_pack_index_one() to get it). > > No, we can't drop the close_midx() call there because we must close the > MIDX file on Windows before moving a new one into place. My feeling is > we should always be working on the r->objects->multi_pack_index pointer, > and calling close_object_store() there instead of close_midx(). > > Does that seem like a reasonable approach to you? Yes, though I'd have said that it is the responsibility of the caller (who knows we are operating with r->objects->multi_pack_index) to do that closing. But maybe it's not possible if the rename-into-place happens at too low a level. BTW, yet another weirdness: close_object_store() will call close_midx() on the outermost midx struct, ignoring o->multi_pack_index->next entirely. So that's a leak, but also means we may not be closing the midx we're interested in (since write_midx_internal() takes an object-dir parameter, and we could be pointing to some other object-dir's midx). -Peff