gitbase: use only one cache for all repositories#898
Merged
ajnavarro merged 1 commit intosrc-d:masterfrom Jun 21, 2019
Merged
Conversation
7c26f69 to
a3a82c9
Compare
Contributor
|
One question (not doubting, just want to understand better): what's the rationale for this change? |
Contributor
Author
@juanjux You are right, there was almost no description to the PR 🙈. I've updated the description with the problem it's fixing. |
kuba--
approved these changes
Jun 21, 2019
Contributor
|
@jfontan awesome description, thanks! |
juanjux
approved these changes
Jun 21, 2019
Also fix a bug getting the cache size from cli. Signed-off-by: Javi Fontan <jfontan@gmail.com>
a3a82c9 to
9e99020
Compare
Contributor
Author
|
I've just rebased with latest |
ajnavarro
approved these changes
Jun 21, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also fix a bug getting the cache size from cli.
Before integrating the use of
go-borgesrepositories were managed byRepositoryPool. When it was created it initialized a git object cache that is used by all the repositories. This cache is also used when using indexes and reading directly from packfiles (cache is retrieved withRepository.Cache(), https://github.com/src-d/gitbase/blob/master/packfiles.go#L239).Now
go-borgestakes care of repository libraries and retrieving go-git repositories from them. To make it work the same we initializego-borgeslibrary with a cache generated ingitbase(command.Server) but I forgot thatRepositoryPoolwas also generating a cache internally and returning it when callingRepository.Cache(). This means that there was two different objects caches, one for repositories opened without indexes and other for reading packfiles when the index was used. The problems are:The change makes
RepositoryPoolget an initialized cache that will be used by all repos (both with and without index).make upgradecommand if applicable.