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: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 1231C1F609 for ; Fri, 24 May 2019 08:26:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389396AbfEXI0I (ORCPT ); Fri, 24 May 2019 04:26:08 -0400 Received: from cloud.peff.net ([104.130.231.41]:37674 "HELO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S2389046AbfEXI0H (ORCPT ); Fri, 24 May 2019 04:26:07 -0400 Received: (qmail 26446 invoked by uid 109); 24 May 2019 08:26:07 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with SMTP; Fri, 24 May 2019 08:26:07 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 7774 invoked by uid 111); 24 May 2019 08:26:49 -0000 Received: from sigill.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.7) by peff.net (qpsmtpd/0.94) with (ECDHE-RSA-AES256-GCM-SHA384 encrypted) SMTP; Fri, 24 May 2019 04:26:49 -0400 Authentication-Results: peff.net; auth=none Received: by sigill.intra.peff.net (sSMTP sendmail emulation); Fri, 24 May 2019 04:26:06 -0400 Date: Fri, 24 May 2019 04:26:06 -0400 From: Jeff King To: =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason Cc: Derrick Stolee , Junio C Hamano , Eric Wong , git@vger.kernel.org Subject: Re: [PATCH v3] repack: enable bitmaps by default on bare repos Message-ID: <20190524082605.GB9082@sigill.intra.peff.net> References: <20190312104954.GA2023@sigill.intra.peff.net> <20190313015133.n7f7lyujnlwfytre@dcvr> <20190313145417.GA24101@sigill.intra.peff.net> <20190314091254.nescpfp3n6mbjpmh@dcvr> <87zhoz8b9o.fsf@evledraar.gmail.com> <20190410225721.GA32262@sigill.intra.peff.net> <20190523113031.GA17448@sigill.intra.peff.net> <87tvdlt1jp.fsf@evledraar.gmail.com> <20190524072724.GH25694@sigill.intra.peff.net> <87r28offs6.fsf@evledraar.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87r28offs6.fsf@evledraar.gmail.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Fri, May 24, 2019 at 09:55:05AM +0200, Ævar Arnfjörð Bjarmason wrote: > > I'm not sure what tickles the bitmap-writer to fail so hard. Is it > > having too many refs? Weird patterns in the graph? Just a ton of > > commits? > > Ah, why did only this ancient (big) pack have a bitmap? > > The bitmap writer had never failed, this was just a repository where > some automation (on a dev/staging box) cloned a repo, and someone had > once run a manual "repack" to make make a pack with a bitmap. Just to be clear, by "fail" I didn't mean that the writer failed to produce. I just meant it had poor commit selection for its bitmap coverage. But... > Then as time passed that pack stayed around, and re-looking at this that > could have only happened because I had gc.bigPackThreshold turned on. > > I.e. without that we'd have eventually done a full repack, so the bitmap > would have gone away. > > So getting the repo into that state was a series of unlikely events. Ah, now that's interesting. The issue may have just been that we had a ton of un-bitmapped commits because they weren't in the bitmapped pack at all. The logic that Stolee pointed out earlier: /* * if we have a HAVES list, but none of those haves is contained * in the packfile that has a bitmap, we don't have anything to * optimize here */ if (haves && !in_bitmapped_pack(bitmap_git, haves)) goto cleanup; is pretty feeble. If you have even _one_ UNINTERESTING tip that's in the pack, we'll try to use bitmaps. And in your case, you almost certainly had old tags on both the client and the server there were in the old bitmapped pack, but then a huge swath of history that had happened since then. And it was that newer part of the graph that we had to walk to fill in the bitmap. So all of this makes pretty good sense to me now. Bitmaps work incrementally as you add new, un-bitmapped history. But the cost gets higher and higher the longer you go before repacking and generating new bitmaps. So your case was very similar to a repo that uses bitmaps but just hadn't packed in a really long time. > I think to the extent that this is an issue we can reproduce in the > future the proper fix for it in lieu of some easy fix in the bitmap code > would be to just teach "gc" to unlink old *.bitmap files if we detect > they're too stale. Yeah. This could happen if you simply accumulated history without ever running "gc". But in general we can probably assume that "gc" will run periodically (though there is a real blind spot if you push up a very huge chunk of history in one pack, since gc counts packs, not objects). I agree that if gc is deciding to leave a big pack, it should probably ditch the bitmaps for it. > I.e. we don't need to deal gracefully with some case where the bitmaps > just cover some tiny part of the graph, we can just teach "gc" to either > update them, or (if we're not currently writing them) unlink them. Unfortunately I don't think we can update them, because all of the reachable objects need to be in the same pack. So any scheme that isn't doing a periodic all-into-one repack probably shouldn't be using bitmaps. I wonder if we need to tweak Eric's bitmaps-by-default logic to better account for this. > That seems to me to be a good idea in general, not just with bitmaps but > also the commit graph. If we're doing a GC and our current settings > aren't such that we'd update those files, shouldn't we just unlink them? I don't think the commit graph would suffer from this. It's not tied to a specific pack, so it can be freely updated on any gc. You still have the problem when gc does not run. It's possible that auto-gc should have separate thresholds for different activities (e.g., number of packs should tell us when to repack objects, number of loose refs should tell us when to pack refs, number of un-annotated commits should tell us when to update the commit graph). The trouble is that some of those checks are non-trivial. In the long run, I think the plan is for the commit graph to allow cheap incremental updating, which may make it reasonable to just update it preemptively after every fetch/push. -Peff