/** * Add compactable oplogs to the list, up to the maximum size. * @param l * @param max */ public void getCompactableOplogs(List<CompactableOplog> l, int max) { synchronized (this.oplogIdToOplog) { // Sort this list so we compact the oldest first instead of the one // that was // compactable first. // ArrayList<CompactableOplog> l = new // ArrayList<CompactableOplog>(this.oplogIdToOplog.values()); // Collections.sort(l); // Iterator<Oplog> itr = l.iterator(); { Iterator<Oplog> itr = this.oplogIdToOplog.values().iterator(); while (itr.hasNext() && l.size() < max) { Oplog oplog = itr.next(); if (oplog.needsCompaction()) { l.add(oplog); } } } } }
/** * Add compactable oplogs to the list, up to the maximum size. * @param l * @param max */ public void getCompactableOplogs(List<CompactableOplog> l, int max) { synchronized (this.oplogIdToOplog) { // Sort this list so we compact the oldest first instead of the one // that was // compactable first. // ArrayList<CompactableOplog> l = new // ArrayList<CompactableOplog>(this.oplogIdToOplog.values()); // Collections.sort(l); // Iterator<Oplog> itr = l.iterator(); { Iterator<Oplog> itr = this.oplogIdToOplog.values().iterator(); while (itr.hasNext() && l.size() < max) { Oplog oplog = itr.next(); if (oplog.needsCompaction()) { l.add(oplog); } } } } }
boolean basicForceCompaction(DiskRegion dr) { PersistentOplogSet oplogSet = persistentOplogs; // see if the current active oplog is compactable; if so { Oplog active = oplogSet.getChild(); if (active != null) { if (active.hadLiveEntries() && active.needsCompaction()) { active.forceRolling(dr); } } } //Compact the oplogs CompactableOplog[] oplogs = getOplogsToBeCompacted(true/* fixes 41143 */); // schedule a compaction if at this point there are oplogs to be compacted if (oplogs != null) { if (this.oplogCompactor != null) { if (this.oplogCompactor.scheduleIfNeeded(oplogs)) { this.oplogCompactor.waitForRunToComplete(); } else { oplogs = null; // @todo darrel: still need to schedule oplogs and wait for them to // compact. } } } return oplogs != null; }
boolean basicForceCompaction(DiskRegion dr) { PersistentOplogSet oplogSet = persistentOplogs; // see if the current active oplog is compactable; if so { Oplog active = oplogSet.getChild(); if (active != null) { if (active.hadLiveEntries() && active.needsCompaction()) { active.forceRolling(dr, false); } } } //Compact the oplogs CompactableOplog[] oplogs = getOplogsToBeCompacted(true/* fixes 41143 */); // schedule a compaction if at this point there are oplogs to be compacted if (oplogs != null) { if (this.oplogCompactor != null) { if (this.oplogCompactor.scheduleIfNeeded(oplogs)) { this.oplogCompactor.waitForRunToComplete(); } else { oplogs = null; // logger.info(LocalizedStrings.DEBUG, "DEBUG: todo "); // @todo darrel: still need to schedule oplogs and wait for them to // compact. } } } return oplogs != null; }
deleteFile(this.drf); } else if (needsCompaction()) {
this.oplogId, (entryCausingSwitch != null ? entryCausingSwitch.getDiskId() : "null Entry")); if (needsCompaction()) { addToBeCompacted(); } else {
} else if (needsCompaction()) { addToBeCompacted();
deleteFile(this.drf); } else if (needsCompaction()) {
} else if (needsCompaction()) { addToBeCompacted();
if (!needsCompaction()) { return 0; // @todo check new logic that deals with not compacting oplogs
if (!needsCompaction()) { return 0; // @todo check new logic that deals with not compacting oplogs which have unrecovered regions
.toString() : "null Entry")); if (needsCompaction()) { addToBeCompacted(); } else {