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: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-2.3 required=3.0 tests=AWL,BAYES_00,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id 5CBE51F601 for ; Fri, 9 Dec 2022 07:28:43 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="FC26Mjmg"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230219AbiLIH2L (ORCPT ); Fri, 9 Dec 2022 02:28:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230036AbiLIH1U (ORCPT ); Fri, 9 Dec 2022 02:27:20 -0500 Received: from mail-yw1-x1130.google.com (mail-yw1-x1130.google.com [IPv6:2607:f8b0:4864:20::1130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 969C740456 for ; Thu, 8 Dec 2022 23:27:04 -0800 (PST) Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-3cbdd6c00adso41796397b3.11 for ; Thu, 08 Dec 2022 23:27:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=lI27dDPxIHYBhQ1cCtoCAZuFO8uL2/6617sVGv0XbLQ=; b=FC26MjmgkopwPJaxaRhQBf8jyO5Sn1S+/BkE+wHgUOQcTkvvktPIBeQKvrrr7RMb1W cY/BU6JZTizVVg438s9e/i63J9zwHm3iNbc7lKdcasprgMFh9Huqr9GpeouXXfJ1aGma d+ASaJu+u0Xtjlv0dNaMsxIB+TSy0xNUNv0ryWlzM5hJTDRJCtmmXWxj6P7zGuSUINFd m4zpVrcSE7JIi6dBh9pjIvdo+uVpds4o0i+sk/nsN8OJa3g7uN0muhDFZtG5fPBUgwiE iLPBTg2ahBwkbDDIpcNtRsvLx0CqfWG308o1x+LXwzOE27QL2X+fTmbW+39LMuvRrJ0c hRQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lI27dDPxIHYBhQ1cCtoCAZuFO8uL2/6617sVGv0XbLQ=; b=nwaP/34tvKJuzQD57Oie6YZnf2gnGbaMXupGqhqk7rSd+5fqhU9LEwZ/QojaGyS6wx GOiugzAPMw1ne+tSswmmlymphNPsVW9Gu4rS6Q4+KzPDNNrkpweLC3yFL3ZR3EfdZQk6 igS6JJx19m7Y16l0vY6FQW2gHDKUh+apscI9YWO4Cbh0c3cJeGd/Hqae2bH5FWvtaqO+ czMlxgKM947gsxvDL3NEuWANIWvpr4s+vD2PzFnEVg4F3gU1xa5LwDlvBy75CQrEAWZR 4hAdTJiAu/dh6VIpSankr4rUJBd9ZXWdawpSXS5H26WpdxAE9RdcDOCpM+qKyoXz1vof DGgw== X-Gm-Message-State: ANoB5pmT7FLTfFe2bVEgzXpxLCkJO8Fg6k9uR7ShnpxQNh18wpN+tP9X yfSCI2Ixw6y6BoJZvr+N6RL9Djq8lrIqEj6DqSI= X-Google-Smtp-Source: AA0mqf5OBhWIWwOlee3fsVYfdr5JB2njec+O99hwJEMEK7vtt9bKhU/9i2eDnxEJAhNei46Zu6pyMkD3ucFB9oItK5U= X-Received: by 2002:a81:2546:0:b0:408:5edb:24e2 with SMTP id l67-20020a812546000000b004085edb24e2mr533231ywl.43.1670570823630; Thu, 08 Dec 2022 23:27:03 -0800 (PST) MIME-Version: 1.0 References: <221208.86a63y9309.gmgdl@evledraar.gmail.com> <20221208011631.GH28810@kitsune.suse.cz> <20221209004918.GI28810@kitsune.suse.cz> In-Reply-To: From: ZheNing Hu Date: Fri, 9 Dec 2022 15:26:52 +0800 Message-ID: Subject: Re: Question: How to execute git-gc correctly on the git server To: Jeff King Cc: =?UTF-8?Q?Michal_Such=C3=A1nek?= , =?UTF-8?B?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= , Git List , Junio C Hamano , Christian Couder , johncai86@gmail.com, Taylor Blau Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Jeff King =E4=BA=8E2022=E5=B9=B412=E6=9C=889=E6=97=A5=E5=91= =A8=E4=BA=94 09:37=E5=86=99=E9=81=93=EF=BC=9A > > On Fri, Dec 09, 2022 at 01:49:18AM +0100, Michal Such=C3=A1nek wrote: > > > > In this case it's the mtime on the object file (or the pack containin= g > > > it). But yes, it is far from a complete race-free solution. > > > > So if you are pushing a branch that happens to reuse commits or other > > objects from an earlier branh that might have been collected =C3=ADn th= e > > meantime you are basically doomed. > > Basically yes. We do "freshen" the mtimes on object files when we omit > an object write (e.g., your index state ends up at the same tree as an > old one). But for a push, there is no freshening. We check the graph at > the time of the push and decide if we have everything we need (either > newly pushed, or from what we already had in the repo). And that is > what's racy; somebody might be deleting as that check is happening. > > > People deleting a branch and then pushing another variant in which many > > objects are the same is a risk. > > > > People exporting files from somewhere and adding them to the repo which > > are bit-identical when independently exported by multiple people and > > sometimes deleting branches is a risk. > > Yes, both of those are risky (along with many other variants). > I'm wondering if there's an easy and poor performance way to do gc safely? For example, add a file lock to the repository during git push and git gc? > -Peff