Package org.hbase.async

Examples of org.hbase.async.PutRequest


    }
    if (name == null || name.isEmpty()) {
      throw new IllegalArgumentException("Missing name");
    }

    final PutRequest put = new PutRequest(tsdb.uidTable(),
        UniqueId.stringToUid(uid), FAMILY,
        (type.toString().toLowerCase() + "_meta").getBytes(CHARSET),
        UIDMeta.this.getStorageJSON());
    return tsdb.getClient().put(put);
  }
View Full Code Here


    // Update the reverse mapping first, so that if we die before updating
    // the forward mapping we don't run the risk of "publishing" a
    // partially assigned ID.  The reverse mapping on its own is harmless
    // but the forward mapping without reverse mapping is bad.
    try {
      final PutRequest reverse_mapping = new PutRequest(
        table, row, NAME_FAMILY, kind, newnameb);
      hbasePutWithRetry(reverse_mapping, MAX_ATTEMPTS_PUT,
                        INITIAL_EXP_BACKOFF_DELAY);
    } catch (HBaseException e) {
      LOG.error("When trying rename(\"" + oldname
        + "\", \"" + newname + "\") on " + this + ": Failed to update reverse"
        + " mapping for ID=" + Arrays.toString(row), e);
      throw e;
    }

    // Now create the new forward mapping.
    try {
      final PutRequest forward_mapping = new PutRequest(
        table, newnameb, ID_FAMILY, kind, row);
      hbasePutWithRetry(forward_mapping, MAX_ATTEMPTS_PUT,
                        INITIAL_EXP_BACKOFF_DELAY);
    } catch (HBaseException e) {
      LOG.error("When trying rename(\"" + oldname
View Full Code Here

      // a CAS instead to create the KV.
      return client.compareAndSet(reverseMapping(), HBaseClient.EMPTY_ARRAY);
    }

    private PutRequest reverseMapping() {
      return new PutRequest(table, row, NAME_FAMILY, kind, toBytes(name));
    }
View Full Code Here

      state = DONE;
      return client.compareAndSet(forwardMapping(), HBaseClient.EMPTY_ARRAY);
    }

    private PutRequest forwardMapping() {
        return new PutRequest(table, toBytes(name), ID_FAMILY, kind, row);
    }
View Full Code Here

          // verify the name is set locally just to be safe
          if (name == null || name.isEmpty()) {
            local_meta.name = name;
          }
         
          final PutRequest put = new PutRequest(tsdb.uidTable(),
              UniqueId.stringToUid(uid), FAMILY,
              (type.toString().toLowerCase() + "_meta").getBytes(CHARSET),
              local_meta.getStorageJSON());
          return tsdb.getClient().compareAndSet(put, original_meta);
        }
View Full Code Here

                  errors++;
                  correctable++;
                  if (fix) {
                    value = value.clone()// We're going to change it.
                    value[0] = value[1] = value[2] = value[3] = 0;
                    client.put(new PutRequest(table, kv.key(), kv.family(),
                                              qual, value));
                  } else {
                    LOG.error("Floating point value with 0xFF most significant"
                              + " bytes, probably caused by sign extension bug"
                              + " present in revisions [96908436..607256fc].\n"
View Full Code Here

      }
     
    }
   
    // execute the CAS call to start the callback chain
    final PutRequest put = new PutRequest(tsdb.treeTable(), branch_id,
        Tree.TREE_FAMILY(), columnQualifier(), toStorageJson());
    return tsdb.getClient().compareAndSet(put, new byte[0])
      .addCallbackDeferring(new LeafStoreCB(this));
  }
View Full Code Here

      base_time = (timestamp - (timestamp % Const.MAX_TIMESPAN));
    }
   
    Bytes.setInt(row, (int) base_time, metrics.width());
    scheduleForCompaction(row, (int) base_time);
    final PutRequest point = new PutRequest(table, row, FAMILY, qualifier, value);
   
    // TODO(tsuna): Add a callback to time the latency of HBase and store the
    // timing in a moving Histogram (once we have a class for this).
    Deferred<Object> result = client.put(point);
    if (!config.enable_realtime_ts() && !config.enable_tsuid_incrementing() &&
        !config.enable_tsuid_tracking() && rt_publisher == null) {
      return result;
    }
   
    final byte[] tsuid = UniqueId.getTSUIDFromKey(row, METRICS_WIDTH,
        Const.TIMESTAMP_BYTES);
   
    // for busy TSDs we may only enable TSUID tracking, storing a 1 in the
    // counter field for a TSUID with the proper timestamp. If the user would
    // rather have TSUID incrementing enabled, that will trump the PUT
    if (config.enable_tsuid_tracking() && !config.enable_tsuid_incrementing()) {
      final PutRequest tracking = new PutRequest(meta_table, tsuid,
          TSMeta.FAMILY(), TSMeta.COUNTER_QUALIFIER(), Bytes.fromLong(1));
      client.put(tracking);
    } else if (config.enable_tsuid_incrementing() || config.enable_realtime_ts()) {
      TSMeta.incrementAndGetCounter(TSDB.this, tsuid);
    }
View Full Code Here

  /** Puts the given value into the data table. */
  final Deferred<Object> put(final byte[] key,
                             final byte[] qualifier,
                             final byte[] value) {
    return client.put(new PutRequest(table, key, FAMILY, qualifier, value));
  }
View Full Code Here

        }
       
        // reset the change map so we don't keep writing
        initializeChangedMap();
       
        final PutRequest put = new PutRequest(tsdb.treeTable(),
            Tree.idToBytes(tree_id), TREE_FAMILY, TREE_QUALIFIER,
            stored_tree.toStorageJson());
        return tsdb.getClient().compareAndSet(put, original_tree);
      }
    }
View Full Code Here

TOP

Related Classes of org.hbase.async.PutRequest

Copyright © 2018 www.massapicom. 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.