s1monw commented on a change in pull request #1397: LUCENE-9304: Refactor DWPTPool to pool DWPT directly URL: https://github.com/apache/lucene-solr/pull/1397#discussion_r404068913
########## File path: lucene/core/src/java/org/apache/lucene/index/DocumentsWriter.java ########## @@ -322,35 +316,27 @@ synchronized Closeable lockAndAbortAll() throws IOException { } /** Returns how many documents were aborted. */ - private int abortThreadState(final ThreadState perThread) throws IOException { + private int abortDocumentsWriterPerThread(final DocumentsWriterPerThread perThread) throws IOException { assert perThread.isHeldByCurrentThread(); - if (perThread.isInitialized()) { - try { - int abortedDocCount = perThread.dwpt.getNumDocsInRAM(); - subtractFlushedNumDocs(abortedDocCount); - perThread.dwpt.abort(); - return abortedDocCount; - } finally { - flushControl.doOnAbort(perThread); - } - } else { + try { + int abortedDocCount = perThread.getNumDocsInRAM(); + subtractFlushedNumDocs(abortedDocCount); + perThread.abort(); + return abortedDocCount; + } finally { flushControl.doOnAbort(perThread); - // This DWPT was never initialized so it has no indexed documents: - return 0; } } /** returns the maximum sequence number for all previously completed operations */ public long getMaxCompletedSequenceNumber() { - long value = lastSeqNo; - int limit = perThreadPool.getMaxThreadStates(); - for(int i = 0; i < limit; i++) { - ThreadState perThread = perThreadPool.getThreadState(i); - value = Math.max(value, perThread.lastSeqNo); - } - return value; + // NOCOMMIT: speak to mikemccandless about this change https://github.com/apache/lucene-solr/commit/5a03216/ + // Returning the last seqNum is as good as the way we had before IMO. I tried to figure out why this is better but + // failed. Review comment: hmm, I am not sure I understand fully. You mean the way it used to be was a good tradeoff? Currently there is no extra work done after my change, I am struggeling to understand why you made the chance in the first place. To me it's equivalent and no tests are failing. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org