Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] Welcome to the "jgit-dev" mailing list

5.10.0.202012080955-r, this is the version that I am working on. 
I am pretty sure I run git.gc().call(), but GC only repack the reachable objects, they does not actually clean up such pack files. 

regards,
Tingting 


On Fri, Mar 12, 2021 at 2:03 PM Matthias Sohn <matthias.sohn@xxxxxxxxx> wrote:
On Fri, Mar 12, 2021 at 8:56 PM TINGTING ZHOU <zhoutt96@xxxxxxxxx> wrote:

Why are you looking at an 8 year old version of jgit ?
 
Runs a garbage collector on a FileRepository. It will
  • pack loose references into packed-refs
  • repack all reachable objects into new pack files and delete the old pack files
  • prune all loose objects which are now reachable by packs
It only repacks repack all reachable objects into new pack files and delete the old pack files, but if you set preReceiveHook or setMaxPackSizeLimit to reject the push if it exceeds the limit, the garbage pack files generated are actually non-reachable. It can not be autoGC in JGIT. That's matches the results in my testing.

The first version of autogc was implemented in 4.6.0. Don't know which version you use.
Did you try to run gc explicitly ?
 
On Fri, Mar 12, 2021 at 11:36 AM TINGTING ZHOU <zhoutt96@xxxxxxxxx> wrote:
You mention "The next GC will delete garbage packs containing unreferenced objects."
Actually, it does not clean up the unreferenced pack files. I have tested using git.gc().

On Fri, Mar 12, 2021 at 9:10 AM TINGTING ZHOU <zhoutt96@xxxxxxxxx> wrote:
There are two solutions.
1. Use setMaxPackSize as you said, but the receptacle.sendError does not work in this case, how could I send customized error messages to users if I use setMaxPackSize?

2. Use preReceiveHook, and check the pack size in preReceive, and there are some unreferenced packs generated. And I don’t think GC cleaned these unreferenced packs.

Thanks.

On Fri, Mar 12, 2021 at 3:18 AM Matthias Sohn <matthias.sohn@xxxxxxxxx> wrote:
On Fri, Mar 12, 2021 at 9:24 AM TINGTING ZHOU <zhoutt96@xxxxxxxxx> wrote:
Hi JGit team,
     I run into some bugs when using the ReceivePack and PreReceivePack to reject some git pushes operations if the packSize exceeds the limit we set.
     The problem is even though the command is rejected, the packs is also written to the server, and these pack files will never be touched, which becomes garbage packfiles. I spend some time to look into your code, actually, the write pack operation happens before the preReceivePack. Any solution to avoid these garbage packs? Thanks.

the subject of your thread is misleading ...

Are you calling ReceivePack.setMaxPackSizeLimit ?
It throws TooLargePackException if the limit is exceeded while receiving a pack.

The next gc will delete garbage packs containing unreferenced objects.

-Matthias


Back to the top