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

 ##########
 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:
   I am saying your change is the better tradeoff than the way it was before.

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

Reply via email to