accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1213363 - in /incubator/accumulo/branches/1.4: ./ src/core/src/main/java/org/apache/accumulo/core/trace/ src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/ src/server/src/main/java/org/apache/accumulo/server/trace/
Date Mon, 12 Dec 2011 18:53:06 GMT
Author: ecn
Date: Mon Dec 12 18:53:05 2011
New Revision: 1213363

URL: http://svn.apache.org/viewvc?rev=1213363&view=rev
Log:
ACCUMULO-215: reset batch writer when errors occur; also found tracer lookup was not initialized
properly

Modified:
    incubator/accumulo/branches/1.4/   (props changed)
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/trace/ZooTraceClient.java
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
    incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java

Propchange: incubator/accumulo/branches/1.4/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 12 18:53:05 2011
@@ -1,3 +1,3 @@
-/incubator/accumulo/branches/1.3:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210571,1210596,1210598
+/incubator/accumulo/branches/1.3:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598
 /incubator/accumulo/branches/1.4:1205476
 /incubator/accumulo/trunk:1205476,1205570,1208726

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/trace/ZooTraceClient.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/trace/ZooTraceClient.java?rev=1213363&r1=1213362&r2=1213363&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/trace/ZooTraceClient.java
(original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/trace/ZooTraceClient.java
Mon Dec 12 18:53:05 2011
@@ -47,7 +47,7 @@ public class ZooTraceClient extends Send
     super(host, service, millis);
     this.path = path;
     this.zoo = zoo;
-    zoo.getChildren(path, this);
+    updateHosts(path, zoo.getChildren(path, this));
   }
   
   @Override
@@ -82,4 +82,4 @@ public class ZooTraceClient extends Send
       log.error("unable to get destination hosts in zookeeper", ex);
     }
   }
-}
\ No newline at end of file
+}

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java?rev=1213363&r1=1213362&r2=1213363&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
(original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/util/shell/commands/TraceCommand.java
Mon Dec 12 18:53:05 2011
@@ -91,4 +91,4 @@ public class TraceCommand extends DebugC
   public String description() {
     return "turns trace logging on or off";
   }
-}
\ No newline at end of file
+}

Modified: incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java?rev=1213363&r1=1213362&r2=1213363&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
(original)
+++ incubator/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
Mon Dec 12 18:53:05 2011
@@ -63,8 +63,10 @@ public class TraceServer implements Watc
   final private static Logger log = Logger.getLogger(TraceServer.class);
   final private AccumuloConfiguration conf;
   final private TServer server;
-  final private BatchWriter writer;
-  
+  private BatchWriter writer = null;
+  private Connector connector;
+  final String table;
+
   private static void put(Mutation m, String cf, String cq, byte[] bytes, int len) {
     m.put(new Text(cf), new Text(cq), new Value(bytes, 0, len));
   }
@@ -125,6 +127,10 @@ public class TraceServer implements Watc
         put(timeMutation, "id", idString, transport.get(), transport.len());
       }
       try {
+        if (writer == null)
+          resetWriter();
+        if (writer == null)
+          return;
         writer.addMutation(spanMutation);
         writer.addMutation(indexMutation);
         if (timeMutation != null)
@@ -139,8 +145,7 @@ public class TraceServer implements Watc
   public TraceServer(String args[]) throws Exception {
     Accumulo.init("tracer");
     conf = ServerConfiguration.getSystemConfiguration();
-    final String table = conf.get(Property.TRACE_TABLE);
-    Connector connector;
+    table = conf.get(Property.TRACE_TABLE);
     while (true) {
       try {
         connector = HdfsZooInstance.getInstance().getConnector(conf.get(Property.TRACE_USER),
conf.get(Property.TRACE_PASSWORD).getBytes());
@@ -183,9 +188,27 @@ public class TraceServer implements Watc
       writer.flush();
     } catch (MutationsRejectedException e) {
       log.error("Error flushing traces", e);
+      resetWriter();
+    }
+  }
+  
+  synchronized private void resetWriter() {
+    try {
+      if (writer != null)
+        writer.close();
+    } catch (Exception ex) {
+      log.error("Error closing batch writer", ex);
+    } finally {
+      writer = null;
+      try {
+        writer = connector.createBatchWriter(table, 100l * 1024 * 1024, 5 * 1000l, 10);
+      } catch (Exception ex) {
+        log.error("Unable to create a batch writer: " + ex);
+      }
     }
   }
   
+
   private void registerInZooKeeper(String name) throws Exception {
     String root = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZTRACERS;
     IZooReaderWriter zoo = ZooReaderWriter.getInstance();



Mime
View raw message