diff options
| author | Vicent Marti <tanoku@gmail.com> | 2015-10-14 19:24:07 +0200 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2015-10-14 19:24:07 +0200 |
| commit | 43820f204ea32503b4083e3b6b83f30a0a0031c9 (patch) | |
| tree | 0e79fa29625b47f41d1b750f6eccd66845602666 /include/git2/sys/odb_backend.h | |
| parent | ac7e50dd37e310b35175111904ca3da75423b735 (diff) | |
| download | libgit2-43820f204ea32503b4083e3b6b83f30a0a0031c9.tar.gz | |
odb: Be smarter when refreshing backends
In the current implementation of ODB backends, each backend is tasked
with refreshing itself after a failed lookup. This is standard Git
behavior: we want to e.g. reload the packfiles on disk in case they have
changed and that's the reason we can't find the object we're looking
for.
This behavior, however, becomes pathological in repositories where
multiple alternates have been loaded. Given that each alternate counts
as a separate backend, a miss in the main repository (which can
potentially be very frequent in cases where object storage comes from
the alternate) will result in refreshing all its packfiles before we
move on to the alternate backend where the object will most likely be
found.
To fix this, the code in `odb.c` has been refactored as to perform the
refresh of all the backends externally, once we've verified that the
object is nowhere to be found.
If the refresh is successful, we then perform the lookup sequentially
through all the backends, skipping the ones that we know for sure
weren't refreshed (because they have no refresh API).
The on-disk pack backend has been adjusted accordingly: it no longer
performs refreshes internally.
Diffstat (limited to 'include/git2/sys/odb_backend.h')
0 files changed, 0 insertions, 0 deletions
