Skip to content

Conversation

rremer
Copy link
Contributor

@rremer rremer commented Aug 18, 2025

The following configuration key is exposed, defaulting to the current behavior (backwards-compatible):

[git]
  ENABLE_COMMIT_GRAPH_WRITE = true

Provides a workaround for intermittent mirror-sync failures in #33239 , as well as significant optimization to sync time for very large repositories.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 18, 2025
@github-actions github-actions bot added modifies/go Pull requests that update Go code docs-update-needed The document needs to be updated synchronously labels Aug 18, 2025
@rremer
Copy link
Contributor Author

rremer commented Aug 18, 2025

There's also this related comment in a different bug describing potential features in Gitea to handle stale lockfiles, but in reality I don't see this as clearly a Gitea problem to solve, as either:
a) it's a race condition where two processes (either managed by a golang Context or not) are trying to write a commit graph at once... arguably this could be handled better by Gitea
b) it's a stale lockfile because the git client itself exited nonzero, in which case the fix should be in git/git

I opened this PR as an alternative to deciding which (if either) to explore, because for the case of very large repositories the commit graph is very expensive to write (I have 4 repositories, each of which takes more than 1m20s to writeCommitGraph), and I haven't been able to prove the value of it for regular git fetches in my environments.

@rremer
Copy link
Contributor Author

rremer commented Aug 18, 2025

And a corresponding docs update if this is merged in: https://gitea.com/gitea/docs/pulls/264

@rremer rremer force-pushed the configurable-commit-graph-write branch from 1597d53 to 2b57ddb Compare August 18, 2025 23:07
@lunny
Copy link
Member

lunny commented Aug 19, 2025

The commit graph is intended for performance optimization, so I don’t think we should ignore it. Regarding #33239, it might have been caused by two mirror tasks running in parallel. I think we could add some locks to prevent to two mirror tasks running in the same repository.

@rremer
Copy link
Contributor Author

rremer commented Aug 19, 2025

The commit graph is intended for performance optimization, so I don’t think we should ignore it.

My request is that we make the option of disabling it available. For use-cases where there are very large repositories with extremely high commits rates (mono repos), commit-graphs don't actually provide any value, and actually impart a performance hit while generating the graph.

@lunny
Copy link
Member

lunny commented Aug 19, 2025

So that maybe it should be a per repository configuration item?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-update-needed The document needs to be updated synchronously lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants