Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git v2 client: keep the primary clone up to date #30520

Merged
merged 2 commits into from Aug 26, 2023

Conversation

listx
Copy link
Contributor

@listx listx commented Aug 26, 2023

The primary clone can get "stale" if it doesn't keep up with the changes
going into the upstream remote. Staleness can result in a performance
penalty for EnsureFreshSecondary(), because it would need to fetch more
objects to get to the commit SHAs specified in repoOpts.FetchCommits.

Git clients that are not using repoOpts.FetchCommits cannot get
stale, because they invoke the (expensive) RemoteUpdate() call on the
primary clone which fetches all refs. However, the primary clones for
inrepoconfigs can indeed get stale because it uses
repoOpts.FetchCommits to do targeted fetches only for the secondary
clone since bdd601c (git v2 client for inrepoconfig: allow targeted
fetches (2nd attempt), 2023-08-22).

Allow updating the primary clone with a new PrimaryCloneUpdateCommits
field to periodically update the primary clone with new commits. For
inrepoconfigs, we only specify the baseSHA because it may be that the
headSHAs never get merged into the base (perhaps the PR gets rejected or
abandoned).

The first commit in this PR refactors ensureCommits() so that it can be
reused as FetchCommits() in the interactor.

/cc @cjwagner @timwangmusic @airbornepony

Linus Arver added 2 commits August 25, 2023 17:19
Move the low-level git logic in ensureCommits() into a new
FetchCommits() method in the git interactor, because that's where
low-level git interactions belong.
The primary clone can get "stale" if it doesn't keep up with the changes
going into the upstream remote. Staleness can result in a performance
penalty for EnsureFreshSecondary(), because it would need to fetch more
objects to get to the commit SHAs specified in repoOpts.FetchCommits.

Git clients that are not using `repoOpts.FetchCommits` cannot get
stale, because they invoke the (expensive) RemoteUpdate() call on the
primary clone which fetches all refs. However, the primary clones for
inrepoconfigs can indeed get stale because it uses
`repoOpts.FetchCommits` to do targeted fetches only for the secondary
clone since bdd601c (git v2 client for inrepoconfig: allow targeted
fetches (2nd attempt), 2023-08-22).

Allow updating the primary clone with a new PrimaryCloneUpdateCommits
field to periodically update the primary clone with new commits. For
inrepoconfigs, we only specify the baseSHA because it may be that the
headSHAs never get merged into the base (perhaps the PR gets rejected or
abandoned).
@k8s-ci-robot
Copy link
Contributor

@listx: GitHub didn't allow me to request PR reviews from the following users: airbornepony.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

The primary clone can get "stale" if it doesn't keep up with the changes
going into the upstream remote. Staleness can result in a performance
penalty for EnsureFreshSecondary(), because it would need to fetch more
objects to get to the commit SHAs specified in repoOpts.FetchCommits.

Git clients that are not using repoOpts.FetchCommits cannot get
stale, because they invoke the (expensive) RemoteUpdate() call on the
primary clone which fetches all refs. However, the primary clones for
inrepoconfigs can indeed get stale because it uses
repoOpts.FetchCommits to do targeted fetches only for the secondary
clone since bdd601c (git v2 client for inrepoconfig: allow targeted
fetches (2nd attempt), 2023-08-22).

Allow updating the primary clone with a new PrimaryCloneUpdateCommits
field to periodically update the primary clone with new commits. For
inrepoconfigs, we only specify the baseSHA because it may be that the
headSHAs never get merged into the base (perhaps the PR gets rejected or
abandoned).

The first commit in this PR refactors ensureCommits() so that it can be
reused as FetchCommits() in the interactor.

/cc @cjwagner @timwangmusic @airbornepony

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. area/prow Issues or PRs related to prow sig/testing Categorizes an issue or PR as relevant to SIG Testing. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 26, 2023
@k8s-ci-robot
Copy link
Contributor

@listx: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-test-infra-unit-test-race-detector-nonblocking e46df0a link false /test pull-test-infra-unit-test-race-detector-nonblocking

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 26, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: listx, michelle192837

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 01e0d01 into kubernetes:master Aug 26, 2023
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/prow Issues or PRs related to prow cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants