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=-3.5 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 195DD1F4D7 for ; Fri, 17 Jun 2022 19:08:57 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SniYYqPw"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237440AbiFQTGg (ORCPT ); Fri, 17 Jun 2022 15:06:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239213AbiFQTGb (ORCPT ); Fri, 17 Jun 2022 15:06:31 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E4275676A for ; Fri, 17 Jun 2022 12:06:27 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id i81-20020a1c3b54000000b0039c76434147so4808762wma.1 for ; Fri, 17 Jun 2022 12:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=1aclt8qarEKATJ+/GzKFdAWEVcurzVYKQFGwF4AHpIU=; b=SniYYqPwQzAkBDW2Q+rSSAJAuAWIAp4P0UQuEKzJcTrvsLZWAmBGL5F8sKAHMfm55L 0BXqr/YygxEq/sNrPw3pSGppbpWF8EAvkUHFOhQypFPeDXCAx+fsWuaDFF8FZK6YMAiO 4+ckhOyJv1vlq4Nb9ecIs/xSCEt2PEYFOI/+e/iT8zqkrWfmqAhwqIlYhNII+TzsKocj cPZ4y3mkDxT35plfF6mL08e/noTzq4HNsLpLUV/hjU2+8VObwP7kH0xnUCaFPwXuQ1kx gAC/A+ithKvpGYBm1LxnkDu6cfzWfbDjo3y42tA7R2ykSf8fC/ok4MY5391ntFSHx73M SHPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=1aclt8qarEKATJ+/GzKFdAWEVcurzVYKQFGwF4AHpIU=; b=xBmz65zsfFrmGd9BnMKNNjQe4QclNzDFlsm7+CXjtnCwCG8TYdoO8eLZ0Ftd4APIn8 RCRfsJVz4ORn9SG5BJqvPwVZ9YxoCRgl5DjV3M2NeOZMkwOdEgztXXAAQ7PgB0fvdod6 PnOF/lNetfrDkKKuXM9EiX4z5XaSm3LaAlPeaRJbI9ke5fm2jp6W8UChtli7bDaFnNvx qUFbQw4kgg1ogKmICeb6cq0o9Ac62r+hx55Nar8vqldP7AFVSr56zKJhohrxaNfIiDTt yXRxZ7GMTfVAZ3Tj7y7e/u4dixfnRb1bcrRoHxiNyKtfGo2pesi6FVfCbsLuR8x4pmJQ bwqw== X-Gm-Message-State: AOAM5301HtRruUYT2V0lTh48TUPq7YrJGfdvkzwjMHJOAbQTdGNiy4to VS3Osi8t1XufLjBkM89h6itS9q5iQEIAjw== X-Google-Smtp-Source: ABdhPJwgGNcDBiz9Duf1mpnT8SOBlQDFcklm04LAE5di0g97Y19qCwC4lH1y8kJr0o7T5SLcfezaAQ== X-Received: by 2002:a05:600c:10cf:b0:39c:8270:7b86 with SMTP id l15-20020a05600c10cf00b0039c82707b86mr22440900wmd.180.1655492780659; Fri, 17 Jun 2022 12:06:20 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id l9-20020a05600c4f0900b0039db500714fsm6915886wmq.6.2022.06.17.12.06.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jun 2022 12:06:19 -0700 (PDT) Message-Id: In-Reply-To: References: From: "Kyle Zhao via GitGitGadget" Date: Fri, 17 Jun 2022 19:06:19 +0000 Subject: [PATCH v4] send-pack.c: add config push.useBitmaps Fcc: Sent Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MIME-Version: 1.0 To: git@vger.kernel.org Cc: =?UTF-8?Q?=C3=86var_Arnfj=C3=B6r=C3=B0?= Bjarmason , Derrick Stolee , Taylor Blau , kylezhao , Jeff King , Kyle Zhao , Kyle Zhao Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Kyle Zhao Reachability bitmaps are designed to speed up the "counting objects" phase of generating a pack during a clone or fetch. They are not optimized for Git clients sending a small topic branch via "git push". In some cases (see [1]), using reachability bitmaps during "git push" can cause significant performance regressions. Add a new "push.useBitmaps" configuration variable to allow users to tell "git push" not to use bitmaps. We already have "pack.bitmaps" that controls the use of bitmaps, but a separate configuration variable allows the reachability bitmaps to still be used in other areas, such as "git upload-pack", while disabling it only for "git push". [1]: https://lore.kernel.org/git/87zhoz8b9o.fsf@evledraar.gmail.com/ Signed-off-by: Kyle Zhao --- send-pack.c: add config push.useBitmaps This patch add config push.useBitmaps to prevent git push using bitmap. The origin discussion is here: https://lore.kernel.org/git/b940e705fbe9454685757f2e3055e2ce@tencent.com/ Thanks, -Kyle Changes since v1: * changed the commit message * modified and added missing \n to push.txt * used test_subcommand for test * modified "if" statement for "git_config_get_bool()" in send-pack.c Changes since v2: * enable 'push.useBitmaps" by default * fix nit in t/t5516-fetch-push.sh Changes since v3: * changed the commit message * s/no_use_bitmaps/disable_bitmaps in send-pack.h and send-pack.c * I modified the document about "push.useBitmaps". When it is true, Git will keep the historical behaviour. So I mainly introduced what happens when it set to false. * use test_config and test_unconfig for test. Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1263%2Fkeyu98%2Fkz%2Fpush-usebitmps-config-v4 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1263/keyu98/kz/push-usebitmps-config-v4 Pull-Request: https://github.com/gitgitgadget/git/pull/1263 Range-diff vs v3: 1: a523cb52542 ! 1: 9d35d926638 send-pack.c: add config push.useBitmaps @@ Metadata ## Commit message ## send-pack.c: add config push.useBitmaps - This allows you to disable bitmaps for "git push". Default is true. - Reachability bitmaps are designed to speed up the "counting objects" phase of generating a pack during a clone or fetch. They are not optimized for Git clients sending a small topic branch via "git push". In some cases (see [1]), using reachability bitmaps during "git push" can cause significant performance regressions. - Add a new "push.useBitmaps" config option to disable reachability - bitmaps during "git push". This allows reachability bitmaps to still - be used in other areas, such as "git rev-list --use-bitmap-index". + Add a new "push.useBitmaps" configuration variable to allow users to + tell "git push" not to use bitmaps. We already have "pack.bitmaps" + that controls the use of bitmaps, but a separate configuration variable + allows the reachability bitmaps to still be used in other areas, + such as "git upload-pack", while disabling it only for "git push". [1]: https://lore.kernel.org/git/87zhoz8b9o.fsf@evledraar.gmail.com/ @@ Documentation/config/push.txt: push.negotiate:: in common. + +push.useBitmaps:: -+ If this config and `pack.useBitmaps` are both `true`, then Git will -+ use reachability bitmaps during `git push`, if available. If set to -+ `false`, may improve push performance without affecting use of the -+ reachability bitmaps for other operations. Default is true. ++ If set to "false", disable use of bitmaps for "git push" even if ++ `pack.useBitmaps` is "true", without preventing other git operations ++ from using bitmaps. Default is true. ## send-pack.c ## @@ send-pack.c: static int pack_objects(int fd, struct ref *refs, struct oid_array *advertised, strvec_push(&po.args, "--progress"); if (is_repository_shallow(the_repository)) strvec_push(&po.args, "--shallow"); -+ if (args->no_use_bitmaps) ++ if (args->disable_bitmaps) + strvec_push(&po.args, "--no-use-bitmap-index"); po.in = -1; po.out = args->stateless_rpc ? -1 : fd; @@ send-pack.c: int send_pack(struct send_pack_args *args, get_commons_through_negotiation(args->url, remote_refs, &commons); + if (!git_config_get_bool("push.usebitmaps", &use_bitmaps)) -+ args->no_use_bitmaps = !use_bitmaps; ++ args->disable_bitmaps = !use_bitmaps; + git_config_get_bool("transfer.advertisesid", &advertise_sid); @@ send-pack.h: struct send_pack_args { stateless_rpc:1, - atomic:1; + atomic:1, -+ no_use_bitmaps:1; ++ disable_bitmaps:1; const struct string_list *push_options; }; @@ t/t5516-fetch-push.sh: test_expect_success 'push warns or fails when using usern +test_expect_success 'push with config push.useBitmaps' ' + mk_test testrepo heads/main && + git checkout main && ++ test_unconfig push.useBitmaps && + GIT_TRACE2_EVENT="$PWD/default" \ + git push testrepo main:test && + test_subcommand git pack-objects --all-progress-implied --revs --stdout \ + --thin --delta-base-offset -q disable_bitmaps) + strvec_push(&po.args, "--no-use-bitmap-index"); po.in = -1; po.out = args->stateless_rpc ? -1 : fd; po.git_cmd = 1; @@ -487,6 +489,7 @@ int send_pack(struct send_pack_args *args, struct async demux; const char *push_cert_nonce = NULL; struct packet_reader reader; + int use_bitmaps; if (!remote_refs) { fprintf(stderr, "No refs in common and none specified; doing nothing.\n" @@ -498,6 +501,9 @@ int send_pack(struct send_pack_args *args, if (push_negotiate) get_commons_through_negotiation(args->url, remote_refs, &commons); + if (!git_config_get_bool("push.usebitmaps", &use_bitmaps)) + args->disable_bitmaps = !use_bitmaps; + git_config_get_bool("transfer.advertisesid", &advertise_sid); /* Does the other end support the reporting? */ diff --git a/send-pack.h b/send-pack.h index e148fcd9609..7edb80596c7 100644 --- a/send-pack.h +++ b/send-pack.h @@ -26,7 +26,8 @@ struct send_pack_args { /* One of the SEND_PACK_PUSH_CERT_* constants. */ push_cert:2, stateless_rpc:1, - atomic:1; + atomic:1, + disable_bitmaps:1; const struct string_list *push_options; }; diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index dedca106a7a..b3734dd2fe9 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -1865,4 +1865,26 @@ test_expect_success 'push warns or fails when using username:password' ' test_line_count = 1 warnings ' +test_expect_success 'push with config push.useBitmaps' ' + mk_test testrepo heads/main && + git checkout main && + test_unconfig push.useBitmaps && + GIT_TRACE2_EVENT="$PWD/default" \ + git push testrepo main:test && + test_subcommand git pack-objects --all-progress-implied --revs --stdout \ + --thin --delta-base-offset -q