zhaih commented on code in PR #12126:
URL: https://github.com/apache/lucene/pull/12126#discussion_r1129025441


##########
lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java:
##########
@@ -610,76 +601,34 @@ public void checkpoint(SegmentInfos segmentInfos, boolean 
isCommit) throws IOExc
     }
   }
 
+  private void logInfo(FileDeleter.MsgType msgType, String msg) {
+    if (msgType == FileDeleter.MsgType.REF && VERBOSE_REF_COUNTS == false) {

Review Comment:
   I think we could leave `VERBOSE_REF_COUNTS` as is, since `FileDeleter` is 
just responsible for throwing message out with it's type, and here 
`VERBOSE_REF_COUNTS` is the switch on the `IFD` side so I think it makes sense 
to let it stay there.



##########
lucene/core/src/java/org/apache/lucene/util/FileDeleter.java:
##########
@@ -0,0 +1,274 @@
+/*
+ * 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.lucene.util;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.nio.file.NoSuchFileException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.BiConsumer;
+import org.apache.lucene.index.IndexFileNames;
+import org.apache.lucene.store.Directory;
+
+/**
+ * This class provides ability to track the reference counts of a set of index 
files and delete them
+ * when their counts decreased to 0.
+ *
+ * <p>This class is NOT thread-safe, the user should make sure the 
thread-safety themselves
+ */
+public class FileDeleter {

Review Comment:
   +1



-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to