gpt4 book ai didi

org.apache.accumulo.server.zookeeper.ZooReaderWriter.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 21:28:03 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.accumulo.server.zookeeper.ZooReaderWriter.<init>()方法的一些代码示例,展示了ZooReaderWriter.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooReaderWriter.<init>()方法的具体详情如下:
包路径:org.apache.accumulo.server.zookeeper.ZooReaderWriter
类名称:ZooReaderWriter
方法名:<init>

ZooReaderWriter.<init>介绍

暂无

代码示例

代码示例来源:origin: org.apache.accumulo/accumulo-test

private Map<String,Boolean> _getWals(Connector c) throws Exception {
 Map<String,Boolean> result = new HashMap<>();
 Instance i = c.getInstance();
 ZooReaderWriter zk = new ZooReaderWriter(i.getZooKeepers(), i.getZooKeepersSessionTimeOut(),
   "");
 WalStateManager wals = new WalStateManager(c.getInstance(), zk);
 for (Entry<Path,WalState> entry : wals.getAllState().entrySet()) {
  // WALs are in use if they are not unreferenced
  result.put(entry.getKey().toString(), entry.getValue() != WalState.UNREFERENCED);
 }
 return result;
}

代码示例来源:origin: org.apache.accumulo/accumulo-server-base

private static void verifyAccumuloIsDown(Instance inst, String oldPassword) throws Exception {
 ZooReader zooReader = new ZooReaderWriter(inst.getZooKeepers(),
   inst.getZooKeepersSessionTimeOut(), oldPassword);
 String root = ZooUtil.getRoot(inst);
 final List<String> ephemerals = new ArrayList<>();
 recurse(zooReader, root, new Visitor() {
  @Override
  public void visit(ZooReader zoo, String path) throws Exception {
   Stat stat = zoo.getStatus(path);
   if (stat.getEphemeralOwner() != 0)
    ephemerals.add(path);
  }
 });
 if (ephemerals.size() > 0) {
  System.err.println("The following ephemeral nodes exist, something is still running:");
  for (String path : ephemerals) {
   System.err.println(path);
  }
  throw new Exception("Accumulo must be shut down in order to run this tool.");
 }
}

代码示例来源:origin: org.apache.accumulo/accumulo-server

private static boolean verifyAccumuloIsDown(Instance inst, String oldPassword) {
 ZooReader zooReader = new ZooReaderWriter(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut(), oldPassword);
 String root = ZooUtil.getRoot(inst);
 final List<String> ephemerals = new ArrayList<String>();
 recurse(zooReader, root, new Visitor() {
  public void visit(ZooReader zoo, String path) throws Exception {
   Stat stat = zoo.getStatus(path);
   if (stat.getEphemeralOwner() != 0)
    ephemerals.add(path);
  }
 });
 if (ephemerals.size() == 0) {
  return true;
 }
 System.err.println("The following ephemeral nodes exist, something is still running:");
 for (String path : ephemerals) {
  System.err.println(path);
 }
 return false;
}

代码示例来源:origin: org.apache.accumulo/accumulo-test

/**
 * Fetch all of the WALs referenced by tablets in the metadata table for this table
 */
private Set<String> getWalsForTable(String tableName) throws Exception {
 final Connector conn = getConnector();
 final String tableId = conn.tableOperations().tableIdMap().get(tableName);
 Assert.assertNotNull("Could not determine table ID for " + tableName, tableId);
 Instance i = conn.getInstance();
 ZooReaderWriter zk = new ZooReaderWriter(i.getZooKeepers(), i.getZooKeepersSessionTimeOut(),
   "");
 WalStateManager wals = new WalStateManager(conn.getInstance(), zk);
 Set<String> result = new HashSet<>();
 for (Entry<Path,WalState> entry : wals.getAllState().entrySet()) {
  log.debug("Reading WALs: {}={}", entry.getKey(), entry.getValue());
  result.add(entry.getKey().toString());
 }
 return result;
}

代码示例来源:origin: org.apache.accumulo/accumulo-server

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);
 }
}

代码示例来源:origin: org.apache.accumulo/accumulo-server-base

public static synchronized ZooReaderWriter getInstance() {
 if (instance == null) {
  AccumuloConfiguration conf = SiteConfiguration.getInstance();
  instance = new ZooReaderWriter(conf.get(Property.INSTANCE_ZK_HOST),
    (int) conf.getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT),
    conf.get(Property.INSTANCE_SECRET));
 }
 return instance;
}

代码示例来源:origin: org.apache.accumulo/accumulo-server

public static synchronized ZooReaderWriter getInstance() {
 if (instance == null) {
  AccumuloConfiguration conf = ServerConfiguration.getSiteConfiguration();
  instance = new ZooReaderWriter(conf.get(Property.INSTANCE_ZK_HOST), (int) conf.getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT),
    conf.get(Property.INSTANCE_SECRET));
 }
 return instance;
}

