chukwa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ey...@apache.org
Subject chukwa git commit: CHUKWA-803. Update Solr API to version 5 API. (Eric Yang)
Date Sun, 03 Apr 2016 00:55:07 GMT
Repository: chukwa
Updated Branches:
  refs/heads/master 8011ff1f5 -> f77266b55


CHUKWA-803. Update Solr API to version 5 API.  (Eric Yang)


Project: http://git-wip-us.apache.org/repos/asf/chukwa/repo
Commit: http://git-wip-us.apache.org/repos/asf/chukwa/commit/f77266b5
Tree: http://git-wip-us.apache.org/repos/asf/chukwa/tree/f77266b5
Diff: http://git-wip-us.apache.org/repos/asf/chukwa/diff/f77266b5

Branch: refs/heads/master
Commit: f77266b555d46969bf3e0985f120312603be105a
Parents: 8011ff1
Author: Eric Yang <eyang@apache.org>
Authored: Sat Apr 2 17:54:32 2016 -0700
Committer: Eric Yang <eyang@apache.org>
Committed: Sat Apr 2 17:54:32 2016 -0700

----------------------------------------------------------------------
 CHANGES.txt                                     |  2 ++
 .../datacollection/writer/solr/SolrWriter.java  | 23 +++++++++-----------
 2 files changed, 12 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/chukwa/blob/f77266b5/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index e44c58d..c6d1f08 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -10,6 +10,8 @@ Trunk (unreleased changes)
 
   BUGS
 
+    CHUKWA-803. Update Solr API to version 5 API.  (Eric Yang)
+
     CHUKWA-801. Increase measurement timeout for TestFailTailer. (Eric Yang)
 
     CHUKWA-800. Updated Hadoop, HBase version. (Eric Yang)

http://git-wip-us.apache.org/repos/asf/chukwa/blob/f77266b5/src/main/java/org/apache/hadoop/chukwa/datacollection/writer/solr/SolrWriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/hadoop/chukwa/datacollection/writer/solr/SolrWriter.java
b/src/main/java/org/apache/hadoop/chukwa/datacollection/writer/solr/SolrWriter.java
index 30d452c..a0fd7ff 100644
--- a/src/main/java/org/apache/hadoop/chukwa/datacollection/writer/solr/SolrWriter.java
+++ b/src/main/java/org/apache/hadoop/chukwa/datacollection/writer/solr/SolrWriter.java
@@ -17,7 +17,6 @@
  */
 package org.apache.hadoop.chukwa.datacollection.writer.solr;
 
-import java.io.IOException;
 import java.nio.charset.Charset;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -34,14 +33,12 @@ import org.apache.hadoop.chukwa.datacollection.writer.WriterException;
 import org.apache.hadoop.chukwa.util.ExceptionUtil;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.log4j.Logger;
-import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.impl.CloudSolrServer;
-import org.apache.solr.common.SolrException;
+import org.apache.solr.client.solrj.impl.CloudSolrClient;
 import org.apache.solr.common.SolrInputDocument;
 
 public class SolrWriter extends PipelineableWriter {
   private static Logger log = Logger.getLogger(SolrWriter.class);
-  private CloudSolrServer server;
+  private CloudSolrClient client;
   private final static String ID = "id";
   private final static String SEQ_ID = "seqId";
   private final static String DATA_TYPE = "type";
@@ -66,9 +63,9 @@ public class SolrWriter extends PipelineableWriter {
       throw new WriterException("Solr server address is not defined.");
     }
     String collection = c.get("solr.collection", "logs");
-    if(server == null) {
-      server = new CloudSolrServer(serverName);
-      server.setDefaultCollection(collection);
+    if(client == null) {
+      client = new CloudSolrClient(serverName);
+      client.setDefaultCollection(collection);
     }
   }
 
@@ -78,7 +75,7 @@ public class SolrWriter extends PipelineableWriter {
 
   @Override
   public CommitStatus add(List<Chunk> chunks) throws WriterException {
-    if(server == null) {
+    if(client == null) {
       init(ChukwaAgent.getStaticConfiguration());
     }
     CommitStatus rv = ChukwaWriter.COMMIT_OK;
@@ -118,16 +115,16 @@ public class SolrWriter extends PipelineableWriter {
         } catch(ParseException e) {
           
         }
-        server.add(doc);
+        client.add(doc);
       } catch (Exception e) {
         log.warn("Failed to store data to Solr Cloud.");
         log.warn(ExceptionUtil.getStackTrace(e));
-        server = null;
+        client = null;
       }
     }
     try {
-      if(server != null) {
-        server.commit();
+      if(client != null) {
+        client.commit();
       }
     } catch (Exception e) {
       log.warn("Failed to store data to Solr Cloud.");


Mime
View raw message