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


##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/FullGcBin.java:
##########
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.plugins.document;
+
+import org.slf4j.Logger;
+import static org.slf4j.LoggerFactory.getLogger;
+
+import java.time.Instant;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class FullGcBin {
+    private static final Logger LOG = getLogger(FullGcBin.class);
+    private final DocumentStore documentStore;
+    private boolean enabled;
+
+    public FullGcBin(DocumentStore ds) {
+        documentStore = ds;
+    }
+
+    public int remove(Map<String, Long> orphanOrDeletedRemovalMap) {
+        if (orphanOrDeletedRemovalMap.isEmpty() || 
!addToBin(orphanOrDeletedRemovalMap)) {
+            return 0;
+        }
+
+        // use remove() with the modified check to rule
+        // out any further race-condition where this removal
+        // races with a un-orphan/re-creation as a result of which
+        // the node should now not be removed. The modified check
+        // ensures a node would then not be removed
+        // (and as a result the removedSize != map.size())
+        return documentStore.remove(Collection.NODES, 
orphanOrDeletedRemovalMap);
+    }
+
+    public List<NodeDocument> findAndUpdate(List<UpdateOp> updateOpList) {
+        LOG.info("Updating {} documents", updateOpList.size());
+        if (updateOpList.isEmpty() || !addToBin(updateOpList)) {

Review Comment:
   We should also log when addToBin fails and therefore prevents garbage from 
being deleted. I suggest using the audit log for this, and also logging the 
paths for which addToBin failed.
   I suggest adding this log to each of the public methods, since the use cases 
are different for them.



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

Reply via email to