s1monw commented on a change in pull request #1155: LUCENE-8962: Add ability to selectively merge on commit URL: https://github.com/apache/lucene-solr/pull/1155#discussion_r388786805
########## File path: lucene/core/src/java/org/apache/lucene/index/IndexWriterEvents.java ########## @@ -0,0 +1,59 @@ +/* + * 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. + */ + +// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + +package org.apache.lucene.index; + +/** + * Callback interface to signal various actions taken by IndexWriter. + * + * @lucene.experimental + */ +public interface IndexWriterEvents { + /** + * A default implementation that ignores all events. + */ + IndexWriterEvents NULL_EVENTS = new IndexWriterEvents() { + @Override + public void beginMergeOnCommit() { } + + @Override + public void finishMergeOnCommit() { } + + @Override + public void abandonedMergesOnCommit(int abandonedCount) { } + }; + + /** + * Signals the start of waiting for a merge on commit, returned from + * {@link MergePolicy#findFullFlushMerges(MergeTrigger, SegmentInfos, MergePolicy.MergeContext)}. + */ + void beginMergeOnCommit(); Review comment: I am not really happy with this interface. First and foremost it's only partially used in this PR. I also think it doesn't belong here but rather into a merge policy? I think IW and merge lifecycle should not be tightly coupled. Can we achieve the same with an interface a MP can provide to the IW rather than setting it on the IW config. A pull model should be used here instead IMO. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
