accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [2/3] accumulo git commit: ACCUMULO-4053 Enable better logging to debug ReplicationOperations.drain()
Date Tue, 17 Nov 2015 01:07:33 GMT
ACCUMULO-4053 Enable better logging to debug ReplicationOperations.drain()


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

Branch: refs/heads/master
Commit: 5947b420693baf52c55d2c2959faad922163e363
Parents: 81b6d5b
Author: Josh Elser <elserj@apache.org>
Authored: Mon Nov 16 19:55:29 2015 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Mon Nov 16 19:55:29 2015 -0500

----------------------------------------------------------------------
 .../master/MasterClientServiceHandler.java      | 21 +++++++++++---------
 .../master/replication/FinishedWorkUpdater.java |  2 +-
 .../replication/MultiInstanceReplicationIT.java |  4 +++-
 test/src/test/resources/log4j.properties        |  2 ++
 4 files changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/5947b420/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java
b/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java
index e65dcec..cff8b51 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java
@@ -95,12 +95,14 @@ import org.apache.thrift.TException;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.KeeperException.NoNodeException;
 import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.protobuf.InvalidProtocolBufferException;
 
 class MasterClientServiceHandler extends FateServiceHandler implements MasterClientService.Iface
{
 
   private static final Logger log = Master.log;
+  private static final Logger drainLog = LoggerFactory.getLogger("org.apache.accumulo.master.MasterDrainImpl");
   private Instance instance;
 
   MasterClientServiceHandler(Master master) {
@@ -503,9 +505,9 @@ class MasterClientServiceHandler extends FateServiceHandler implements
MasterCli
 
     final Text tableId = new Text(getTableId(master.getInstance(), tableName));
 
-    log.trace("Waiting for {} to be replicated for {}", logsToWatch, tableId);
+    drainLog.trace("Waiting for {} to be replicated for {}", logsToWatch, tableId);
 
-    log.trace("Reading from metadata table");
+    drainLog.trace("Reading from metadata table");
     final Set<Range> range = Collections.singleton(new Range(ReplicationSection.getRange()));
     BatchScanner bs;
     try {
@@ -524,7 +526,7 @@ class MasterClientServiceHandler extends FateServiceHandler implements
MasterCli
       bs.close();
     }
 
-    log.trace("reading from replication table");
+    drainLog.trace("reading from replication table");
     try {
       bs = conn.createBatchScanner(ReplicationTable.NAME, Authorizations.EMPTY, 4);
     } catch (TableNotFoundException e) {
@@ -549,7 +551,7 @@ class MasterClientServiceHandler extends FateServiceHandler implements
MasterCli
   protected boolean allReferencesReplicated(BatchScanner bs, Text tableId, Set<String>
relevantLogs) {
     Text rowHolder = new Text(), colfHolder = new Text();
     for (Entry<Key,Value> entry : bs) {
-      log.trace("Got key {}", entry.getKey().toStringNoTruncate());
+      drainLog.trace("Got key {}", entry.getKey().toStringNoTruncate());
 
       entry.getKey().getColumnQualifier(rowHolder);
       if (tableId.equals(rowHolder)) {
@@ -563,27 +565,28 @@ class MasterClientServiceHandler extends FateServiceHandler implements
MasterCli
         } else if (colfHolder.equals(OrderSection.NAME)) {
           file = OrderSection.getFile(entry.getKey(), rowHolder);
           long timeClosed = OrderSection.getTimeClosed(entry.getKey(), rowHolder);
-          log.trace("Order section: {} and {}", timeClosed, file);
+          drainLog.trace("Order section: {} and {}", timeClosed, file);
         } else {
           file = rowHolder.toString();
         }
 
         // Skip files that we didn't observe when we started (new files/data)
         if (!relevantLogs.contains(file)) {
-          log.trace("Found file that we didn't care about {}", file);
+          drainLog.trace("Found file that we didn't care about {}", file);
           continue;
         } else {
-          log.trace("Found file that we *do* care about {}", file);
+          drainLog.trace("Found file that we *do* care about {}", file);
         }
 
         try {
           Status stat = Status.parseFrom(entry.getValue().get());
           if (!StatusUtil.isFullyReplicated(stat)) {
-            log.trace("{} and {} is not fully replicated", entry.getKey().getRow(), ProtobufUtil.toString(stat));
+            drainLog.trace("{} and {} is not replicated", file, ProtobufUtil.toString(stat));
             return false;
           }
+          drainLog.trace("{} and {} is replicated", file, ProtobufUtil.toString(stat));
         } catch (InvalidProtocolBufferException e) {
-          log.trace("Could not parse protobuf for {}", entry.getKey(), e);
+          drainLog.trace("Could not parse protobuf for {}", entry.getKey(), e);
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/5947b420/server/master/src/main/java/org/apache/accumulo/master/replication/FinishedWorkUpdater.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/replication/FinishedWorkUpdater.java
b/server/master/src/main/java/org/apache/accumulo/master/replication/FinishedWorkUpdater.java
index b20fdcc..c40743e 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/replication/FinishedWorkUpdater.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/replication/FinishedWorkUpdater.java
@@ -150,7 +150,7 @@ public class FinishedWorkUpdater implements Runnable {
           // Make the mutation
           StatusSection.add(replMutation, buffer, serializedUpdatedStatus);
 
-          log.debug("Updating replication status entry for {} with {}", serializedRow.getKey().getRow(),
updatedStatus);
+          log.debug("Updating replication status entry for {} with {}", serializedRow.getKey().getRow(),
ProtobufUtil.toString(updatedStatus));
 
           try {
             replBw.addMutation(replMutation);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/5947b420/test/src/test/java/org/apache/accumulo/test/replication/MultiInstanceReplicationIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/replication/MultiInstanceReplicationIT.java
b/test/src/test/java/org/apache/accumulo/test/replication/MultiInstanceReplicationIT.java
index 3dc029e..bd10f90 100644
--- a/test/src/test/java/org/apache/accumulo/test/replication/MultiInstanceReplicationIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/replication/MultiInstanceReplicationIT.java
@@ -252,8 +252,10 @@ public class MultiInstanceReplicationIT extends ConfigurableMacIT {
 
         @Override
         public Boolean call() throws Exception {
+          long then = System.currentTimeMillis();
           connMaster.replicationOperations().drain(masterTable, filesNeedingReplication);
-          log.info("Drain completed");
+          long now = System.currentTimeMillis();
+          log.info("Drain completed in " + (now - then) + "ms");
           return true;
         }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/5947b420/test/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/test/src/test/resources/log4j.properties b/test/src/test/resources/log4j.properties
index 26ea762..8ab1d7b 100644
--- a/test/src/test/resources/log4j.properties
+++ b/test/src/test/resources/log4j.properties
@@ -53,3 +53,5 @@ log4j.logger.org.apache.thrift.transport.TSaslTransport=INFO
 log4j.logger.org.apache.mina=INFO
 log4j.logger.org.apache.accumulo.server.thrift.UGIAssumingProcessor=TRACE
 log4j.logger.org.apache.hadoop.security.UserGroupInformation=INFO
+# For debugging replication tests.
+log4j.logger.org.apache.accumulo.master.MasterDrainImpl=TRACE
\ No newline at end of file


Mime
View raw message