Re: [PR] OAK-10896: - Add OSGI configuration variable for removal of deleted properties and orphaned nodes [jackrabbit-oak]

2024-06-24 Thread via GitHub


shodaaan commented on code in PR #1539:
URL: https://github.com/apache/jackrabbit-oak/pull/1539#discussion_r1651122982


##
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:
   Done.



##
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:
   Done.



-- 
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



Re: [PR] OAK-10896: - Add OSGI configuration variable for removal of deleted properties and orphaned nodes [jackrabbit-oak]

2024-06-24 Thread via GitHub


shodaaan commented on code in PR #1539:
URL: https://github.com/apache/jackrabbit-oak/pull/1539#discussion_r1651122588


##
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:
   Fixed.



-- 
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



Re: [PR] OAK-10896: - Add OSGI configuration variable for removal of deleted properties and orphaned nodes [jackrabbit-oak]

2024-06-24 Thread via GitHub


shodaaan commented on code in PR #1539:
URL: https://github.com/apache/jackrabbit-oak/pull/1539#discussion_r165738


##
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:
   done



-- 
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



Re: [PR] OAK-10896: - Add OSGI configuration variable for removal of deleted properties and orphaned nodes [jackrabbit-oak]

2024-06-24 Thread via GitHub


shodaaan commented on code in PR #1539:
URL: https://github.com/apache/jackrabbit-oak/pull/1539#discussion_r1651098372


##
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java:
##
@@ -2603,7 +2605,7 @@ private void cleanOrphanedBranches() {
 }
 
 private void cleanRootCollisions() {
-String id = Utils.getIdFromPath(ROOT);
+String id = getIdFromPath(ROOT);

Review Comment:
   Fixed.



-- 
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



Re: [PR] OAK-10896: - Add OSGI configuration variable for removal of deleted properties and orphaned nodes [jackrabbit-oak]

2024-06-24 Thread via GitHub


shodaaan commented on code in PR #1539:
URL: https://github.com/apache/jackrabbit-oak/pull/1539#discussion_r1651096514


##
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java:
##
@@ -692,7 +694,7 @@ public int getMemory() {
 diffCache = builder.getDiffCache(this.clusterId);
 
 // check if root node exists
-NodeDocument rootDoc = store.find(NODES, Utils.getIdFromPath(ROOT));
+NodeDocument rootDoc = store.find(NODES, getIdFromPath(ROOT));

Review Comment:
   Fixed.



-- 
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



Re: [PR] OAK-10896: - Add OSGI configuration variable for removal of deleted properties and orphaned nodes [jackrabbit-oak]

2024-06-24 Thread via GitHub


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:

Re: [PR] OAK-10896: - Add OSGI configuration variable for removal of deleted properties and orphaned nodes [jackrabbit-oak]

2024-06-24 Thread via GitHub


stefan-egli commented on code in PR #1539:
URL: https://github.com/apache/jackrabbit-oak/pull/1539#discussion_r1650969435


##
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java:
##
@@ -692,7 +694,7 @@ public int getMemory() {
 diffCache = builder.getDiffCache(this.clusterId);
 
 // check if root node exists
-NodeDocument rootDoc = store.find(NODES, Utils.getIdFromPath(ROOT));
+NodeDocument rootDoc = store.find(NODES, getIdFromPath(ROOT));

Review Comment:
   but it's in a random unrelated code - which is against our goal to not do 
unrelated changes



-- 
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