fetch-pack: add tracing for negotiation rounds
Currently, negotiation for V0/V1/V2 fetch have trace2 regions covering the entire negotiation process. However, we'd like additional data, such as timing for each round of negotiation or the number of "haves" in each round. Additionally, "independent negotiation" (AKA push negotiation) has no tracing at all. Having this data would allow us to compare the performance of the various negotation implementations, and to debug unexpectedly slow fetch & push sessions. Add per-round trace2 regions for all negotiation implementations (V0+V1, V2, and independent negotiation), as well as an overall region for independent negotiation. Add trace2 data logging for the number of haves and "in vain" objects for each round, and for the total number of rounds once negotiation completes. Finally, add a few checks into various tests to verify that the number of rounds is logged as expected. Signed-off-by: Josh Steadmon <steadmon@google.com> Acked-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
afa70145a2
commit
a29263cf5f
@ -200,7 +200,10 @@ test_expect_success 'push with negotiation' '
|
||||
test_commit -C testrepo unrelated_commit &&
|
||||
git -C testrepo config receive.hideRefs refs/remotes/origin/first_commit &&
|
||||
test_when_finished "rm event" &&
|
||||
GIT_TRACE2_EVENT="$(pwd)/event" git -c protocol.version=2 -c push.negotiate=1 push testrepo refs/heads/main:refs/remotes/origin/main &&
|
||||
GIT_TRACE2_EVENT="$(pwd)/event" \
|
||||
git -c protocol.version=2 -c push.negotiate=1 \
|
||||
push testrepo refs/heads/main:refs/remotes/origin/main &&
|
||||
grep \"key\":\"total_rounds\",\"value\":\"1\" event &&
|
||||
grep_wrote 2 event # 1 commit, 1 tree
|
||||
'
|
||||
|
||||
@ -224,7 +227,10 @@ test_expect_success 'push with negotiation does not attempt to fetch submodules'
|
||||
git push testrepo $the_first_commit:refs/remotes/origin/first_commit &&
|
||||
test_commit -C testrepo unrelated_commit &&
|
||||
git -C testrepo config receive.hideRefs refs/remotes/origin/first_commit &&
|
||||
git -c submodule.recurse=true -c protocol.version=2 -c push.negotiate=1 push testrepo refs/heads/main:refs/remotes/origin/main 2>err &&
|
||||
GIT_TRACE2_EVENT="$(pwd)/event" git -c submodule.recurse=true \
|
||||
-c protocol.version=2 -c push.negotiate=1 \
|
||||
push testrepo refs/heads/main:refs/remotes/origin/main 2>err &&
|
||||
grep \"key\":\"total_rounds\",\"value\":\"1\" event &&
|
||||
! grep "Fetching submodule" err
|
||||
'
|
||||
|
||||
|
Reference in New Issue
Block a user