git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jonathan Tan <jonathantanmy@google.com>,
	Jeff King <peff@peff.net>,
	Jeff Hostetler <jeffhost@microsoft.com>,
	Eric Sunshine <sunshine@sunshineco.com>
Subject: [PATCH jn/test-lint-one-shot-export-to-shell-function] fetch test: mark test of "skipping" haves as v0-only
Date: Thu, 26 Dec 2019 15:12:51 -0800	[thread overview]
Message-ID: <20191226231251.GC186931@google.com> (raw)
In-Reply-To: <xmqq7e2ilu1j.fsf@gitster-ct.c.googlers.com>

Since 633a53179e (fetch test: avoid use of "VAR= cmd" with a shell
function, 2019-12-26), t5552.5 (do not send "have" with ancestors of
commits that server ACKed) fails when run with
GIT_TEST_PROTOCOL_VERSION=2.

The cause:

The progression of "have"s sent in negotiation depends on whether we
are using a stateless RPC based transport or a stateful bidirectional
one (see for example 44d8dc54e7, "Fix potential local deadlock during
fetch-pack", 2011-03-29).  In protocol v2, all transports are
stateless transports, while in protocol v0, transports such as local
access and ssh are stateful.

In stateful transports, the number of "have"s to send multiplies by
two each round until we reach PIPESAFE_FLUSH (that is, 32), and then
it increases by PIPESAFE_FLUSH each round.  In stateless transport,
the count multiplies by two each round until we reach LARGE_FLUSH
(which is 16384) and then multiplies by 1.1 each round after that.

Moreover, in stateful transports, as fetch-pack.c explains:

	We keep one window "ahead" of the other side, and will wait
	for an ACK only on the next one.

This affects t5552.5 because it looks for "have"s from the negotiator
that appear in that second window.  With protocol version 2, the
second window never arrives, and the test fails.

Until 633a53179e (2019-12-26), a previous test in the same file
contained

	GIT_TEST_PROTOCOL_VERSION= trace_fetch client origin to_fetch

In many common shells (e.g. bash when run as "sh"), the setting of
GIT_TEST_PROTOCOL_VERSION to the empty string lasts beyond the
intended duration of the trace_fetch invocation.  This causes it to
override the GIT_TEST_PROTOCOL_VERSION setting that was passed in to
the test during the remainder of the test script, so t5552.5 never got
run using protocol v2 on those shells, regardless of the
GIT_TEST_PROTOCOL_VERSION setting from the environment.  633a53179e
fixed that, revealing the failing test.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Junio C Hamano wrote:

> The tip of "promote proto v2 to default" series fails at 5552.5
> with or without these two patches, though.

Here's the promised fix, against
jn/test-lint-one-shot-export-to-shell-function.  Thanks again.

 t/t5552-skipping-fetch-negotiator.sh | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/t/t5552-skipping-fetch-negotiator.sh b/t/t5552-skipping-fetch-negotiator.sh
index a452fe32fa..8f25f4b31f 100755
--- a/t/t5552-skipping-fetch-negotiator.sh
+++ b/t/t5552-skipping-fetch-negotiator.sh
@@ -173,7 +173,17 @@ test_expect_success 'do not send "have" with ancestors of commits that server AC
 	test_commit -C server commit-on-b1 &&
 
 	test_config -C client fetch.negotiationalgorithm skipping &&
-	trace_fetch client "$(pwd)/server" to_fetch &&
+
+	# NEEDSWORK: The number of "have"s sent depends on whether the transport
+	# is stateful. If the overspecification of the result were reduced, this
+	# test could be used for both stateful and stateless transports.
+	(
+		# Force protocol v0, in which local transport is stateful (in
+		# protocol v2 it is stateless).
+		GIT_TEST_PROTOCOL_VERSION=0 &&
+		export GIT_TEST_PROTOCOL_VERSION &&
+		trace_fetch client "$(pwd)/server" to_fetch
+	) &&
 	grep "  fetch" trace &&
 
 	# fetch-pack sends 2 requests each containing 16 "have" lines before
-- 
2.24.1.735.g03f4e72817


  parent reply	other threads:[~2019-12-26 23:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-24  0:58 [PATCH 0/5] Enable protocol v2 by default Jonathan Nieder
2019-12-24  0:59 ` [PATCH 1/5] fetch test: use more robust test for filtered objects Jonathan Nieder
2019-12-26 14:29   ` Derrick Stolee
2019-12-24  1:00 ` [PATCH 2/5] config doc: protocol.version is not experimental Jonathan Nieder
2019-12-24  1:01 ` [PATCH 3/5] test: request GIT_TEST_PROTOCOL_VERSION=0 when appropriate Jonathan Nieder
2019-12-26 19:26   ` Junio C Hamano
2019-12-26 19:53     ` [PATCH 0/2] avoid use of "VAR= cmd" with a shell function (Re: [PATCH 3/5] test: request GIT_TEST_PROTOCOL_VERSION=0 when appropriate) Jonathan Nieder
2019-12-26 19:55       ` [PATCH 1/2] fetch test: avoid use of "VAR= cmd" with a shell function Jonathan Nieder
2019-12-26 19:57       ` [PATCH 2/2] t/check-non-portable-shell: detect "FOO= shell_func", too Jonathan Nieder
2019-12-26 20:08         ` Junio C Hamano
2019-12-26 20:18         ` Junio C Hamano
2019-12-26 22:37           ` Jonathan Nieder
2019-12-26 23:12           ` Jonathan Nieder [this message]
2019-12-26 20:39         ` Eric Sunshine
2019-12-24  1:02 ` [PATCH 4/5] protocol test: let protocol.version override GIT_TEST_PROTOCOL_VERSION Jonathan Nieder
2019-12-24  1:04 ` [PATCH 5/5] fetch: default to protocol version 2 Jonathan Nieder
2019-12-26 14:30 ` [PATCH 0/5] Enable protocol v2 by default Derrick Stolee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191226231251.GC186931@google.com \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jeffhost@microsoft.com \
    --cc=jonathantanmy@google.com \
    --cc=peff@peff.net \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).