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


##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/FullGcBin.java:
##########
@@ -0,0 +1,108 @@
+/*
+ * 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.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class FullGcBin {
+  private static final Logger log = getLogger(FullGcBin.class);

Review Comment:
   Please configure your IDE to use 4 spaces as identation.



##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/FullGcBin.java:
##########
@@ -0,0 +1,108 @@
+/*
+ * 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.util.Collections;
+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 = false;

Review Comment:
   false is the default and so not needed.



##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/FullGcBin.java:
##########
@@ -0,0 +1,108 @@
+/*
+ * 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.util.Collections;
+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 = false;
+
+  public FullGcBin(DocumentStore ds) {
+    documentStore = ds;
+  }
+
+  public int remove(Map<String, Long> orphanOrDeletedRemovalMap) {
+    if (orphanOrDeletedRemovalMap.isEmpty()) return 0;
+    if (!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()) return Collections.emptyList();
+    if (!addToBin(updateOpList)) return Collections.emptyList();

Review Comment:
   Not tested:
   ```suggestion
       if (updateOpList.isEmpty() || !addToBin(updateOpList)) {
           return Collections.emptyList();
       }
   ```



##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/FullGcBin.java:
##########
@@ -0,0 +1,108 @@
+/*
+ * 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.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class FullGcBin {
+  private static final Logger log = getLogger(FullGcBin.class);

Review Comment:
   ```suggestion
     private static final Logger LOG = getLogger(FullGcBin.class);
   ```



##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/FullGcBin.java:
##########
@@ -0,0 +1,108 @@
+/*
+ * 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.util.Collections;
+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 = false;
+
+  public FullGcBin(DocumentStore ds) {
+    documentStore = ds;
+  }
+
+  public int remove(Map<String, Long> orphanOrDeletedRemovalMap) {
+    if (orphanOrDeletedRemovalMap.isEmpty()) return 0;

Review Comment:
   Please use { } and put the return on a single line.



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