rishabhdaim commented on code in PR #1795:
URL: https://github.com/apache/jackrabbit-oak/pull/1795#discussion_r1804133096
##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java:
##########
@@ -1160,75 +1172,82 @@ public void collectGarbage(final NodeDocument doc,
final GCPhases phases) {
greatestExistingAncestorOrSelf, name);
}
}
-
- if (fullGcMode == EMPTYPROPS) {
- if (!traversedState.exists()) {
- // doc is an orphan, this mode skips orphans
- if (AUDIT_LOG.isDebugEnabled()){
- AUDIT_LOG.debug("Skipping orphaned document [{}] for
mode [{}]", doc.getId(), fullGcMode);
- }
- return;
- }
- collectDeletedProperties(doc, phases, op, traversedState);
- } else if (!isDeletedOrOrphanedNode(traversedState,
greatestExistingAncestorOrSelf, phases, doc)) {
- // here the node is not orphaned which means that we can reach
the node from root
- switch(fullGcMode) {
- case NONE : {
- // shouldn't be reached
+
+ // start timer for collect garbage
+ timer.reset().start();
+ try {
+ if (fullGcMode == EMPTYPROPS) {
+ if (!traversedState.exists()) {
+ // doc is an orphan, this mode skips orphans
+ if (AUDIT_LOG.isDebugEnabled()){
+ AUDIT_LOG.debug("Skipping orphaned document [{}]
for mode [{}]", doc.getId(), fullGcMode);
+ }
return;
}
- case GAP_ORPHANS : {
- // this mode does neither unusedproprev, nor unmergedBC
- break;
- }
- case GAP_ORPHANS_EMPTYPROPS :
- case ALL_ORPHANS_EMPTYPROPS : {
- collectDeletedProperties(doc, phases, op,
traversedState);
- // this mode does neither unusedproprev, nor unmergedBC
- break;
- }
- case ORPHANS_EMPTYPROPS_KEEP_ONE_ALL_PROPS : {
- collectDeletedProperties(doc, phases, op,
traversedState);
- collectUnusedPropertyRevisions(doc, phases, op,
(DocumentNodeState) traversedState, false);
- combineInternalPropRemovals(doc, op);
- break;
- }
- case ORPHANS_EMPTYPROPS_KEEP_ONE_USER_PROPS : {
- collectDeletedProperties(doc, phases, op,
traversedState);
- collectUnusedPropertyRevisions(doc, phases, op,
(DocumentNodeState) traversedState, true);
- combineInternalPropRemovals(doc, op);
- break;
- }
- case ORPHANS_EMPTYPROPS_UNMERGED_BC : {
- collectDeletedProperties(doc, phases, op,
traversedState);
- collectUnmergedBranchCommits(doc, phases, op,
toModifiedMs);
- break;
- }
- case
ORPHANS_EMPTYPROPS_BETWEEN_CHECKPOINTS_WITH_UNMERGED_BC : {
- collectDeletedProperties(doc, phases, op,
traversedState);
- collectUnmergedBranchCommits(doc, phases, op,
toModifiedMs);
- collectRevisionsOlderThan24hAndBetweenCheckpoints(doc,
toModifiedMs, phases, op);
- break;
- }
- case ORPHANS_EMPTYPROPS_BETWEEN_CHECKPOINTS_NO_UNMERGED_BC
: {
- collectDeletedProperties(doc, phases, op,
traversedState);
- collectRevisionsOlderThan24hAndBetweenCheckpoints(doc,
toModifiedMs, phases, op);
- break;
+ collectDeletedProperties(doc, phases, op, traversedState);
+ } else if (!isDeletedOrOrphanedNode(traversedState,
greatestExistingAncestorOrSelf, phases, doc)) {
+ // here the node is not orphaned which means that we can
reach the node from root
+ switch(fullGcMode) {
+ case NONE : {
+ // shouldn't be reached
+ return;
+ }
+ case GAP_ORPHANS : {
+ // this mode does neither unusedproprev, nor
unmergedBC
+ break;
+ }
+ case GAP_ORPHANS_EMPTYPROPS :
+ case ALL_ORPHANS_EMPTYPROPS : {
+ collectDeletedProperties(doc, phases, op,
traversedState);
+ // this mode does neither unusedproprev, nor
unmergedBC
+ break;
+ }
+ case ORPHANS_EMPTYPROPS_KEEP_ONE_ALL_PROPS : {
+ collectDeletedProperties(doc, phases, op,
traversedState);
+ collectUnusedPropertyRevisions(doc, phases, op,
(DocumentNodeState) traversedState, false);
+ combineInternalPropRemovals(doc, op);
+ break;
+ }
+ case ORPHANS_EMPTYPROPS_KEEP_ONE_USER_PROPS : {
+ collectDeletedProperties(doc, phases, op,
traversedState);
+ collectUnusedPropertyRevisions(doc, phases, op,
(DocumentNodeState) traversedState, true);
+ combineInternalPropRemovals(doc, op);
+ break;
+ }
+ case ORPHANS_EMPTYPROPS_UNMERGED_BC : {
+ collectDeletedProperties(doc, phases, op,
traversedState);
+ collectUnmergedBranchCommits(doc, phases, op,
toModifiedMs);
+ break;
+ }
+ case
ORPHANS_EMPTYPROPS_BETWEEN_CHECKPOINTS_WITH_UNMERGED_BC : {
+ collectDeletedProperties(doc, phases, op,
traversedState);
+ collectUnmergedBranchCommits(doc, phases, op,
toModifiedMs);
+
collectRevisionsOlderThan24hAndBetweenCheckpoints(doc, toModifiedMs, phases,
op);
+ break;
+ }
+ case
ORPHANS_EMPTYPROPS_BETWEEN_CHECKPOINTS_NO_UNMERGED_BC : {
+ collectDeletedProperties(doc, phases, op,
traversedState);
+
collectRevisionsOlderThan24hAndBetweenCheckpoints(doc, toModifiedMs, phases,
op);
+ break;
+ }
}
}
- }
- // only add if there are changes for this doc
- if (op.hasChanges()) {
- op.equals(MODIFIED_IN_SECS, doc.getModified());
- garbageDocsCount++;
- totalGarbageDocsCount++;
- monitor.info("Collected [{}] garbage count in [{}]",
op.getChanges().size(), doc.getId());
- AUDIT_LOG.info("<Collected> [{}] garbage count in [{}]",
op.getChanges().size(), doc.getId());
- updateOpList.add(op);
- }
- if (log.isTraceEnabled() && op.hasChanges()) {
- // only log in case of changes & debug level enabled
- log.trace("UpdateOp for [{}] is [{}]", doc.getId(), op);
+ // only add if there are changes for this doc
+ if (op.hasChanges()) {
+ op.equals(MODIFIED_IN_SECS, doc.getModified());
+ garbageDocsCount++;
+ totalGarbageDocsCount++;
+ monitor.info("Collected [{}] garbage count in [{}]",
op.getChanges().size(), doc.getId());
+ AUDIT_LOG.info("<Collected> [{}] garbage count in [{}]",
op.getChanges().size(), doc.getId());
+ updateOpList.add(op);
+ }
+ if (log.isTraceEnabled() && op.hasChanges()) {
+ // only log in case of changes & debug level enabled
+ log.trace("UpdateOp for [{}] is [{}]", doc.getId(), op);
+ }
+ } finally {
+ // pause the fullGC thread to avoid excessive load on the
system
+ delayOnModifications(timer.stop().elapsed(MILLISECONDS),
cancel, fullGCDelayFactor);
Review Comment:
addressed in
https://github.com/apache/jackrabbit-oak/pull/1795/commits/a43bd81a1c9421c6aa9427c75eef472c168a0c3b
##########
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreHelper.java:
##########
@@ -72,7 +76,7 @@ public static VersionGarbageCollector
createVersionGC(DocumentNodeStore nodeStor
boolean
fullGCEnabled, boolean isFullGCDryRun,
boolean
embeddedVerification, int fullGCMode) {
return new VersionGarbageCollector(nodeStore, gcSupport,
fullGCEnabled, isFullGCDryRun, embeddedVerification,
- fullGCMode);
+ fullGCMode, DEFAULT_FGC_DELAY_FACTOR, DEFAULT_FGC_BATCH_SIZE,
DEFAULT_FGC_PROGRESS_SIZE);
Review Comment:
addressed in
https://github.com/apache/jackrabbit-oak/pull/1795/commits/a43bd81a1c9421c6aa9427c75eef472c168a0c3b
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]