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_r403702846
 
 

 ##########
 File path: 
lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java
 ##########
 @@ -543,59 +506,53 @@ long markForFullFlush() {
   }
   
   private boolean assertActiveDeleteQueue(DocumentsWriterDeleteQueue queue) {
-    final int limit = perThreadPool.getActiveThreadStateCount();
-    for (int i = 0; i < limit; i++) {
-      final ThreadState next = perThreadPool.getThreadState(i);
-      next.lock();
-      try {
-        assert !next.isInitialized() || next.dwpt.deleteQueue == queue : 
"isInitialized: " + next.isInitialized() + " numDocs: " + (next.isInitialized() 
? next.dwpt.getNumDocsInRAM() : 0) ;
-      } finally {
-        next.unlock();
-      }
+    for (final DocumentsWriterPerThread next : perThreadPool) {
+        assert next.deleteQueue == queue : "numDocs: " + 
next.getNumDocsInRAM();
     }
     return true;
   }
 
   private final List<DocumentsWriterPerThread> fullFlushBuffer = new 
ArrayList<>();
 
-  void addFlushableState(ThreadState perThread) {
+  void addFlushableDWPT(DocumentsWriterPerThread dwpt) {
     if (infoStream.isEnabled("DWFC")) {
-      infoStream.message("DWFC", "addFlushableState " + perThread.dwpt);
+      infoStream.message("DWFC", "addFlushableDWPT " + dwpt);
     }
-    final DocumentsWriterPerThread dwpt = perThread.dwpt;
-    assert perThread.isHeldByCurrentThread();
-    assert perThread.isInitialized();
+    assert dwpt.isHeldByCurrentThread();
     assert fullFlush;
     assert dwpt.deleteQueue != documentsWriter.deleteQueue;
+    assert perThreadPool.isRegistered(dwpt);
     if (dwpt.getNumDocsInRAM() > 0) {
       synchronized(this) {
-        if (!perThread.flushPending) {
-          setFlushPending(perThread);
+        if (dwpt.isFlushPending() == false) {
 
 Review comment:
   Woohoo!

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