Repository: accumulo
Updated Branches:
  refs/heads/1.6 b040557aa -> f6bfe9018


ACCUMULO-4169: Close contexts that are not in the configuration.


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

Branch: refs/heads/1.6
Commit: f6bfe9018d1136e2ff972b8bb8a43732ee625fef
Parents: b040557
Author: Dave Marion <dlmar...@apache.org>
Authored: Thu Mar 31 14:10:18 2016 -0400
Committer: Dave Marion <dlmar...@apache.org>
Committed: Thu Mar 31 14:10:18 2016 -0400

----------------------------------------------------------------------
 assemble/conf/templates/accumulo-env.sh         |  2 +-
 .../apache/accumulo/tserver/TabletServer.java   | 25 ++++----------------
 .../start/classloader/vfs/ContextManager.java   |  7 ++++--
 3 files changed, 11 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/f6bfe901/assemble/conf/templates/accumulo-env.sh
----------------------------------------------------------------------
diff --git a/assemble/conf/templates/accumulo-env.sh 
b/assemble/conf/templates/accumulo-env.sh
index e136a3f..a06a4cd 100644
--- a/assemble/conf/templates/accumulo-env.sh
+++ b/assemble/conf/templates/accumulo-env.sh
@@ -51,7 +51,7 @@ test -z "$ACCUMULO_TSERVER_OPTS" && export 
ACCUMULO_TSERVER_OPTS="${POLICY} ${tS
 test -z "$ACCUMULO_MASTER_OPTS"  && export ACCUMULO_MASTER_OPTS="${POLICY} 
${masterHigh_masterLow}"
 test -z "$ACCUMULO_MONITOR_OPTS" && export ACCUMULO_MONITOR_OPTS="${POLICY} 
${monitorHigh_monitorLow}"
 test -z "$ACCUMULO_GC_OPTS"      && export ACCUMULO_GC_OPTS="${gcHigh_gcLow}"
-test -z "$ACCUMULO_GENERAL_OPTS" && export 
ACCUMULO_GENERAL_OPTS="-XX:+UseConcMarkSweepGC 
-XX:CMSInitiatingOccupancyFraction=75 -Djava.net.preferIPv4Stack=true"
+test -z "$ACCUMULO_GENERAL_OPTS" && export 
ACCUMULO_GENERAL_OPTS="-XX:+UseConcMarkSweepGC 
-XX:CMSInitiatingOccupancyFraction=75 -Djava.net.preferIPv4Stack=true 
-XX:+CMSClassUnloadingEnabled"
 test -z "$ACCUMULO_OTHER_OPTS"   && export 
ACCUMULO_OTHER_OPTS="${otherHigh_otherLow}"
 # what do when the JVM runs out of heap memory
 export ACCUMULO_KILL_CMD='kill -9 %p'

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f6bfe901/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 f3748d7..ac8f2ec 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
@@ -3588,29 +3588,14 @@ public class TabletServer extends AbstractMetricsImpl 
implements org.apache.accu
     Runnable contextCleaner = new Runnable() {
       @Override
       public void run() {
-        ArrayList<KeyExtent> extents;
-
-        synchronized (onlineTablets) {
-          extents = new ArrayList<KeyExtent>(onlineTablets.keySet());
-        }
-
-        Set<Text> tables = new HashSet<Text>();
-
-        for (KeyExtent keyExtent : extents) {
-          tables.add(keyExtent.getTableId());
-        }
-
-        HashSet<String> contexts = new HashSet<String>();
-
-        for (Text tableid : tables) {
-          String context = getTableConfiguration(new KeyExtent(tableid, null, 
null)).get(Property.TABLE_CLASSPATH);
-          if (!context.equals("")) {
-            contexts.add(context);
-          }
+        Set<String> contextProperties = 
getSystemConfiguration().getAllPropertiesWithPrefix(Property.VFS_CONTEXT_CLASSPATH_PROPERTY).keySet();
+        Set<String> configuredContexts = new HashSet<String>();
+        for (String prop : contextProperties) {
+          
configuredContexts.add(prop.substring(Property.VFS_CONTEXT_CLASSPATH_PROPERTY.name().length()));
         }
 
         try {
-          
AccumuloVFSClassLoader.getContextManager().removeUnusedContexts(contexts);
+          
AccumuloVFSClassLoader.getContextManager().removeUnusedContexts(configuredContexts);
         } catch (IOException e) {
           log.warn(e.getMessage(), e);
         }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f6bfe901/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
----------------------------------------------------------------------
diff --git 
a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
 
b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
index c9ebc52..981322c 100644
--- 
a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
+++ 
b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
@@ -189,13 +189,16 @@ public class ContextManager {
     }
   }
 
-  public void removeUnusedContexts(Set<String> inUse) {
+  public void removeUnusedContexts(Set<String> configuredContexts) {
 
     Map<String,Context> unused;
 
+    // ContextManager knows of some set of contexts. This method will be 
called with
+    // the set of currently configured contexts. We will close the contexts 
that are
+    // no longer in the configuration.
     synchronized (this) {
       unused = new HashMap<String,Context>(contexts);
-      unused.keySet().removeAll(inUse);
+      unused.keySet().removeAll(configuredContexts);
       contexts.keySet().removeAll(unused.keySet());
     }
 

Reply via email to