ACCUMULO-802 changed TableNamespaceConfiguration to update it's tables confs when it changes
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/3e34db5f Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/3e34db5f Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/3e34db5f Branch: refs/heads/ACCUMULO-802 Commit: 3e34db5f853bb78a0c57a4cb31415810767bc18c Parents: 57dd6c9 Author: Sean Hickey <[email protected]> Authored: Fri Jul 26 11:32:49 2013 -0400 Committer: Christopher Tubbs <[email protected]> Committed: Thu Oct 31 21:25:35 2013 -0400 ---------------------------------------------------------------------- .../conf/TableNamespaceConfiguration.java | 28 +++++++++++++++++++- .../accumulo/test/TableNamespacesTest.java | 6 ++--- 2 files changed, 30 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/3e34db5f/server/base/src/main/java/org/apache/accumulo/server/conf/TableNamespaceConfiguration.java ---------------------------------------------------------------------- diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/TableNamespaceConfiguration.java b/server/base/src/main/java/org/apache/accumulo/server/conf/TableNamespaceConfiguration.java index 2334ce7..bf3c0bb 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/conf/TableNamespaceConfiguration.java +++ b/server/base/src/main/java/org/apache/accumulo/server/conf/TableNamespaceConfiguration.java @@ -23,6 +23,8 @@ import java.util.TreeMap; import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.Instance; +import org.apache.accumulo.core.client.TableNamespaceNotFoundException; +import org.apache.accumulo.core.client.impl.TableNamespaces; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.zookeeper.ZooUtil; @@ -81,7 +83,7 @@ public class TableNamespaceConfiguration extends AccumuloConfiguration { if (propCache == null) synchronized (TableNamespaceConfiguration.class) { if (propCache == null) - propCache = new ZooCache(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut(), new TableConfWatcher(inst)); + propCache = new ZooCache(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut(), new TableNamespaceConfWatcher(inst)); } return propCache; } @@ -133,17 +135,41 @@ public class TableNamespaceConfiguration extends AccumuloConfiguration { Collection<ConfigurationObserver> copy = Collections.unmodifiableCollection(observers); for (ConfigurationObserver co : copy) co.sessionExpired(); + + try { + for (String t : TableNamespaces.getTableIds(inst, namespaceId)) { + ServerConfiguration.getTableConfiguration(inst, t).expireAllObservers(); + } + } catch (TableNamespaceNotFoundException e) { + throw new IllegalStateException("The namespace (" + namespaceId + ") for this configuration no longer exists"); + } } public void propertyChanged(String key) { Collection<ConfigurationObserver> copy = Collections.unmodifiableCollection(observers); for (ConfigurationObserver co : copy) co.propertyChanged(key); + + try { + for (String t : TableNamespaces.getTableIds(inst, namespaceId)) { + ServerConfiguration.getTableConfiguration(inst, t).propertyChanged(key); + } + } catch (TableNamespaceNotFoundException e) { + throw new IllegalStateException("The namespace (" + namespaceId + ") for this configuration no longer exists"); + } } public void propertiesChanged(String key) { Collection<ConfigurationObserver> copy = Collections.unmodifiableCollection(observers); for (ConfigurationObserver co : copy) co.propertiesChanged(); + + try { + for (String t : TableNamespaces.getTableIds(inst, namespaceId)) { + ServerConfiguration.getTableConfiguration(inst, t).propertiesChanged(key); + } + } catch (TableNamespaceNotFoundException e) { + throw new IllegalStateException("The namespace (" + namespaceId + ") for this configuration no longer exists"); + } } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/3e34db5f/test/src/test/java/org/apache/accumulo/test/TableNamespacesTest.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/TableNamespacesTest.java b/test/src/test/java/org/apache/accumulo/test/TableNamespacesTest.java index e3455fb..ceca3be 100644 --- a/test/src/test/java/org/apache/accumulo/test/TableNamespacesTest.java +++ b/test/src/test/java/org/apache/accumulo/test/TableNamespacesTest.java @@ -390,11 +390,11 @@ public class TableNamespacesTest { c.tableNamespaceOperations().removeIterator(namespace, iter, EnumSet.copyOf(scope)); c.tableNamespaceOperations().addConstraint(namespace, NumericValueConstraint.class.getName()); - c.tableOperations().addConstraint(tableName, AlphaNumKeyConstraint.class.getName()); + //c.tableOperations().addConstraint(tableName, AlphaNumKeyConstraint.class.getName()); - for (Entry<String,Integer> e : c.tableOperations().listConstraints(tableName).entrySet()) { + /*for (Entry<String,Integer> e : c.tableOperations().listConstraints(tableName).entrySet()) { System.out.println(e.toString()); - } + }*/ //UtilWaitThread.sleep(10000); m = new Mutation("rowy");
