Examples of checkAndPut()


Examples of org.apache.hadoop.hbase.client.HTableInterface.checkAndPut()

      }
      put.addImmutable(valueToPutParts[0], valueToPutParts[1], valueToPutCell
        .getTimestamp(), valueToPutCell.getValue());

      table = servlet.getTable(this.tableResource.getName());
      boolean retValue = table.checkAndPut(key, valueToPutParts[0],
        valueToPutParts[1], valueToCheckCell.getValue(), put);
      if (LOG.isDebugEnabled()) {
        LOG.debug("CHECK-AND-PUT " + put.toString() + ", returns " + retValue);
      }
      table.flushCommits();
View Full Code Here

Examples of org.apache.hadoop.hbase.client.Table.checkAndPut()

  @Override
  public boolean checkAndPut(ByteBuffer table, ByteBuffer row, ByteBuffer family,
      ByteBuffer qualifier, ByteBuffer value, TPut put) throws TIOError, TException {
    Table htable = getTable(table);
    try {
      return htable.checkAndPut(byteBufferToByteArray(row), byteBufferToByteArray(family),
        byteBufferToByteArray(qualifier), (value == null) ? null : byteBufferToByteArray(value),
        putFromThrift(put));
    } catch (IOException e) {
      throw getTIOError(e);
    } finally {
View Full Code Here

Examples of org.apache.hadoop.hbase.client.Table.checkAndPut()

          new String[] {"hadPreCheckAndPut",
              "hadPreCheckAndPutAfterRowLock", "hadPostCheckAndPut"},
          tableName,
          new Boolean[] {false, false, false}
          );
      table.checkAndPut(Bytes.toBytes(0), A, A, A, p);
      verifyMethodResult(SimpleRegionObserver.class,
          new String[] {"hadPreCheckAndPut",
              "hadPreCheckAndPutAfterRowLock", "hadPostCheckAndPut"},
          tableName,
          new Boolean[] {true, true, true}
View Full Code Here

Examples of org.apache.hadoop.hbase.client.Table.checkAndPut()

          return Response.status(Response.Status.BAD_REQUEST).type(MIMETYPE_TEXT)
              .entity("Bad request: The column to put and check do not match." + CRLF).build();
        } else {
          put.addImmutable(valueToPutParts[0], valueToPutParts[1], valueToPutCell.getTimestamp(),
            valueToPutCell.getValue());
          retValue = table.checkAndPut(key, valueToPutParts[0], valueToPutParts[1],
            valueToCheckCell.getValue(), put);
        }
      } else {
        servlet.getMetrics().incrementFailedPutRequests(1);
        return Response.status(Response.Status.BAD_REQUEST)
View Full Code Here

Examples of org.apache.hadoop.hbase.client.Table.checkAndPut()

      public Object run() throws Exception {
        Put p = new Put(TEST_ROW);
        p.add(TEST_FAMILY, TEST_QUALIFIER, Bytes.toBytes(1));
        Table t = new HTable(conf, TEST_TABLE.getTableName());
        try {
          t.checkAndPut(TEST_ROW, TEST_FAMILY, TEST_QUALIFIER,
           Bytes.toBytes("test_value"), p);
        } finally {
          t.close();
        }
        return null;
View Full Code Here

Examples of org.apache.hadoop.hbase.client.Table.checkAndPut()

      table = TEST_UTIL.createTable(tableName, fam);
      byte[] row1 = Bytes.toBytes("row1");
      Put put = new Put(row1);
      put.add(fam, qual, HConstants.LATEST_TIMESTAMP, value);
      put.setCellVisibility(new CellVisibility(SECRET + " & " + CONFIDENTIAL));
      table.checkAndPut(row1, fam, qual, null, put);
      byte[] row2 = Bytes.toBytes("row2");
      put = new Put(row2);
      put.add(fam, qual, HConstants.LATEST_TIMESTAMP, value);
      put.setCellVisibility(new CellVisibility(SECRET));
      table.checkAndPut(row2, fam, qual, null, put);
View Full Code Here

Examples of org.apache.hadoop.hbase.client.Table.checkAndPut()

      table.checkAndPut(row1, fam, qual, null, put);
      byte[] row2 = Bytes.toBytes("row2");
      put = new Put(row2);
      put.add(fam, qual, HConstants.LATEST_TIMESTAMP, value);
      put.setCellVisibility(new CellVisibility(SECRET));
      table.checkAndPut(row2, fam, qual, null, put);
     
      Scan scan = new Scan();
      scan.setAuthorizations(new Authorizations(SECRET));
      ResultScanner scanner = table.getScanner(scan);
      Result result = scanner.next();
View Full Code Here

Examples of org.apache.hadoop.hbase.client.Table.checkAndPut()

          return Response.status(Response.Status.BAD_REQUEST).type(MIMETYPE_TEXT)
              .entity("Bad request: The column to put and check do not match." + CRLF).build();
        } else {
          put.addImmutable(valueToPutParts[0], valueToPutParts[1], valueToPutCell.getTimestamp(),
            valueToPutCell.getValue());
          retValue = table.checkAndPut(key, valueToPutParts[0], valueToPutParts[1],
            valueToCheckCell.getValue(), put);
        }
      } else {
        servlet.getMetrics().incrementFailedPutRequests(1);
        return Response.status(Response.Status.BAD_REQUEST)
View Full Code Here

Examples of org.apache.hadoop.hbase.client.Table.checkAndPut()

  @Override
  public boolean checkAndPut(ByteBuffer table, ByteBuffer row, ByteBuffer family,
      ByteBuffer qualifier, ByteBuffer value, TPut put) throws TIOError, TException {
    Table htable = getTable(table);
    try {
      return htable.checkAndPut(byteBufferToByteArray(row), byteBufferToByteArray(family),
        byteBufferToByteArray(qualifier), (value == null) ? null : byteBufferToByteArray(value),
        putFromThrift(put));
    } catch (IOException e) {
      throw getTIOError(e);
    } finally {
View Full Code Here

Examples of org.apache.hadoop.hbase.client.Table.checkAndPut()

          new String[] {"hadPreCheckAndPut",
              "hadPreCheckAndPutAfterRowLock", "hadPostCheckAndPut"},
          tableName,
          new Boolean[] {false, false, false}
          );
      table.checkAndPut(Bytes.toBytes(0), A, A, A, p);
      verifyMethodResult(SimpleRegionObserver.class,
          new String[] {"hadPreCheckAndPut",
              "hadPreCheckAndPutAfterRowLock", "hadPostCheckAndPut"},
          tableName,
          new Boolean[] {true, true, true}
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.