@Override public void run() { synchronized (BasicServlet.class) { if (cachedInstanceName == null) { cachedInstanceName = HdfsZooInstance.getInstance().getInstanceName(); } } } }, 1000);
@Override public Repo<Master> call(long tid, Master environment) throws Exception { Utils.idLock.lock(); try { Instance instance = HdfsZooInstance.getInstance(); cloneInfo.tableId = Utils.getNextTableId(cloneInfo.tableName, instance); return new ClonePermissions(cloneInfo); } finally { Utils.idLock.unlock(); } }
public static String getRootTabletDir() throws IOException { IZooReaderWriter zoo = ZooReaderWriter.getInstance(); String zpath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + RootTable.ZROOT_TABLET_PATH; try { return new String(zoo.getData(zpath, null), UTF_8); } catch (KeeperException e) { throw new IOException(e); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IOException(e); } }
public static void enableTracing(String address, String application) { try { DistributedTrace.enable(HdfsZooInstance.getInstance(), ZooReaderWriter.getInstance(), application, address); } catch (Exception ex) { log.error("creating remote sink for trace spans", ex); } }
private String getZPath() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); dos.writeUTF(getTableName()); dos.writeUTF(getProblemType().name()); dos.writeUTF(getResource()); dos.close(); baos.close(); String zpath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZPROBLEMS + "/" + Encoding.encodeAsBase64FileName(new Text(baos.toByteArray())); return zpath; }
@Override public Instance getInstance() { if (mock) return new MockInstance(instance); if (instance == null) { return HdfsZooInstance.getInstance(); } return new ZooKeeperInstance(this.instance, this.zookeepers); } }
@Override synchronized public Instance getInstance() { if (cachedInstance != null) return cachedInstance; if (mock) return cachedInstance = new MockInstance(instance); if (instance == null) { return cachedInstance = HdfsZooInstance.getInstance(); } return cachedInstance = new ZooKeeperInstance(this.instance, this.zookeepers); }
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 Map<String,Long> getBulkFilesLoaded(TCredentials credentials, Text metadataRow) { Map<String,Long> ret = new HashMap<String,Long>(); Scanner scanner = new ScannerImpl(HdfsZooInstance.getInstance(), credentials, Constants.METADATA_TABLE_ID, Constants.NO_AUTHS); scanner.setRange(new Range(metadataRow)); scanner.fetchColumnFamily(Constants.METADATA_BULKFILE_COLUMN_FAMILY); for (Entry<Key,Value> entry : scanner) { String file = entry.getKey().getColumnQualifier().toString(); Long tid = Long.parseLong(entry.getValue().toString()); ret.put(file, tid); } return ret; }
static ProblemReport decodeZooKeeperEntry(String node) throws Exception { byte bytes[] = Encoding.decodeBase64FileName(node); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); DataInputStream dis = new DataInputStream(bais); String tableName = dis.readUTF(); String problemType = dis.readUTF(); String resource = dis.readUTF(); String zpath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZPROBLEMS + "/" + node; byte[] enc = ZooReaderWriter.getInstance().getData(zpath, null); return new ProblemReport(tableName, ProblemType.valueOf(problemType), resource, enc); }
@Override public Instance getInstance() { if (mock) return DeprecationUtil.makeMockInstance(instance); if (instance == null) { return HdfsZooInstance.getInstance(); } return new ZooKeeperInstance(this.getClientConfiguration()); } }
@Override synchronized public Instance getInstance() { if (cachedInstance != null) return cachedInstance; if (mock) return cachedInstance = DeprecationUtil.makeMockInstance(instance); if (instance == null) { return cachedInstance = HdfsZooInstance.getInstance(); } return cachedInstance = new ZooKeeperInstance(getClientConfiguration()); } }
public static void stop(String type, long tid) throws KeeperException, InterruptedException { Instance instance = HdfsZooInstance.getInstance(); IZooReaderWriter writer = ZooReaderWriter.getInstance(); writer.recursiveDelete(ZooUtil.getRoot(instance) + "/" + type + "/" + tid, NodeMissingPolicy.SKIP); }
@Override synchronized public Instance getInstance() { if (cachedInstance != null) return cachedInstance; if (mock) return cachedInstance = DeprecationUtil.makeMockInstance(instance); if (instance == null) { return cachedInstance = HdfsZooInstance.getInstance(); } return cachedInstance = new ZooKeeperInstance(this.getClientConfiguration()); }
@Override public void undo(long tid, Master environment) throws Exception { Instance instance = HdfsZooInstance.getInstance(); TableManager.getInstance().removeTable(cloneInfo.tableId); Utils.unreserveTable(cloneInfo.tableId, tid, true); Tables.clearCache(instance); }
private TableManager() { instance = HdfsZooInstance.getInstance(); zooStateCache = new ZooCache(new TableStateWatcher()); updateTableStateCache(); }
public static void main(String args[]) throws Exception { getInstance( new AccumuloServerContext(new ServerConfigurationFactory(HdfsZooInstance.getInstance()))) .printProblems(); }
@Override protected void pageBody(HttpServletRequest req, HttpServletResponse response, StringBuilder sb) throws IOException { Map<String,String> tidToNameMap = Tables.getIdToNameMap(HdfsZooInstance.getInstance()); doLogEventBanner(sb); TablesServlet.doProblemsBanner(sb); doMasterStatus(req, sb); doRecoveryList(req, sb); TablesServlet.doTableList(req, sb, tidToNameMap); }
public static void main(String[] args) throws Exception { SecurityUtil.serverLogin(); Instance instance = HdfsZooInstance.getInstance(); ServerConfiguration conf = new ServerConfiguration(instance); FileSystem fs = FileUtil.getFileSystem(CachedConfiguration.getInstance(), conf.getConfiguration()); Accumulo.init(fs, conf, "tracer"); String hostname = Accumulo.getLocalAddress(args); TraceServer server = new TraceServer(conf, hostname); Accumulo.enableTracing(hostname, "tserver"); server.run(); log.info("tracer stopping"); }
public static void main(String[] args) throws Exception { SecurityUtil.serverLogin(); FileSystem fs = FileUtil.getFileSystem(CachedConfiguration.getInstance(), ServerConfiguration.getSiteConfiguration()); String hostname = Accumulo.getLocalAddress(args); instance = HdfsZooInstance.getInstance(); config = new ServerConfiguration(instance); Accumulo.init(fs, config, "monitor"); Monitor monitor = new Monitor(); Accumulo.enableTracing(hostname, "monitor"); monitor.run(hostname); }