accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [2/2] accumulo git commit: ACCUMULO-3549 updated with [~kturner]'s comments
Date Mon, 02 Feb 2015 22:53:03 GMT
ACCUMULO-3549 updated with [~kturner]'s comments


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

Branch: refs/heads/1.6
Commit: c5d2bd54a961ce59946304c6d440b42caa9bdbbb
Parents: ed12e1f
Author: Eric C. Newton <eric.newton@gmail.com>
Authored: Mon Feb 2 17:37:17 2015 -0500
Committer: Eric C. Newton <eric.newton@gmail.com>
Committed: Mon Feb 2 17:37:17 2015 -0500

----------------------------------------------------------------------
 .../accumulo/core/client/impl/TabletLocator.java      |  4 ++++
 .../org/apache/accumulo/tserver/TabletServer.java     | 14 ++------------
 2 files changed, 6 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/c5d2bd54/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
index 1d35af0..5f30ddc 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
@@ -92,6 +92,10 @@ public abstract class TabletLocator {
 
   private static HashMap<LocatorKey,TabletLocator> locators = new HashMap<LocatorKey,TabletLocator>();
 
+  public static synchronized void clearLocators() {
+    locators.clear();
+  }
+
   public static synchronized TabletLocator getLocator(Instance instance, Text tableId) {
 
     LocatorKey key = new LocatorKey(instance.getInstanceID(), tableId);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/c5d2bd54/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index 948d0f0..dbececd 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -65,7 +65,6 @@ import javax.management.StandardMBean;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
-import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.impl.CompressedIterators;
 import org.apache.accumulo.core.client.impl.CompressedIterators.IterConfig;
@@ -287,16 +286,7 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
     SimpleTimer.getInstance().schedule(new Runnable() {
       @Override
       public void run() {
-        try {
-          SystemCredentials creds = SystemCredentials.get();
-          Connector connector = instance.getConnector(creds.getPrincipal(), creds.getToken());
-          for (String id : connector.tableOperations().tableIdMap().values()) {
-            TabletLocator locator = TabletLocator.getLocator(instance, new Text(id));
-            locator.invalidateCache();
-          }
-        } catch (Exception ex) {
-          log.error("Error clearing locator cache, ignoring", ex);
-        }
+        TabletLocator.clearLocators();
       }
     }, jitter(TIME_BETWEEN_LOCATOR_CACHE_CLEARS), jitter(TIME_BETWEEN_LOCATOR_CACHE_CLEARS));
   }
@@ -304,7 +294,7 @@ public class TabletServer extends AbstractMetricsImpl implements org.apache.accu
   private static long jitter(long ms) {
     Random r = new Random();
     // add a random 10% wait
-    return (long)(1. + (r.nextDouble() / 10) * ms);
+    return (long)((1. + (r.nextDouble() / 10)) * ms);
   }
 
   private synchronized static void logGCInfo(AccumuloConfiguration conf) {


Mime
View raw message