You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/02/15 10:36:13 UTC

[GitHub] [lucene] romseygeek commented on a change in pull request #679: Monitor Improvements LUCENE-10422

romseygeek commented on a change in pull request #679:
URL: https://github.com/apache/lucene/pull/679#discussion_r806633322



##########
File path: lucene/monitor/src/java/org/apache/lucene/monitor/MonitorConfiguration.java
##########
@@ -35,8 +34,9 @@
   private long purgeFrequency = 5;
   private TimeUnit purgeFrequencyUnits = TimeUnit.MINUTES;
   private QueryDecomposer queryDecomposer = new QueryDecomposer();
-  private Path indexPath = null;
   private MonitorQuerySerializer serializer;
+  private Boolean readOnly = false;
+  private DirectoryProviderFunctionalInterface directoryProvider;

Review comment:
       We can set this to a default value of `() -> new ByteBuffersDirectory()` which would then simplify the `buildIndexWriter()` implementation.

##########
File path: lucene/monitor/src/java/org/apache/lucene/monitor/DirectoryProviderFunctionalInterface.java
##########
@@ -0,0 +1,32 @@
+/*
+ * 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.monitor;
+
+import java.io.IOException;
+import org.apache.lucene.store.Directory;
+
+/** A functional interface to provide a Directory instance */
+public interface DirectoryProviderFunctionalInterface {

Review comment:
       Can we use `org.apache.lucene.util.IOSupplier` here instead please?

##########
File path: lucene/monitor/src/java/org/apache/lucene/monitor/QueryIndex.java
##########
@@ -87,8 +81,20 @@
   final Map<IndexReader.CacheKey, QueryTermFilter> termFilters = new HashMap<>();
 
   QueryIndex(MonitorConfiguration config, Presearcher presearcher) throws IOException {

Review comment:
       Given that QueryIndex is package-private I think we have some leeway to split things up here a bit and make things clearer.  Could you try making QueryIndex itself an interface, and then having read-only and writeable implementations?  We could also move the purge executor from the Monitor into the writeable QueryIndex implementation as it's not necessary to clear the cache at all on a read-only query index.

##########
File path: lucene/monitor/src/java/org/apache/lucene/monitor/QueryIndex.java
##########
@@ -36,15 +36,7 @@
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.SortedDocValuesField;
 import org.apache.lucene.document.StringField;
-import org.apache.lucene.index.BinaryDocValues;

Review comment:
       The code formatter will complain about these imports I think




-- 
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-unsubscribe@lucene.apache.org

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



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