代码示例来源:origin: org.apache.accumulo/accumulo-server-base

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);
 }
}

代码示例来源:origin: org.apache.accumulo/accumulo-test

Instance instance = conn.getInstance();
ZooReaderWriter zk = new ZooReaderWriter(cluster.getZooKeepers(), 30000, OUR_SECRET);
String path = ZooUtil.getRoot(instance) + Constants.ZGC_LOCK;
for (int i = 0; i < 5; i++) {

代码示例来源:origin: org.apache.accumulo/accumulo-test

private Multimap<String,String> getLogs(Connector conn) throws Exception {
 // Map of server to tableId
 Multimap<TServerInstance,String> serverToTableID = HashMultimap.create();
 Scanner scanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
 scanner.setRange(MetadataSchema.TabletsSection.getRange());
 scanner.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME);
 for (Entry<Key,Value> entry : scanner) {
  TServerInstance key = new TServerInstance(entry.getValue(),
    entry.getKey().getColumnQualifier());
  byte[] tableId = KeyExtent.tableOfMetadataRow(entry.getKey().getRow());
  serverToTableID.put(key, new String(tableId, UTF_8));
 }
 // Map of logs to tableId
 Multimap<String,String> logs = HashMultimap.create();
 Instance i = conn.getInstance();
 ZooReaderWriter zk = new ZooReaderWriter(i.getZooKeepers(), i.getZooKeepersSessionTimeOut(),
   "");
 WalStateManager wals = new WalStateManager(conn.getInstance(), zk);
 for (Entry<TServerInstance,List<UUID>> entry : wals.getAllMarkers().entrySet()) {
  for (UUID id : entry.getValue()) {
   Pair<WalState,Path> state = wals.state(entry.getKey(), id);
   for (String tableId : serverToTableID.get(entry.getKey())) {
    logs.put(state.getSecond().toString(), tableId);
   }
  }
 }
 return logs;
}

代码示例来源:origin: org.apache.accumulo/accumulo-server

private static String rewriteZooKeeperInstance(final Instance inst, String oldPass, String newPass) throws Exception {
 final ZooReaderWriter orig = new ZooReaderWriter(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut(), oldPass);
 final IZooReaderWriter new_ = new ZooReaderWriter(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut(), newPass);
 final String newInstanceId = UUID.randomUUID().toString();
 String root = ZooUtil.getRoot(inst);

代码示例来源:origin: org.apache.accumulo/accumulo-test

private void killMacGc() throws ProcessNotFoundException, InterruptedException, KeeperException {
 // kill gc started by MAC
 getCluster().killProcess(ServerType.GARBAGE_COLLECTOR,
   getCluster().getProcesses().get(ServerType.GARBAGE_COLLECTOR).iterator().next());
 // delete lock in zookeeper if there, this will allow next GC to start quickly
 String path = ZooUtil.getRoot(new ZooKeeperInstance(getCluster().getClientConfig()))
   + Constants.ZGC_LOCK;
 ZooReaderWriter zk = new ZooReaderWriter(cluster.getZooKeepers(), 30000, OUR_SECRET);
 try {
  ZooLock.deleteLock(zk, path);
 } catch (IllegalStateException e) {
 }
 assertNull(getCluster().getProcesses().get(ServerType.GARBAGE_COLLECTOR));
}

代码示例来源:origin: org.apache.accumulo/accumulo-server-base

private static void rewriteZooKeeperInstance(final Instance inst, final String newInstanceId,
  String oldPass, String newPass) throws Exception {
 final ZooReaderWriter orig = new ZooReaderWriter(inst.getZooKeepers(),
   inst.getZooKeepersSessionTimeOut(), oldPass);
 final IZooReaderWriter new_ = new ZooReaderWriter(inst.getZooKeepers(),
   inst.getZooKeepersSessionTimeOut(), newPass);

代码示例来源:origin: org.apache.accumulo/accumulo-test

ZooReaderWriter zk = new ZooReaderWriter(i.getZooKeepers(), i.getZooKeepersSessionTimeOut(),
  "");
WalStateManager wals = new WalStateManager(i, zk);

代码示例来源:origin: org.apache.accumulo/accumulo-test

attempts = 5;
Instance i = conn.getInstance();
ZooReaderWriter zk = new ZooReaderWriter(i.getZooKeepers(), i.getZooKeepersSessionTimeOut(),
  "");
while (wals.isEmpty() && attempts > 0) {

代码示例来源:origin: org.apache.accumulo/accumulo-test

zk = new ZooReaderWriter(i.getZooKeepers(), i.getZooKeepersSessionTimeOut(), "");

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com