GC: prune all packfiles after the loosen phase
When loosening the objects inside the packfiles to be pruned, make sure that the packfile list is stable and prune all the files after the loosening is done. This prevents a series of exceptions previously thrown when loosening the packfiles, due to the too early pruning of the packfiles that were still in the pack list. Bug: 581532 Change-Id: I776776e2e083f1fa749d53f965bf50f919823b4f
This commit is contained in:
parent
dd92c1aa98
commit
ac8d7838f0
|
@ -347,6 +347,7 @@ private void deleteOldPacks(Collection<Pack> oldPacks,
|
||||||
|
|
||||||
prunePreserved();
|
prunePreserved();
|
||||||
long packExpireDate = getPackExpireDate();
|
long packExpireDate = getPackExpireDate();
|
||||||
|
List<PackFile> packFilesToPrune = new ArrayList<>();
|
||||||
oldPackLoop: for (Pack oldPack : oldPacks) {
|
oldPackLoop: for (Pack oldPack : oldPacks) {
|
||||||
checkCancelled();
|
checkCancelled();
|
||||||
String oldName = oldPack.getPackName();
|
String oldName = oldPack.getPackName();
|
||||||
|
@ -364,9 +365,10 @@ private void deleteOldPacks(Collection<Pack> oldPacks,
|
||||||
loosen(inserter, reader, oldPack, ids);
|
loosen(inserter, reader, oldPack, ids);
|
||||||
}
|
}
|
||||||
oldPack.close();
|
oldPack.close();
|
||||||
prunePack(oldPack.getPackFile());
|
packFilesToPrune.add(oldPack.getPackFile());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
packFilesToPrune.forEach(this::prunePack);
|
||||||
|
|
||||||
// close the complete object database. That's my only chance to force
|
// close the complete object database. That's my only chance to force
|
||||||
// rescanning and to detect that certain pack files are now deleted.
|
// rescanning and to detect that certain pack files are now deleted.
|
||||||
|
|
Loading…
Reference in New Issue