You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2020/06/18 11:17:23 UTC

[lucene-solr] branch jira/solr-14537 updated: SOLR-14537: Logging cleanup.

This is an automated email from the ASF dual-hosted git repository.

ab pushed a commit to branch jira/solr-14537
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/jira/solr-14537 by this push:
     new cf6762c  SOLR-14537: Logging cleanup.
cf6762c is described below

commit cf6762c0818812c615f793039d7a6c4bcc59472c
Author: Andrzej Bialecki <ab...@apache.org>
AuthorDate: Thu Jun 18 13:16:56 2020 +0200

    SOLR-14537: Logging cleanup.
---
 .../apache/solr/handler/export/ExportBuffers.java  | 22 +++++++++++-----------
 .../apache/solr/handler/export/ExportWriter.java   | 13 ++++++++-----
 .../solr/handler/export/ExportWriterStream.java    | 18 +++++++++---------
 3 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/handler/export/ExportBuffers.java b/solr/core/src/java/org/apache/solr/handler/export/ExportBuffers.java
index 817e958..00cb976 100644
--- a/solr/core/src/java/org/apache/solr/handler/export/ExportBuffers.java
+++ b/solr/core/src/java/org/apache/solr/handler/export/ExportBuffers.java
@@ -99,16 +99,16 @@ class ExportBuffers {
     barrier = new CyclicBarrier(2, () -> swapBuffers());
     filler = () -> {
       try {
-        log.info("--- filler start " + Thread.currentThread());
+        log.debug("--- filler start {}", Thread.currentThread());
         SortDoc sortDoc = exportWriter.getSortDoc(searcher, sort.getSort());
         Buffer buffer = getFillBuffer();
         SortQueue queue = new SortQueue(queueSize, sortDoc);
         long lastOutputCounter = 0;
         for (int count = 0; count < totalHits; ) {
-          log.info("--- filler fillOutDocs in " + fillBuffer);
+          log.debug("--- filler fillOutDocs in {}", fillBuffer);
           exportWriter.fillOutDocs(leaves, sortDoc, queue, buffer);
           count += (buffer.outDocsIndex + 1);
-          log.info("--- filler count=" + count + ", exchange buffer from " + buffer);
+          log.debug("--- filler count={}, exchange buffer from {}", count, buffer);
           Timer.Context timerContext = getFillerWaitTimer().time();
           try {
             exchangeBuffers();
@@ -120,10 +120,10 @@ class ExportBuffers {
             lastOutputCounter = outputCounter.longValue();
             flushOutput();
           }
-          log.info("--- filler got empty buffer " + buffer);
+          log.debug("--- filler got empty buffer {}", buffer);
         }
         buffer.outDocsIndex = Buffer.NO_MORE_DOCS;
-        log.info("--- filler final exchange buffer from " + buffer);
+        log.debug("--- filler final exchange buffer from {}", buffer);
         Timer.Context timerContext = getFillerWaitTimer().time();
         try {
           exchangeBuffers();
@@ -131,7 +131,7 @@ class ExportBuffers {
           timerContext.stop();
         }
         buffer = getFillBuffer();
-        log.info("--- filler final got buffer " + buffer);
+        log.debug("--- filler final got buffer {}", buffer);
       } catch (Exception e) {
         log.error("filler", e);
         error(e);
@@ -141,7 +141,7 @@ class ExportBuffers {
   }
 
   public void exchangeBuffers() throws Exception {
-    log.info("---- wait from " + Thread.currentThread());
+    log.debug("---- wait exchangeBuffers from {}", Thread.currentThread());
     barrier.await(EXCHANGE_TIMEOUT_SECONDS, TimeUnit.SECONDS);
   }
 
@@ -156,7 +156,7 @@ class ExportBuffers {
   }
 
   private void swapBuffers() {
-    log.info("--- swap buffers");
+    log.debug("--- swap buffers");
     Buffer one = fillBuffer;
     fillBuffer = outputBuffer;
     outputBuffer = one;
@@ -194,7 +194,7 @@ class ExportBuffers {
 
   public void shutdownNow() {
     if (service != null) {
-      log.info("--- shutting down buffers");
+      log.debug("--- shutting down buffers");
       service.shutdownNow();
       service = null;
     }
@@ -230,13 +230,13 @@ class ExportBuffers {
 //            }, service)
 //        );
 //        allDone.join();
-      log.info("-- finished.");
+      log.debug("-- finished.");
     } catch (Exception e) {
       log.error("Exception running filler / writer", e);
       error(e);
       //
     } finally {
-      log.info("--- all done, shutting down buffers");
+      log.debug("--- all done, shutting down buffers");
       shutdownNow();
     }
   }
diff --git a/solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java b/solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java
index 7dbeac2..52ed726 100644
--- a/solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java
+++ b/solr/core/src/java/org/apache/solr/handler/export/ExportWriter.java
@@ -339,6 +339,9 @@ public class ExportWriter implements SolrCore.RawWriter, Closeable {
       destination.outDocsIndex = outDocsIndex;
     } catch (Throwable t) {
       log.error("transfer", t);
+      if (t instanceof InterruptedException) {
+        Thread.currentThread().interrupt();
+      }
       throw t;
     } finally {
       timerContext.stop();
@@ -387,13 +390,13 @@ public class ExportWriter implements SolrCore.RawWriter, Closeable {
     } else {
       buffers.run(() -> {
         // get the initial buffer
-        log.info("--- writer init exchanging from empty");
+        log.debug("--- writer init exchanging from empty");
         buffers.exchangeBuffers();
         ExportBuffers.Buffer buffer = buffers.getOutputBuffer();
-        log.info("--- writer init got " + buffer);
+        log.debug("--- writer init got {}", buffer);
         while (buffer.outDocsIndex != ExportBuffers.Buffer.NO_MORE_DOCS) {
           if (Thread.currentThread().isInterrupted()) {
-            log.info("--- writer interrupted");
+            log.debug("--- writer interrupted");
             break;
           }
           Timer.Context timerContext = writeOutputBufferTimer.time();
@@ -408,7 +411,7 @@ public class ExportWriter implements SolrCore.RawWriter, Closeable {
           } finally {
             timerContext.stop();
           }
-          log.info("--- writer exchanging from " + buffer);
+          log.debug("--- writer exchanging from {}", buffer);
           timerContext = writerWaitTimer.time();
           try {
             buffers.exchangeBuffers();
@@ -416,7 +419,7 @@ public class ExportWriter implements SolrCore.RawWriter, Closeable {
             timerContext.stop();
           }
           buffer = buffers.getOutputBuffer();
-          log.info("--- writer got " + buffer);
+          log.debug("--- writer got {}", buffer);
         }
         return true;
       });
diff --git a/solr/core/src/java/org/apache/solr/handler/export/ExportWriterStream.java b/solr/core/src/java/org/apache/solr/handler/export/ExportWriterStream.java
index bbdce58..8cc31ab 100644
--- a/solr/core/src/java/org/apache/solr/handler/export/ExportWriterStream.java
+++ b/solr/core/src/java/org/apache/solr/handler/export/ExportWriterStream.java
@@ -147,7 +147,7 @@ public class ExportWriterStream extends TupleStream implements Expressible {
       }
       try {
         buffer.outDocsIndex = ExportBuffers.Buffer.EMPTY;
-        log.info("--- ews exchange empty buffer " + buffer);
+        log.debug("--- ews exchange empty buffer {}", buffer);
         boolean exchanged = false;
         while (!exchanged) {
           Timer.Context timerContext = exportBuffers.getWriterWaitTimer().time();
@@ -155,15 +155,15 @@ public class ExportWriterStream extends TupleStream implements Expressible {
             exportBuffers.exchangeBuffers();
             exchanged = true;
           } catch (TimeoutException e) {
-            log.info("--- ews timeout loop");
+            log.debug("--- ews timeout loop");
             if (exportBuffers.isShutDown()) {
-              log.info("--- ews - the other end is shutdown, returning EOF");
+              log.debug("--- ews - the other end is shutdown, returning EOF");
               res = Tuple.EOF();
               break;
             }
             continue;
           } catch (InterruptedException e) {
-            log.info("--- ews interrupted");
+            log.debug("--- ews interrupted");
             exportBuffers.error(e);
             res = Tuple.EXCEPTION(e, true);
             break;
@@ -179,11 +179,11 @@ public class ExportWriterStream extends TupleStream implements Expressible {
           }
         }
       } catch (InterruptedException e) {
-        log.info("--- ews interrupt");
+        log.debug("--- ews interrupt");
         exportBuffers.error(e);
         res = Tuple.EXCEPTION(e, true);
       } catch (Exception e) {
-        log.info("--- ews exception", e);
+        log.debug("--- ews exception", e);
         exportBuffers.error(e);
         res = Tuple.EXCEPTION(e, true);
       }
@@ -192,15 +192,15 @@ public class ExportWriterStream extends TupleStream implements Expressible {
         res = Tuple.EOF();
       }
       if (buffer.outDocsIndex == ExportBuffers.Buffer.NO_MORE_DOCS) {
-        log.info("--- ews EOF");
+        log.debug("--- ews EOF");
         res = Tuple.EOF();
       } else {
         pos = buffer.outDocsIndex;
-        log.info("--- ews new pos=" + pos);
+        log.debug("--- ews new pos=" + pos);
       }
     }
     if (pos < 0) {
-      log.info("--- ews EOF?");
+      log.debug("--- ews EOF?");
       res = Tuple.EOF();
     }
     if (res != null) {