Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@ private static ZooCache getZooCache(final Instance instance) {
if (sm != null) {
sm.checkPermission(TABLES_PERMISSION);
}
final String zks = instance.getZooKeepers();
final int timeOut = instance.getZooKeepersSessionTimeOut();

final String uuid = instance.getInstanceID();

try {
return instanceToZooCache.get(uuid, new Callable<ZooCache>() {
@Override
public ZooCache call() {
final String zks = instance.getZooKeepers();
final int timeOut = instance.getZooKeepersSessionTimeOut();
return new ZooCacheFactory().getZooCache(zks, timeOut, new Watcher() {
@Override
public void process(WatchedEvent watchedEvent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class NamespaceConfiguration extends ObservableConfiguration {
protected String namespaceId = null;
protected Instance inst = null;
private ZooCacheFactory zcf = new ZooCacheFactory();
private final String path;

public NamespaceConfiguration(String namespaceId, AccumuloConfiguration parent) {
this(namespaceId, HdfsZooInstance.getInstance(), parent);
Expand All @@ -54,6 +55,7 @@ public NamespaceConfiguration(String namespaceId, Instance inst, AccumuloConfigu
this.inst = inst;
this.parent = parent;
this.namespaceId = namespaceId;
this.path = ZooUtil.getRoot(inst.getInstanceID()) + Constants.ZNAMESPACES + "/" + namespaceId + Constants.ZNAMESPACE_CONF;
}

/**
Expand Down Expand Up @@ -85,7 +87,7 @@ private synchronized ZooCachePropertyAccessor getPropCacheAccessor() {
}

private String getPath() {
return ZooUtil.getRoot(inst.getInstanceID()) + Constants.ZNAMESPACES + "/" + getNamespaceId() + Constants.ZNAMESPACE_CONF;
return path;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.Map;

import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.impl.Tables;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.ConfigSanityCheck;
Expand Down Expand Up @@ -189,8 +190,13 @@ public NamespaceConfiguration getNamespaceConfigurationForTable(String tableId)
// can't hold the lock during the construction and validation of the config,
// which may result in creating multiple objects for the same id, but that's ok.
if (conf == null) {
// changed - include instance in constructor call
conf = new TableParentConfiguration(tableId, instance, getConfiguration());
String namespaceId;
try {
namespaceId = Tables.getNamespaceId(instance, tableId);
} catch (TableNotFoundException e) {
throw new RuntimeException(e);
}
conf = new NamespaceConfiguration(namespaceId, instance, getConfiguration());
ConfigSanityCheck.validate(conf);
synchronized (tableParentConfigs) {
tableParentConfigs.get(instanceID).put(tableId, conf);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,17 @@ public void setUp() {
iid = UUID.randomUUID().toString();
instance = createMock(Instance.class);
parent = createMock(AccumuloConfiguration.class);
c = new NamespaceConfiguration(NSID, instance, parent);
zcf = createMock(ZooCacheFactory.class);
c.setZooCacheFactory(zcf);

expect(instance.getInstanceID()).andReturn(iid);
expectLastCall().anyTimes();
expect(instance.getZooKeepers()).andReturn(ZOOKEEPERS);
expect(instance.getZooKeepersSessionTimeOut()).andReturn(ZK_SESSION_TIMEOUT);
replay(instance);

c = new NamespaceConfiguration(NSID, instance, parent);
zcf = createMock(ZooCacheFactory.class);
c.setZooCacheFactory(zcf);

zc = createMock(ZooCache.class);
expect(zcf.getZooCache(eq(ZOOKEEPERS), eq(ZK_SESSION_TIMEOUT), anyObject(NamespaceConfWatcher.class))).andReturn(zc);
replay(zcf);
Expand Down