From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4416C433F5 for ; Tue, 7 Sep 2021 16:07:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8710F610F8 for ; Tue, 7 Sep 2021 16:07:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241119AbhIGQIO (ORCPT ); Tue, 7 Sep 2021 12:08:14 -0400 Received: from cloud.peff.net ([104.130.231.41]:40628 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238483AbhIGQIN (ORCPT ); Tue, 7 Sep 2021 12:08:13 -0400 Received: (qmail 19348 invoked by uid 109); 7 Sep 2021 16:07:06 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 07 Sep 2021 16:07:06 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 14733 invoked by uid 111); 7 Sep 2021 16:07:02 -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, 07 Sep 2021 12:07:02 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 7 Sep 2021 12:07:01 -0400 From: Jeff King To: Taylor Blau Cc: git@vger.kernel.org Subject: Re: [PATCH 0/2] pack-write,repack: prevent opening packs too early 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 Wed, Sep 01, 2021 at 05:40:22PM -0400, Taylor Blau wrote: > Hmm. As I was wondering about about, this is more complicated than meets > the eye. Consider t5616.36, which tests that repacking does not loosen > promisor objects. > > In builtin/repack.c:repack_promisor_object(), the repack builtin tells > pack-objects about the pack that it just wrote with `--keep-pack` (and > we rely on that working in order to not loosen all of the objects that > we just wrote). > > Except when we iterate through `get_all_packs()`, we don't see the keep > pack yet, because it is still prefixed with .tmp. > > So, this does get kind of tricky. There are some internal callers that > do want to know about .tmp packs and a whole host of other callers that > don't or shouldn't. Maybe that should point us towards "we should be > more careful about the order we write packs in, even temporary ones". So I happened to be looking at some packing stuff again today, and I realized the situation is much less dire than I made it out to be. On the reading side, we _won't_ look at tmp_pack_*, nor tmp_idx_*, because they don't end in '.pack' or '.idx'. So really, the only confusing case is the ".tmp-$$-etc.idx" that is generated by pack-objects (because it thinks of that as the final name to use itself), and then later rearranged by git-repack. So I think we _are_ OK as long as the correct order is observed during the rename-into-place steps. I.e., your original patch (plus the extra post in index-pack) would mean that we're fully covered. The .tmp-*.idx ones would appear in the correct order due to pack-objects, and the final pack-*.idx ones due to git-repack. -Peff