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

plumbing: cache, modify cache to delete more than one item to free space #720

Merged

Conversation

Projects
None yet
4 participants
@jfontan
Copy link
Member

commented Jan 16, 2018

The previous version could only delete the oldest used object. If the
object to cache was bigger than the space freed it could not be added.

Also the decoder adds bases to the cache when they are needed.

This change increases the speed creating indexes 2x.

Modify cache to delete more than one item to free space
The previous version could only delete the oldest used object. If the
object to cache was bigger than the space freed it could not be added.

Also the decoder adds bases to the cache when they are needed.

This change increases the speed creating indexes 2x.

Signed-off-by: Javi Fontan <jfontan@gmail.com>
@@ -55,18 +55,14 @@ func (c *ObjectLRU) Put(obj plumbing.EncodedObject) {
return
}

if c.actualSize+objSize > c.MaxSize {
for c.actualSize+objSize > c.MaxSize {

This comment has been minimized.

Copy link
@ajnavarro

ajnavarro Jan 16, 2018

Member

Should we check if the object to add is bigger than the cache size to do not remove everything?

This comment has been minimized.

Copy link
@ajnavarro

ajnavarro Jan 16, 2018

Member

nevermind, is already checked before the for.

@mcuadros

This comment has been minimized.

Copy link
Member

commented Jan 16, 2018

Will be nice have a test here.

jfontan added some commits Jan 16, 2018

Cache should hold objects the same size as MaxSize
Signed-off-by: Javi Fontan <jfontan@gmail.com>
Test eviction of more than one object
Signed-off-by: Javi Fontan <jfontan@gmail.com>

@mcuadros mcuadros changed the title Modify cache to delete more than one item to free space plumbing: cache, modify cache to delete more than one item to free space Jan 16, 2018

@mcuadros mcuadros merged commit e9247ce into src-d:master Jan 16, 2018

3 checks passed

codecov/project 77.17% (+0.01%) compared to 4d43799
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

jfontan added a commit to jfontan/go-git that referenced this pull request Jan 24, 2018

plumbing: format/packfile, fix crash with cycle deltas
Resolving cycles relied on ObjectToPack objects having Original. This
is no longer true with the changes from src-d#720. This commit changes:

* Save original type, hash and size in ObjectToPack
* Use SetObject to set both Original and resolved type, hash and size
* Restore original object before using BackToOriginal (cycle resolution)
* Update encoder test to check this case

Signed-off-by: Javi Fontan <jfontan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.