new DfsGarbageCollector((DfsRepository) repo); gc.setPackConfig(pconfig); gc.pack(monitor); return new Properties(); } else {
objdb.clearCache(); refsBefore = getAllRefs(); readPacksBefore(); readReftablesBefore(); continue; if (isHead(ref)) { allHeads.add(ref.getObjectId()); } else if (isTag(ref)) { allTags.add(ref.getObjectId()); } else if (RefTreeNames.isRefTree(refdb, ref.getName())) { packHeads(pm); packRest(pm); packRefTreeGraph(pm); packGarbage(pm); objdb.commitPack(newPackDesc, toPrune()); rollback = false; return true;
private void packHeads(ProgressMonitor pm) throws IOException { if (allHeadsAndTags.isEmpty()) { writeReftable(); return; } try (PackWriter pw = newPackWriter()) { pw.setTagTargets(tagTargets); pw.preparePack(pm, allHeadsAndTags, NONE, NONE, allTags); if (0 < pw.getObjectCount()) { long estSize = estimateGcPackSize(INSERT, RECEIVE, COMPACT, GC); writePack(GC, pw, pm, estSize); } else { writeReftable(); } } }
private void packRest(ProgressMonitor pm) throws IOException { if (nonHeads.isEmpty()) return; try (PackWriter pw = newPackWriter()) { for (ObjectIdSet packedObjs : newPackObj) pw.excludeObjects(packedObjs); pw.preparePack(pm, nonHeads, allHeadsAndTags); if (0 < pw.getObjectCount()) writePack(GC_REST, pw, pm, estimateGcPackSize(INSERT, RECEIVE, COMPACT, GC_REST)); } }
private void packRefTreeGraph(ProgressMonitor pm) throws IOException { if (txnHeads.isEmpty()) return; try (PackWriter pw = newPackWriter()) { for (ObjectIdSet packedObjs : newPackObj) pw.excludeObjects(packedObjs); pw.preparePack(pm, txnHeads, NONE); if (0 < pw.getObjectCount()) writePack(GC_TXN, pw, pm, 0 /* unknown pack size */); } }
objdb.clearCache(); Collection<Ref> refsBefore = getAllRefs(); readPacksBefore(); objdb.commitPack(noPacks(), toPrune()); if (ref.isSymbolic() || ref.getObjectId() == null) continue; if (isHead(ref)) allHeads.add(ref.getObjectId()); else if (RefTreeNames.isRefTree(refdb, ref.getName())) packHeads(pm); packRest(pm); packRefTreeGraph(pm); packGarbage(pm); objdb.commitPack(newPackDesc, toPrune()); rollback = false; return true;
public static void garbageCollect(DfsRepository repo) throws IOException { new DfsGarbageCollector(repo).pack(NullProgressMonitor.INSTANCE); }
pw.setDeltaBaseAsOffset(true); pw.setReuseDeltaCommits(true); pm.beginTask(JGitText.get().findingGarbage, objectsBefore()); long estimatedPackSize = 12 + 20; // header and trailer sizes. for (DfsPackFile oldPack : packsBefore) { pm.update(1); ObjectId id = ent.toObjectId(); if (pool.lookupOrNull(id) != null || anyPackHas(id)) continue; writePack(UNREACHABLE_GARBAGE, pw, pm, estimatedPackSize);
private void readPacksBefore() throws IOException { DfsPackFile[] packs = objdb.getPacks(); packsBefore = new ArrayList<>(packs.length); expiredGarbagePacks = new ArrayList<>(packs.length); long now = SystemReader.getInstance().getCurrentTime(); for (DfsPackFile p : packs) { DfsPackDescription d = p.getPackDescription(); if (d.getPackSource() != UNREACHABLE_GARBAGE) { packsBefore.add(p); } else if (packIsExpiredGarbage(d, now)) { expiredGarbagePacks.add(p); } else if (packIsCoalesceableGarbage(d, now)) { packsBefore.add(p); } } }
private void readPacksBefore() throws IOException { DfsPackFile[] packs = objdb.getPacks(); packsBefore = new ArrayList<DfsPackFile>(packs.length); expiredGarbagePacks = new ArrayList<DfsPackFile>(packs.length); long mostRecentGC = mostRecentGC(packs); long now = System.currentTimeMillis(); for (DfsPackFile p : packs) { DfsPackDescription d = p.getPackDescription(); if (d.getPackSource() != UNREACHABLE_GARBAGE) { packsBefore.add(p); } else if (packIsExpiredGarbage(d, mostRecentGC, now)) { expiredGarbagePacks.add(p); } else if (d.getFileSize(PackExt.PACK) < coalesceGarbageLimit) { packsBefore.add(p); } } }
public static void garbageCollect(DfsRepository repo) throws IOException { new DfsGarbageCollector(repo).pack(NullProgressMonitor.INSTANCE); }
private void packGarbage(ProgressMonitor pm) throws IOException { PackConfig cfg = new PackConfig(packConfig); cfg.setReuseDeltas(true); cfg.setReuseObjects(true); cfg.setDeltaCompress(false); cfg.setBuildBitmaps(false); try (PackWriter pw = new PackWriter(cfg, ctx); RevWalk pool = new RevWalk(ctx)) { pw.setDeltaBaseAsOffset(true); pw.setReuseDeltaCommits(true); pm.beginTask(JGitText.get().findingGarbage, objectsBefore()); for (DfsPackFile oldPack : packsBefore) { PackIndex oldIdx = oldPack.getPackIndex(ctx); for (PackIndex.MutableEntry ent : oldIdx) { pm.update(1); ObjectId id = ent.toObjectId(); if (pool.lookupOrNull(id) != null || anyPackHas(id)) continue; int type = oldPack.getObjectType(ctx, ent.getOffset()); pw.addObject(pool.lookupAny(id, type)); } } pm.endTask(); if (0 < pw.getObjectCount()) writePack(UNREACHABLE_GARBAGE, pw, pm); } }
private void packRefTreeGraph(ProgressMonitor pm) throws IOException { if (txnHeads.isEmpty()) return; try (PackWriter pw = newPackWriter()) { for (ObjectIdSet packedObjs : newPackObj) pw.excludeObjects(packedObjs); pw.preparePack(pm, txnHeads, NONE); if (0 < pw.getObjectCount()) writePack(GC_TXN, pw, pm, 0 /* unknown pack size */); } }
private void packRest(ProgressMonitor pm) throws IOException { if (nonHeads.isEmpty()) return; try (PackWriter pw = newPackWriter()) { for (ObjectIdSet packedObjs : newPackObj) pw.excludeObjects(packedObjs); pw.preparePack(pm, nonHeads, allHeadsAndTags); if (0 < pw.getObjectCount()) writePack(GC_REST, pw, pm, estimateGcPackSize(INSERT, RECEIVE, COMPACT, GC_REST)); } }
private void readPacksBefore() throws IOException { DfsPackFile[] packs = objdb.getPacks(); packsBefore = new ArrayList<>(packs.length); expiredGarbagePacks = new ArrayList<>(packs.length); long now = SystemReader.getInstance().getCurrentTime(); for (DfsPackFile p : packs) { DfsPackDescription d = p.getPackDescription(); if (d.getPackSource() != UNREACHABLE_GARBAGE) { packsBefore.add(p); } else if (packIsExpiredGarbage(d, now)) { expiredGarbagePacks.add(p); } else if (packIsCoalesceableGarbage(d, now)) { packsBefore.add(p); } } }
objdb.clearCache(); refsBefore = getAllRefs(); readPacksBefore(); readReftablesBefore(); continue; if (isHead(ref)) { allHeads.add(ref.getObjectId()); } else if (isTag(ref)) { allTags.add(ref.getObjectId()); } else if (RefTreeNames.isRefTree(refdb, ref.getName())) { packHeads(pm); packRest(pm); packRefTreeGraph(pm); packGarbage(pm); objdb.commitPack(newPackDesc, toPrune()); rollback = false; return true;
new DfsGarbageCollector((DfsRepository) repo); gc.setPackConfig(pconfig); gc.pack(monitor); return new Properties(); } else {
public static void garbageCollect(@Nonnull DfsRepository repo) throws IOException { new DfsGarbageCollector(repo).pack(NullProgressMonitor.INSTANCE); }
pw.setDeltaBaseAsOffset(true); pw.setReuseDeltaCommits(true); pm.beginTask(JGitText.get().findingGarbage, objectsBefore()); long estimatedPackSize = 12 + 20; // header and trailer sizes. for (DfsPackFile oldPack : packsBefore) { pm.update(1); ObjectId id = ent.toObjectId(); if (pool.lookupOrNull(id) != null || anyPackHas(id)) continue; writePack(UNREACHABLE_GARBAGE, pw, pm, estimatedPackSize);
private void packHeads(ProgressMonitor pm) throws IOException { if (allHeadsAndTags.isEmpty()) { writeReftable(); return; } try (PackWriter pw = newPackWriter()) { pw.setTagTargets(tagTargets); pw.preparePack(pm, allHeadsAndTags, NONE, NONE, allTags); if (0 < pw.getObjectCount()) { long estSize = estimateGcPackSize(INSERT, RECEIVE, COMPACT, GC); writePack(GC, pw, pm, estSize); } else { writeReftable(); } } }