@Override public TCredentials toThrift(Instance instance) { if (!AS_THRIFT.getInstanceId().equals(instance.getInstanceID())) throw new IllegalArgumentException("Unexpected instance used for " + SystemCredentials.class.getSimpleName() + ": " + instance.getInstanceID()); return AS_THRIFT; }
private static String getKey(Instance instance, String metadataTableName, Set<Authorizations> auths) { StringBuilder builder = new StringBuilder(); builder.append(instance.getInstanceID()).append('\0'); builder.append(metadataTableName).append('\0'); builder.append(auths); return builder.toString(); }
public ServerConfigurationFactory(Instance instance) { this.instance = instance; instanceID = instance.getInstanceID(); addInstanceToCaches(instanceID); }
private UniqueNameAllocator() { nextNamePath = Constants.ZROOT + "/" + HdfsZooInstance.getInstance().getInstanceID() + Constants.ZNEXT_FILE; rand = new Random(); }
private String getPath() { return ZooUtil.getRoot(instance.getInstanceID()) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_CONF; }
long getCompactionCancelID() { String zTablePath = Constants.ZROOT + "/" + tabletServer.getInstance().getInstanceID() + Constants.ZTABLES + "/" + extent.getTableId() + Constants.ZTABLE_COMPACT_CANCEL_ID; try { return Long .parseLong(new String(ZooReaderWriter.getInstance().getData(zTablePath, null), UTF_8)); } catch (KeeperException e) { throw new RuntimeException(e); } catch (InterruptedException e) { throw new RuntimeException(e); } }
protected SecurityOperation(AccumuloServerContext context) { this.context = context; ZKUserPath = Constants.ZROOT + "/" + context.getInstance().getInstanceID() + "/users"; zooCache = new ZooCache(); }
public void addTable(String tableId, String namespaceId, String tableName, NodeExistsPolicy existsPolicy) throws KeeperException, InterruptedException, NamespaceNotFoundException { prepareNewTableState(instance.getInstanceID(), tableId, namespaceId, tableName, TableState.NEW, existsPolicy); updateTableStateCache(tableId); }
long getCompactionCancelID() { String zTablePath = Constants.ZROOT + "/" + HdfsZooInstance.getInstance().getInstanceID() + Constants.ZTABLES + "/" + extent.getTableId() + Constants.ZTABLE_COMPACT_CANCEL_ID; try { return Long.parseLong(new String(ZooReaderWriter.getRetryingInstance().getData(zTablePath, null), UTF_8)); } catch (KeeperException e) { throw new RuntimeException(e); } catch (InterruptedException e) { throw new RuntimeException(e); } }
public static synchronized SecurityOperation getInstance() { String instanceId = HdfsZooInstance.getInstance().getInstanceID(); return getInstance(instanceId, false); }
public static void main(String[] args) { Instance instance = HdfsZooInstance.getInstance(); System.out.println("Instance Name: " + instance.getInstanceName()); System.out.println("Instance ID: " + instance.getInstanceID()); System.out.println("ZooKeepers: " + instance.getZooKeepers()); System.out.println("Masters: " + StringUtil.join(instance.getMasterLocations(), ", ")); }
public void clearMergeState(Text tableId) throws IOException, KeeperException, InterruptedException { synchronized (mergeLock) { String path = ZooUtil.getRoot(instance.getInstanceID()) + Constants.ZTABLES + "/" + tableId.toString() + "/merge"; ZooReaderWriter.getInstance().recursiveDelete(path, NodeMissingPolicy.SKIP); mergeLock.notifyAll(); } nextEvent.event("Merge state of %s cleared", tableId); }
protected Connector getConnector(ByteBuffer login) throws Exception { String[] pair = ByteBufferUtil.toString(login).split(",", 2); if (instance.getInstanceID().equals(pair[0])) { Credentials creds = Credentials.deserialize(pair[1]); return instance.getConnector(creds.getPrincipal(), creds.getToken()); } else { throw new org.apache.accumulo.core.client.AccumuloSecurityException(pair[0], org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.INVALID_INSTANCEID); } }
public void clearMergeState(String tableId) throws IOException, KeeperException, InterruptedException { synchronized (mergeLock) { String path = ZooUtil.getRoot(getInstance().getInstanceID()) + Constants.ZTABLES + "/" + tableId + "/merge"; ZooReaderWriter.getInstance().recursiveDelete(path, NodeMissingPolicy.SKIP); mergeLock.notifyAll(); } nextEvent.event("Merge state of %s cleared", tableId); }
private static void deleteInstance(Instance origInstance, String oldPass) throws Exception { IZooReaderWriter orig = new ZooReaderWriter(origInstance.getZooKeepers(), origInstance.getZooKeepersSessionTimeOut(), oldPass); orig.recursiveDelete("/accumulo/" + origInstance.getInstanceID(), NodeMissingPolicy.SKIP); } }
synchronized public static ZooConfiguration getInstance(Instance inst, AccumuloConfiguration parent) { if (instance == null) { propCache = new ZooCache(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut()); instance = new ZooConfiguration(parent); instanceId = inst.getInstanceID(); } return instance; }
public static void clearCache(Instance instance) { getZooCache(instance).clear(ZooUtil.getRoot(instance) + Constants.ZTABLES); getZooCache(instance).clear(ZooUtil.getRoot(instance) + Constants.ZNAMESPACES); instanceToMapCache.invalidate(instance.getInstanceID()); }
public static synchronized SecurityOperation getInstance(AccumuloServerContext context, boolean initialize) { if (instance == null) { String instanceId = context.getInstance().getInstanceID(); instance = new AuditedSecurityOperation(context, getAuthorizor(instanceId, initialize), getAuthenticator(instanceId, initialize), getPermHandler(instanceId, initialize)); } return instance; }
public static synchronized SecurityOperation getInstance(AccumuloServerContext context, boolean initialize) { if (instance == null) { String instanceId = context.getInstance().getInstanceID(); instance = new SecurityOperation(context, getAuthorizor(instanceId, initialize), getAuthenticator(instanceId, initialize), getPermHandler(instanceId, initialize)); } return instance; }
public void printInfo() throws IOException { reader.print("\n" + SHELL_DESCRIPTION + "\n" + "- \n" + "- version: " + Constants.VERSION + "\n" + "- instance name: " + connector.getInstance().getInstanceName() + "\n" + "- instance id: " + connector.getInstance().getInstanceID() + "\n" + "- \n" + "- type 'help' for a list of available commands\n" + "- \n"); reader.flush(); }