Examples of Mutator


Examples of org.apache.accumulo.fate.zookeeper.IZooReaderWriter.Mutator

    String tableId = null;
    try {
      IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
      final String ntp = ZooUtil.getRoot(instance) + Constants.ZTABLES;
      byte[] nid = zoo.mutate(ntp, ZERO_BYTE, ZooUtil.PUBLIC, new Mutator() {
        @Override
        public byte[] mutate(byte[] currentValue) throws Exception {
          BigInteger nextId = new BigInteger(new String(currentValue, Constants.UTF8), Character.MAX_RADIX);
          nextId = nextId.add(BigInteger.ONE);
          return nextId.toString(Character.MAX_RADIX).getBytes(Constants.UTF8);
View Full Code Here

Examples of org.apache.accumulo.fate.zookeeper.IZooReaderWriter.Mutator

      final String newName = qualifiedNewTableName.getSecond();
      final String oldName = qualifiedOldTableName.getSecond();

      final String tap = ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_NAME;

      zoo.mutate(tap, null, null, new Mutator() {
        @Override
        public byte[] mutate(byte[] current) throws Exception {
          final String currentName = new String(current, Constants.UTF8);
          if (currentName.equals(newName))
            return null; // assume in this case the operation is running again, so we are done
View Full Code Here

Examples of org.apache.accumulo.fate.zookeeper.IZooReaderWriter.Mutator

   
    String cvs = new String(currentValue, Constants.UTF8);
    String[] tokens = cvs.split(",");
    final long flushID = Long.parseLong(tokens[0]);
   
    zoo.mutate(zCancelID, null, null, new Mutator() {
      @Override
      public byte[] mutate(byte[] currentValue) throws Exception {
        long cid = Long.parseLong(new String(currentValue, Constants.UTF8));
       
        if (cid < flushID)
View Full Code Here

Examples of org.apache.accumulo.fate.zookeeper.ZooReaderWriter.Mutator

 
  public synchronized void transitionTableState(final String tableId, final TableState newState) {
    String statePath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_STATE;
   
    try {
      ZooReaderWriter.getRetryingInstance().mutate(statePath, (byte[]) newState.name().getBytes(Constants.UTF8), ZooUtil.PUBLIC, new Mutator() {
        @Override
        public byte[] mutate(byte[] oldData) throws Exception {
          TableState oldState = TableState.UNKNOWN;
          if (oldData != null)
            oldState = TableState.valueOf(new String(oldData, Constants.UTF8));
View Full Code Here

Examples of org.apache.accumulo.fate.zookeeper.ZooReaderWriter.Mutator

   
    String cvs = new String(currentValue, Constants.UTF8);
    String[] tokens = cvs.split(",");
    final long flushID = Long.parseLong(tokens[0]);
   
    zoo.mutate(zCancelID, null, null, new Mutator() {
      @Override
      public byte[] mutate(byte[] currentValue) throws Exception {
        long cid = Long.parseLong(new String(currentValue, Constants.UTF8));
       
        if (cid < flushID)
View Full Code Here

Examples of org.apache.accumulo.fate.zookeeper.ZooReaderWriter.Mutator

   
    String tableId = null;
    try {
      IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
      final String ntp = ZooUtil.getRoot(instance) + Constants.ZTABLES;
      byte[] nid = zoo.mutate(ntp, ZERO_BYTE, ZooUtil.PUBLIC, new Mutator() {
        @Override
        public byte[] mutate(byte[] currentValue) throws Exception {
          BigInteger nextId = new BigInteger(new String(currentValue, Constants.UTF8), Character.MAX_RADIX);
          nextId = nextId.add(BigInteger.ONE);
          return nextId.toString(Character.MAX_RADIX).getBytes(Constants.UTF8);
View Full Code Here

Examples of org.apache.accumulo.fate.zookeeper.ZooReaderWriter.Mutator

    String zTablePath = Constants.ZROOT + "/" + HdfsZooInstance.getInstance().getInstanceID() + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_COMPACT_ID;
   
    IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
    byte[] cid;
    try {
      cid = zoo.mutate(zTablePath, null, null, new Mutator() {
        @Override
        public byte[] mutate(byte[] currentValue) throws Exception {
          String cvs = new String(currentValue, Constants.UTF8);
          String[] tokens = cvs.split(",");
          long flushID = Long.parseLong(tokens[0]);
View Full Code Here

Examples of org.apache.accumulo.fate.zookeeper.ZooReaderWriter.Mutator

  static void removeIterators(final long txid, String tableId) throws Exception {
    String zTablePath = Constants.ZROOT + "/" + HdfsZooInstance.getInstance().getInstanceID() + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_COMPACT_ID;
   
    IZooReaderWriter zoo = ZooReaderWriter.getRetryingInstance();
   
    zoo.mutate(zTablePath, null, null, new Mutator() {
      @Override
      public byte[] mutate(byte[] currentValue) throws Exception {
        String cvs = new String(currentValue, Constants.UTF8);
        String[] tokens = cvs.split(",");
        long flushID = Long.parseLong(tokens[0]);
View Full Code Here

Examples of org.apache.accumulo.fate.zookeeper.ZooReaderWriter.Mutator

    try {
      Utils.checkTableDoesNotExist(instance, newTableName, tableId, TableOperation.RENAME);
     
      final String tap = ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_NAME;
     
      zoo.mutate(tap, null, null, new Mutator() {
        public byte[] mutate(byte[] current) throws Exception {
          final String currentName = new String(current, Constants.UTF8);
          if (currentName.equals(newTableName))
            return null; // assume in this case the operation is running again, so we are done
          if (!currentName.equals(oldTableName)) {
View Full Code Here

Examples of org.apache.accumulo.fate.zookeeper.ZooReaderWriter.Mutator

          + Constants.ZTABLE_FLUSH_ID;
     
      IZooReaderWriter zoo = ZooReaderWriter.getInstance();
      byte fid[];
      try {
        fid = zoo.mutate(zTablePath, null, null, new Mutator() {
          @Override
          public byte[] mutate(byte[] currentValue) throws Exception {
            long flushID = Long.parseLong(new String(currentValue, Constants.UTF8));
            flushID++;
            return Long.toString(flushID).getBytes(Constants.UTF8);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.