public String getZooKeeperRoot() { return context.getZooKeeperRoot(); }
private static String getPath(ServerContext context, Namespace.ID namespaceId) { return context.getZooKeeperRoot() + Constants.ZNAMESPACES + "/" + namespaceId + Constants.ZNAMESPACE_CONF; } }
protected ZooConfiguration(ServerContext context, ZooCache propCache, AccumuloConfiguration parent) { this.context = context; this.propCache = propCache; this.parent = parent; this.propPathPrefix = context.getZooKeeperRoot() + Constants.ZCONFIG; }
public NamespaceConfiguration(Namespace.ID namespaceId, ServerContext context, AccumuloConfiguration parent) { this.context = context; this.parent = parent; this.namespaceId = namespaceId; this.path = context.getZooKeeperRoot() + Constants.ZNAMESPACES + "/" + namespaceId + Constants.ZNAMESPACE_CONF; }
NamespaceConfWatcher(ServerContext context) { this.context = context; namespacesPrefix = context.getZooKeeperRoot() + Constants.ZNAMESPACES + "/"; namespacesPrefixLength = namespacesPrefix.length(); }
TableConfWatcher(ServerContext context) { this.context = context; tablesPrefix = context.getZooKeeperRoot() + Constants.ZTABLES + "/"; scf = context.getServerConfFactory(); }
public static void cleanup(ServerContext context, String type, long tid) throws KeeperException, InterruptedException { IZooReaderWriter writer = context.getZooReaderWriter(); writer.recursiveDelete(context.getZooKeeperRoot() + "/" + type + "/" + tid, NodeMissingPolicy.SKIP); writer.recursiveDelete(context.getZooKeeperRoot() + "/" + type + "/" + tid + "-running", NodeMissingPolicy.SKIP); }
public static void setRootTabletDir(ServerContext context, String dir) throws IOException { IZooReaderWriter zoo = context.getZooReaderWriter(); String zpath = context.getZooKeeperRoot() + RootTable.ZROOT_TABLET_PATH; try { zoo.putPersistentData(zpath, dir.getBytes(UTF_8), -1, NodeExistsPolicy.OVERWRITE); } catch (KeeperException e) { throw new IOException(e); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IOException(e); } }
public static void start(ServerContext context, String type, long tid) throws KeeperException, InterruptedException { IZooReaderWriter writer = context.getZooReaderWriter(); writer.putPersistentData(context.getZooKeeperRoot() + "/" + type, new byte[] {}, NodeExistsPolicy.OVERWRITE); writer.putPersistentData(context.getZooKeeperRoot() + "/" + type + "/" + tid, new byte[] {}, NodeExistsPolicy.OVERWRITE); writer.putPersistentData(context.getZooKeeperRoot() + "/" + type + "/" + tid + "-running", new byte[] {}, NodeExistsPolicy.OVERWRITE); }
public ZooStore(ServerContext context) { this.context = context; cache = new ZooCache(context.getZooReaderWriter(), null); String zkRoot = context.getZooKeeperRoot(); if (zkRoot.endsWith("/")) zkRoot = zkRoot.substring(0, zkRoot.length() - 1); this.basePath = zkRoot; }
void removeFromZooKeeper(ZooReaderWriter zoorw, ServerContext context) throws IOException, KeeperException, InterruptedException { String zpath = getZPath(context.getZooKeeperRoot()); zoorw.recursiveDelete(zpath, NodeMissingPolicy.SKIP); }
@Override public boolean transactionComplete(String type, long tid) throws Exception { String path = context.getZooKeeperRoot() + "/" + type + "/" + tid + "-running"; rdr.sync(path); return !rdr.exists(path); } }
@Override public boolean transactionAlive(String type, long tid) throws Exception { String path = context.getZooKeeperRoot() + "/" + type + "/" + tid; rdr.sync(path); return rdr.exists(path); }
public static boolean setTableProperty(ServerContext context, Table.ID tableId, String property, String value) throws KeeperException, InterruptedException { return setTableProperty(context.getZooReaderWriter(), context.getZooKeeperRoot(), tableId, property, value); }
public static void stop(ServerContext context, String type, long tid) throws KeeperException, InterruptedException { IZooReaderWriter writer = context.getZooReaderWriter(); writer.recursiveDelete(context.getZooKeeperRoot() + "/" + type + "/" + tid, NodeMissingPolicy.SKIP); }
public static long reserveHdfsDirectory(Master env, String directory, long tid) throws KeeperException, InterruptedException { String resvPath = env.getContext().getZooKeeperRoot() + Constants.ZHDFS_RESERVATIONS + "/" + Base64.getEncoder().encodeToString(directory.getBytes(UTF_8)); IZooReaderWriter zk = env.getContext().getZooReaderWriter(); if (ZooReservation.attempt(zk, resvPath, String.format("%016x", tid), "")) { return 0; } else return 50; }
public static void unreserveHdfsDirectory(Master env, String directory, long tid) throws KeeperException, InterruptedException { String resvPath = env.getContext().getZooKeeperRoot() + Constants.ZHDFS_RESERVATIONS + "/" + Base64.getEncoder().encodeToString(directory.getBytes(UTF_8)); ZooReservation.release(env.getContext().getZooReaderWriter(), resvPath, String.format("%016x", tid)); }
static ProblemReport decodeZooKeeperEntry(ServerContext context, String node) throws IOException, KeeperException, InterruptedException { byte bytes[] = Encoding.decodeBase64FileName(node); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); DataInputStream dis = new DataInputStream(bais); Table.ID tableId = Table.ID.of(dis.readUTF()); String problemType = dis.readUTF(); String resource = dis.readUTF(); String zpath = context.getZooKeeperRoot() + Constants.ZPROBLEMS + "/" + node; byte[] enc = context.getZooReaderWriter().getData(zpath, null); return new ProblemReport(tableId, ProblemType.valueOf(problemType), resource, enc); }
void saveToZooKeeper(ServerContext context) throws IOException, KeeperException, InterruptedException { context.getZooReaderWriter().putPersistentData(getZPath(context.getZooKeeperRoot()), encode(), NodeExistsPolicy.OVERWRITE); }
public TableManager(ServerContext context) { this.context = context; zkRoot = context.getZooKeeperRoot(); instanceID = context.getInstanceID(); zoo = context.getZooReaderWriter(); zooStateCache = new ZooCache(zoo, new TableStateWatcher()); updateTableStateCache(); }