rishabhdaim commented on code in PR #1539: URL: https://github.com/apache/jackrabbit-oak/pull/1539#discussion_r1651080682
########## oak-run/src/main/java/org/apache/jackrabbit/oak/run/RevisionsCommand.java: ########## @@ -69,10 +69,11 @@ import static org.apache.jackrabbit.oak.plugins.document.Collection.NODES; import static org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreHelper.createVersionGC; import static org.apache.jackrabbit.oak.plugins.document.FormatVersion.versionOf; +import static org.apache.jackrabbit.oak.plugins.document.util.Utils.getFullGCMode; import static org.apache.jackrabbit.oak.plugins.document.util.Utils.getIdFromPath; import static org.apache.jackrabbit.oak.plugins.document.util.Utils.getRootDocument; -import static org.apache.jackrabbit.oak.plugins.document.util.Utils.isFullGCEnabled; Review Comment: same as above. ########## oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java: ########## @@ -211,6 +211,29 @@ static FullGCMode getFullGcMode() { return fullGcMode; } + /** + * Set the full GC mode to be used according to the provided configuration value. + * The configuration value will be ignored and fullGCMode will be reset to NONE + * if it is set to any other values than the supported ones. + * @param fullGcModeConfig + */ + static void setFullGcMode(int fullGcModeConfig) { Review Comment: I would suggest renaming variable name to `fullGcMode` ########## oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/util/UtilsTest.java: ########## @@ -236,6 +237,30 @@ public void fullGCDisabledForRDB() { assertFalse("Full GC is disabled for RDB Document Store", fullGCEnabled); } + @Test + public void fullGCModeDefaultValue() { + int fullGCModeDefaultValue = getFullGCMode(newDocumentNodeStoreBuilder()); + final int FULL_GC_MODE_NONE = 0; Review Comment: please use camelCase here. ########## oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java: ########## @@ -1009,6 +1009,16 @@ public static boolean isEmbeddedVerificationEnabled(final DocumentNodeStoreBuild return builder.isEmbeddedVerificationEnabled() || (docStoreEmbeddedVerificationFeature != null && docStoreEmbeddedVerificationFeature.isEnabled()); } + /** + * Returns the full GC mode value for the DocumentNodeStore. + * + * @param builder instance for DocumentNodeStoreBuilder + * @return true if full GC is enabled else false + */ + public static int getFullGCMode(final DocumentNodeStoreBuilder<?> builder) { Review Comment: This utility method doesn't make sense, it only returns `fullGcMode` from the `builder` object. I would remove this. ########## oak-run/src/main/java/org/apache/jackrabbit/oak/run/RevisionsCommand.java: ########## @@ -47,13 +47,13 @@ import org.apache.jackrabbit.oak.plugins.document.NodeDocument; import org.apache.jackrabbit.oak.plugins.document.RevisionContextWrapper; import org.apache.jackrabbit.oak.plugins.document.SweepHelper; +import org.apache.jackrabbit.oak.plugins.document.VersionGCOptions; import org.apache.jackrabbit.oak.plugins.document.VersionGCSupport; +import org.apache.jackrabbit.oak.plugins.document.VersionGarbageCollector; import org.apache.jackrabbit.oak.plugins.document.VersionGarbageCollector.VersionGCInfo; import org.apache.jackrabbit.oak.plugins.document.VersionGarbageCollector.VersionGCStats; import org.apache.jackrabbit.oak.plugins.document.util.MongoConnection; import org.apache.jackrabbit.oak.run.commons.Command; -import org.apache.jackrabbit.oak.plugins.document.VersionGCOptions; -import org.apache.jackrabbit.oak.plugins.document.VersionGarbageCollector; Review Comment: please revert these import changes. ########## oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/util/UtilsTest.java: ########## @@ -236,6 +237,30 @@ public void fullGCDisabledForRDB() { assertFalse("Full GC is disabled for RDB Document Store", fullGCEnabled); } + @Test + public void fullGCModeDefaultValue() { + int fullGCModeDefaultValue = getFullGCMode(newDocumentNodeStoreBuilder()); + final int FULL_GC_MODE_NONE = 0; + assertEquals("Full GC mode has NONE value by default", fullGCModeDefaultValue, FULL_GC_MODE_NONE); + } + + @Test + public void fullGCModeSetViaConfiguration() { + DocumentNodeStoreBuilder<?> builder = newDocumentNodeStoreBuilder(); + final int FULL_GC_MODE_GAP_ORPHANS = 2; Review Comment: same as above. -- 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: oak-dev-unsubscr...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org