gpt4 book ai didi

org.apache.accumulo.server.master.state.ZooTabletStateStore.iterator()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 15:51:31 27 4
gpt4 key购买 nike

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

ZooTabletStateStore.iterator介绍

暂无

代码示例

代码示例来源:origin: apache/accumulo

@Override
public void setFutureLocations(Collection<Assignment> assignments)
  throws DistributedStoreException {
 if (assignments.size() != 1)
  throw new IllegalArgumentException("There is only one root tablet");
 Assignment assignment = assignments.iterator().next();
 if (assignment.tablet.compareTo(RootTable.EXTENT) != 0)
  throw new IllegalArgumentException("You can only store the root tablet location");
 String value = assignment.server.getLocation() + "|" + assignment.server.getSession();
 Iterator<TabletLocationState> currentIter = iterator();
 TabletLocationState current = currentIter.next();
 if (current.current != null) {
  throw new DistributedStoreException(
    "Trying to set the root tablet location: it is already set to " + current.current);
 }
 store.put(RootTable.ZROOT_TABLET_FUTURE_LOCATION, value.getBytes(UTF_8));
}

代码示例来源:origin: apache/accumulo

@Override
public void setLocations(Collection<Assignment> assignments) throws DistributedStoreException {
 if (assignments.size() != 1)
  throw new IllegalArgumentException("There is only one root tablet");
 Assignment assignment = assignments.iterator().next();
 if (assignment.tablet.compareTo(RootTable.EXTENT) != 0)
  throw new IllegalArgumentException("You can only store the root tablet location");
 String value = assignment.server.getLocation() + "|" + assignment.server.getSession();
 Iterator<TabletLocationState> currentIter = iterator();
 TabletLocationState current = currentIter.next();
 if (current.current != null) {
  throw new DistributedStoreException(
    "Trying to set the root tablet location: it is already set to " + current.current);
 }
 if (!current.future.equals(assignment.server)) {
  throw new DistributedStoreException("Root tablet is already assigned to " + current.future);
 }
 store.put(RootTable.ZROOT_TABLET_LOCATION, value.getBytes(UTF_8));
 store.put(RootTable.ZROOT_TABLET_LAST_LOCATION, value.getBytes(UTF_8));
 // Make the following unnecessary by making the entire update atomic
 store.remove(RootTable.ZROOT_TABLET_FUTURE_LOCATION);
 log.debug("Put down root tablet location");
}

代码示例来源:origin: apache/accumulo

private static Pair<Text,KeyExtent> verifyRootTablet(ServerContext context,
  TServerInstance instance) throws AccumuloException {
 ZooTabletStateStore store = new ZooTabletStateStore(context);
 if (!store.iterator().hasNext()) {
  throw new AccumuloException("Illegal state: location is not set in zookeeper");
 }
 TabletLocationState next = store.iterator().next();
 if (!instance.equals(next.future)) {
  throw new AccumuloException("Future location is not to this server for the root tablet");
 }
 if (next.current != null) {
  throw new AccumuloException("Root tablet already has a location set");
 }
 try {
  return new Pair<>(new Text(MetadataTableUtil.getRootTabletDir(context)), null);
 } catch (IOException e) {
  throw new AccumuloException(e);
 }
}

代码示例来源:origin: apache/accumulo

scanning.set(true);
Iterator<TabletLocationState> zooScanner = new ZooTabletStateStore(context).iterator();

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

private static Pair<Text,KeyExtent> verifyRootTablet(KeyExtent extent, TServerInstance instance) throws DistributedStoreException, AccumuloException {
 ZooTabletStateStore store = new ZooTabletStateStore();
 if (!store.iterator().hasNext()) {
  throw new AccumuloException("Illegal state: location is not set in zookeeper");
 }
 TabletLocationState next = store.iterator().next();
 if (!instance.equals(next.future)) {
  throw new AccumuloException("Future location is not to this server for the root tablet");
 }
 if (next.current != null) {
  throw new AccumuloException("Root tablet already has a location set");
 }
 return new Pair<Text,KeyExtent>(new Text(Constants.ZROOT_TABLET), null);
}

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

@Override
public void setFutureLocations(Collection<Assignment> assignments) throws DistributedStoreException {
 if (assignments.size() != 1)
  throw new IllegalArgumentException("There is only one root tablet");
 Assignment assignment = assignments.iterator().next();
 if (assignment.tablet.compareTo(Constants.ROOT_TABLET_EXTENT) != 0)
  throw new IllegalArgumentException("You can only store the root tablet location");
 String value = AddressUtil.toString(assignment.server.getLocation()) + "|" + assignment.server.getSession();
 Iterator<TabletLocationState> currentIter = iterator();
 TabletLocationState current = currentIter.next();
 if (current.current != null) {
  throw new IllegalDSException("Trying to set the root tablet location: it is already set to " + current.current);
 }
 store.put(Constants.ZROOT_TABLET_FUTURE_LOCATION, value.getBytes(UTF_8));
}

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

