Examples of checkAndPut()


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

    Assert.assertEquals(1, idxtableCount);

    // Test check and put
    Put p1 = new Put("row1".getBytes());
    p1.add("col".getBytes(), "q1".getBytes(), "myNewValue".getBytes());
    Assert.assertTrue(table.checkAndPut("row1".getBytes(), "col".getBytes(), "q1".getBytes(),
      "myValue".getBytes(), p1));
    new Thread() {
      public void run() {
        Put p = new Put("row1".getBytes());
        p.add("col".getBytes(), "q1".getBytes(), "myValue1".getBytes());
View Full Code Here

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

      @Override
      public Object run() throws Exception {
        HTable indexTable2 = new HTable(conf, "testCheckAndPut_idx");
        Put put = new Put(Bytes.toBytes("row" + 0));
        put.add(Constants.IDX_COL_FAMILY, Constants.IDX_COL_QUAL, Bytes.toBytes("latest"));
        indexTable2.checkAndPut(Bytes.toBytes("row" + 0), Constants.IDX_COL_FAMILY,
          Constants.IDX_COL_QUAL, Bytes.toBytes("old_val"), put);
        return null;
      }
    };
View Full Code Here

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

      @Override
      public Object run() throws Exception {
        HTable table2 = new HTable(conf, "testCheckAndPut");
        Put put = new Put(Bytes.toBytes("row" + 0));
        put.add(Bytes.toBytes("cf"), Bytes.toBytes("q"), Bytes.toBytes("latest"));
        table2.checkAndPut(Bytes.toBytes("row" + 0), Bytes.toBytes("cf"), Bytes.toBytes("q"),
          Bytes.toBytes("Test_val"), put);
        return null;
      }
    };
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HTable.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.HTable.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.HTable.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.HTable.checkAndPut()

      HTable table = null;
      try {
        table = getTable(tableName);
        byte[][] famAndQf = KeyValue.parseColumn(getBytes(column));
        return table.checkAndPut(getBytes(row), famAndQf[0], famAndQf[1],
          value != null ? getBytes(value) : HConstants.EMPTY_BYTE_ARRAY, put);
      } catch (IOException e) {
        LOG.warn(e.getMessage(), e);
        throw new IOError(e.getMessage());
      } catch (IllegalArgumentException e) {
View Full Code Here

Examples of org.apache.hadoop.hbase.client.HTable.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.HTable.checkAndPut()

      public Object run() throws Exception {
        Put p = new Put(TEST_ROW);
        p.add(TEST_FAMILY, TEST_QUALIFIER, Bytes.toBytes(1));
        HTable 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.HTableInterface.checkAndPut()

       hTable.put(put);

       Put newPut = new Put(row);
       byte[] randBytes = randomRowKey();
       newPut.add(cf, randBytes, randBytes);
       hTable.checkAndPut(row, cf, row, row, newPut);

       Result result = hTable.get(new Get(row));
       Assert.assertEquals(2, result.list().size());
      
       assertMetricsUpdated(OpType.PUT, OpType.CHECK_AND_PUT, OpType.GET);
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.