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

anshum pushed a commit to branch crossdc-wip
in repository https://gitbox.apache.org/repos/asf/solr-sandbox.git


The following commit(s) were added to refs/heads/crossdc-wip by this push:
     new e84e890  Add explicit error logging around CrossDC config. (#23)
e84e890 is described below

commit e84e8905ae1767ecfb00fa932c25dfe40474df8f
Author: Mark Robert Miller <[email protected]>
AuthorDate: Tue Jun 14 16:45:05 2022 -0500

    Add explicit error logging around CrossDC config. (#23)
---
 .../MirroringUpdateRequestProcessorFactory.java          | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git 
a/crossdc-producer/src/main/java/org/apache/solr/update/processor/MirroringUpdateRequestProcessorFactory.java
 
b/crossdc-producer/src/main/java/org/apache/solr/update/processor/MirroringUpdateRequestProcessorFactory.java
index b1b894e..bca9656 100644
--- 
a/crossdc-producer/src/main/java/org/apache/solr/update/processor/MirroringUpdateRequestProcessorFactory.java
+++ 
b/crossdc-producer/src/main/java/org/apache/solr/update/processor/MirroringUpdateRequestProcessorFactory.java
@@ -113,6 +113,12 @@ public class MirroringUpdateRequestProcessorFactory 
extends UpdateRequestProcess
             if (((topicName == null || topicName.isBlank()) || 
(bootstrapServers == null || bootstrapServers.isBlank())) && 
core.getCoreContainer().getZkController()
                 .getZkClient().exists(CrossDcConf.CROSSDC_PROPERTIES, true)) {
                 byte[] data = 
core.getCoreContainer().getZkController().getZkClient().getData("/crossdc.properties",
 null, null, true);
+
+                if (data == null) {
+                    log.error("crossdc.properties file in Zookeeper has no 
data");
+                    throw new 
SolrException(SolrException.ErrorCode.SERVER_ERROR, "crossdc.properties file in 
Zookeeper has no data");
+                }
+
                 Properties props = new Properties();
                 props.load(new ByteArrayInputStream(data));
 
@@ -125,17 +131,21 @@ public class MirroringUpdateRequestProcessorFactory 
extends UpdateRequestProcess
              }
         } catch (InterruptedException e) {
             Thread.currentThread().interrupt();
+            log.error("Interrupted looking for CrossDC configuration in 
Zookeeper", e);
             throw new 
SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE, e);
         } catch (Exception e) {
-            throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e);
+            log.error("Exception looking for CrossDC configuration in 
Zookeeper", e);
+            throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, 
"Exception looking for CrossDC configuration in Zookeeper", e);
         }
 
         if (bootstrapServers == null || bootstrapServers.isBlank()) {
-           throw new IllegalArgumentException("boostrapServers not specified 
for producer");
+           log.error("boostrapServers not specified for producer in CrossDC 
configuration");
+           throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, 
"boostrapServers not specified for producer");
        }
         
         if (topicName == null || topicName.isBlank()) {
-            throw new IllegalArgumentException("topicName not specified for 
producer");
+            log.error("topicName not specified for producer in CrossDC 
configuration");
+            throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, 
"topicName not specified for producer");
         }
 
         log.info("bootstrapServers={} topicName={}", bootstrapServers, 
topicName);

Reply via email to