@Override
public void setFutureLocations(Collection<Assignment> assignments)
  throws DistributedStoreException {
 if (assignments.size() != 1)
  throw new IllegalArgumentException("There is only one root tablet");
 Assignment assignment = assignments.iterator().next();
 if (assignment.tablet.compareTo(RootTable.EXTENT) != 0)
  throw new IllegalArgumentException("You can only store the root tablet location");
 String value = assignment.server.getLocation() + "|" + assignment.server.getSession();
 Iterator<TabletLocationState> currentIter = iterator();
 TabletLocationState current = currentIter.next();
 if (current.current != null) {
  throw new DistributedStoreException(
    "Trying to set the root tablet location: it is already set to " + current.current);
 }
 store.put(RootTable.ZROOT_TABLET_FUTURE_LOCATION, value.getBytes(UTF_8));
}

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

@Override
public void setLocations(Collection<Assignment> assignments) throws DistributedStoreException {
 if (assignments.size() != 1)
  throw new IllegalArgumentException("There is only one root tablet");
 Assignment assignment = assignments.iterator().next();
 if (assignment.tablet.compareTo(RootTable.EXTENT) != 0)
  throw new IllegalArgumentException("You can only store the root tablet location");
 String value = assignment.server.getLocation() + "|" + assignment.server.getSession();
 Iterator<TabletLocationState> currentIter = iterator();
 TabletLocationState current = currentIter.next();
 if (current.current != null) {
  throw new DistributedStoreException(
    "Trying to set the root tablet location: it is already set to " + current.current);
 }
 if (!current.future.equals(assignment.server)) {
  throw new DistributedStoreException("Root tablet is already assigned to " + current.future);
 }
 store.put(RootTable.ZROOT_TABLET_LOCATION, value.getBytes(UTF_8));
 store.put(RootTable.ZROOT_TABLET_LAST_LOCATION, value.getBytes(UTF_8));
 // Make the following unnecessary by making the entire update atomic
 store.remove(RootTable.ZROOT_TABLET_FUTURE_LOCATION);
 log.debug("Put down root tablet location");
}

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

@Override
public void setLocations(Collection<Assignment> assignments) throws DistributedStoreException {
 if (assignments.size() != 1)
  throw new IllegalArgumentException("There is only one root tablet");
 Assignment assignment = assignments.iterator().next();
 if (assignment.tablet.compareTo(Constants.ROOT_TABLET_EXTENT) != 0)
  throw new IllegalArgumentException("You can only store the root tablet location");
 String value = AddressUtil.toString(assignment.server.getLocation()) + "|" + assignment.server.getSession();
 Iterator<TabletLocationState> currentIter = iterator();
 TabletLocationState current = currentIter.next();
 if (current.current != null) {
  throw new IllegalDSException("Trying to set the root tablet location: it is already set to " + current.current);
 }
 if (!current.future.equals(assignment.server)) {
  throw new IllegalDSException("Root tablet is already assigned to " + current.future);
 }
 store.put(Constants.ZROOT_TABLET_LOCATION, value.getBytes(UTF_8));
 store.put(Constants.ZROOT_TABLET_LAST_LOCATION, value.getBytes(UTF_8));
 // Make the following unnecessary by making the entire update atomic
 store.remove(Constants.ZROOT_TABLET_FUTURE_LOCATION);
 log.debug("Put down root tablet location");
}

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

private static Pair<Text,KeyExtent> verifyRootTablet(KeyExtent extent, TServerInstance instance)
  throws DistributedStoreException, AccumuloException {
 ZooTabletStateStore store = new ZooTabletStateStore();
 if (!store.iterator().hasNext()) {
  throw new AccumuloException("Illegal state: location is not set in zookeeper");
 }
 TabletLocationState next = store.iterator().next();
 if (!instance.equals(next.future)) {
  throw new AccumuloException("Future location is not to this server for the root tablet");
 }
 if (next.current != null) {
  throw new AccumuloException("Root tablet already has a location set");
 }
 try {
  return new Pair<>(new Text(MetadataTableUtil.getRootTabletDir()), null);
 } catch (IOException e) {
  throw new AccumuloException(e);
 }
}

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

zooScanner = new ZooTabletStateStore().iterator();
} catch (DistributedStoreException e) {
 throw new AccumuloException(e);

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