Commit 62374038 authored by Kirill Smelkov's avatar Kirill Smelkov

pull: Turns unused refs are removed not 100% and a lot of empty directories are accumulated

Even though we delete all temporary refs after pull, git leaves empty
directories in the place where the refs were - for example if there was
a ref

    dir/ref

and we delete ref `ref`, empty dir/ is still leaved there.

That increasingly hurts next pull performance a lot - before pulling git
wants to scan all local refs, and while doing so it descends into all
directories under refs/.

As after several pulls we can have many such empty directories under
refs/backup/, this scanning can take quite some time: e.g. for
lab.nexedi.com normal pull currently takes ~3 minutes, but after doing
pull ~60 times, it can become as bad as ~10 minutes for one pull. And
all that slowness goes away after cleaning refs/backup/ manually.

/cc https://lab.nexedi.com/lab.nexedi.com/lab.nexedi.com/issues/4
parent ac60eb17
......@@ -535,6 +535,15 @@ def cmd_pull_(pullspecv):
# remove no-longer needed backup refs & verify they don't stay
# FIXME `delete` deletes only files, but leaves empty dirs around.
# more important: this affect performance of future `git-backup pull` run a *LOT*
#
# reason is: `git pull` first check local refs, and for doing so it
# recourse into all directories, even empty ones.
#
# https://lab.nexedi.com/lab.nexedi.com/lab.nexedi.com/issues/4
#
# -> TODO also remove empty directories.
backup_refs_delete = ''
for _ in backup_refs_list.splitlines():
sha1, type_, ref = _.split()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment