Repository: accumulo
Updated Branches:
  refs/heads/ACCUMULO-4169 [created] 7a654ee06


ACCUMULO-4169: Remove contexts not defined in the configuration

Contexts can be defined and not configured for a table, which are then used on 
Scanners. By
cleaning up contexts not defined on tables, contexts could be closed while they 
are in use in
a scan session. Only clean up 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/0b2f2886
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/0b2f2886
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/0b2f2886

Branch: refs/heads/ACCUMULO-4169
Commit: 0b2f28860817cc41fde48126b969de704cbd60d4
Parents: 1d49030
Author: Dave Marion <dlmar...@apache.org>
Authored: Tue Mar 29 13:27:07 2016 -0400
Committer: Dave Marion <dlmar...@apache.org>
Committed: Tue Mar 29 13:27:07 2016 -0400

----------------------------------------------------------------------
 .../apache/accumulo/tserver/TabletServer.java   | 25 +++-----------------
 .../start/classloader/vfs/ContextManager.java   |  4 ++--
 2 files changed, 5 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/0b2f2886/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 d19dfa9..6a4cf67 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
@@ -2753,29 +2753,10 @@ public class TabletServer extends AccumuloServerContext 
implements Runnable {
     Runnable contextCleaner = new Runnable() {
       @Override
       public void run() {
-        ArrayList<KeyExtent> extents;
-
-        synchronized (onlineTablets) {
-          extents = new ArrayList<KeyExtent>(onlineTablets.keySet());
-        }
-
-        Set<String> tables = new HashSet<String>();
-
-        for (KeyExtent keyExtent : extents) {
-          tables.add(keyExtent.getTableId());
-        }
-
-        HashSet<String> contexts = new HashSet<String>();
-
-        for (String tableid : tables) {
-          String context = getTableConfiguration(new KeyExtent(tableid, null, 
null)).get(Property.TABLE_CLASSPATH);
-          if (!context.equals("")) {
-            contexts.add(context);
-          }
-        }
-
+        Set<String> configuredContexts = 
getServerConfigurationFactory().getConfiguration().getAllPropertiesWithPrefix(Property.VFS_CONTEXT_CLASSPATH_PROPERTY)
+            .keySet();
         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/0b2f2886/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 1cf8637..fc793c3 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,13 @@ public class ContextManager {
     }
   }
 
-  public void removeUnusedContexts(Set<String> inUse) {
+  public void removeUnusedContexts(Set<String> configuredContexts) {
 
     Map<String,Context> unused;
 
     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