Package org.apache.hadoop.hbase.client

Examples of org.apache.hadoop.hbase.client.Put


    //Setting up region
    String method = "testIdxRegionCompaction_" + majorcompaction;
    initIdxRegion(tableName, method, new HBaseConfiguration(), Pair.of(family,
      new IdxIndexDescriptor[]{indexDescriptor}));
    for (long i = 0; i < numRows; i++) {
      Put put = new Put(Bytes.toBytes(String.format("%08d", i)));
      put.add(family, qualLong, Bytes.toBytes(i));
      region.put(put);
      if (i != 0 && i % flushInterval == 0) {
        region.flushcache();
      }
    }
View Full Code Here


    int expectedCount = 0;
    List<KeyValue> res = new ArrayList<KeyValue>();

    boolean toggle = true;
    for (long i = 0; i < numRows; i++) {
      Put put = new Put(Bytes.toBytes(i));
      put.add(family, qualLong, Bytes.toBytes(i % 10));
      region.put(put);

      if (i != 0 && i % compactInterval == 0) {
        //System.out.println("iteration = " + i);
        region.compactStores(true);
View Full Code Here

  throws IOException {
    for (int i = 0; i < numRows; i++) {
      String row = key + "_" + i/* UUID.randomUUID().toString() */;
      System.out.println(String.format("Saving row: %s, with value %s", row,
        value));
      Put put = new Put(Bytes.toBytes(row));
      put.add(Bytes.toBytes("trans-blob"), null,
        Bytes.toBytes("value for blob"));
      put.add(Bytes.toBytes("trans-type"), null, Bytes.toBytes("statement"));
      put.add(Bytes.toBytes("trans-date"), null,
        Bytes.toBytes("20090921010101999"));
      put.add(Bytes.toBytes("trans-tags"), Bytes.toBytes("qual2"),
        Bytes.toBytes(value));
      put.add(Bytes.toBytes("trans-group"), null,
        Bytes.toBytes("adhocTransactionGroupId"));
      r.put(put);
    }
  }
View Full Code Here

  public void testFamilyWithAndWithoutColon() throws Exception {
    byte [] b = Bytes.toBytes(getName());
    byte [] cf = Bytes.toBytes("cf");
    initHRegion(b, getName(), cf);
    Put p = new Put(b);
    byte [] cfwithcolon = Bytes.toBytes("cf:");
    p.add(cfwithcolon, cfwithcolon, cfwithcolon);
    boolean exception = false;
    try {
      this.region.put(p);
    } catch (NoSuchColumnFamilyException e) {
      exception = true;
    }
    assertTrue(exception);
    // Can I add it using old style call?
    p = new Put(b);
    p.add(cfwithcolon, System.currentTimeMillis(), cfwithcolon);
    this.region.put(p);
  }
View Full Code Here

   
    //Setting up region
    String method = this.getName();
    initHRegion(tableName, method, fam1);
    //Putting data in key
    Put put = new Put(row1);
    put.add(fam1, qf1, val1);

    //checkAndPut with correct value
    boolean res = region.checkAndPut(row1, fam1, qf1, emptyVal, put, lockId,
        true);
    assertTrue(res);

    // not empty anymore
    res = region.checkAndPut(row1, fam1, qf1, emptyVal, put, lockId, true);
    assertFalse(res);

    put = new Put(row1);
    put.add(fam1, qf1, val2);
    //checkAndPut with correct value
    res = region.checkAndPut(row1, fam1, qf1, val1, put, lockId, true);
    assertTrue(res);
  }
View Full Code Here

    //Setting up region
    String method = this.getName();
    initHRegion(tableName, method, fam1);

    //Putting data in key
    Put put = new Put(row1);
    put.add(fam1, qf1, val1);
    region.put(put);
   
    //checkAndPut with wrong value
    boolean res = region.checkAndPut(row1, fam1, qf1, val2, put, lockId, true);
    assertEquals(false, res);
View Full Code Here

    //Setting up region
    String method = this.getName();
    initHRegion(tableName, method, fam1);

    //Putting data in key
    Put put = new Put(row1);
    put.add(fam1, qf1, val1);
    region.put(put);
   
    //checkAndPut with correct value
    boolean res = region.checkAndPut(row1, fam1, qf1, val1, put, lockId, true);
    assertEquals(true, res);
View Full Code Here

    //Setting up region
    String method = this.getName();
    initHRegion(tableName, method, families);

    //Putting data in the key to check
    Put put = new Put(row1);
    put.add(fam1, qf1, val1);
    region.put(put);
   
    //Creating put to add
    long ts = System.currentTimeMillis();
    KeyValue kv = new KeyValue(row1, fam2, qf1, ts, KeyValue.Type.Put, val2);
    put = new Put(row1);
    put.add(kv);
   
    //checkAndPut with wrong value
    Store store = region.getStore(fam1);
    store.memstore.kvset.size();
   
View Full Code Here

    byte [] serverinfo = Bytes.toBytes("serverinfo");
    byte [] splitA = Bytes.toBytes("splitA");
    byte [] splitB = Bytes.toBytes("splitB");

    // add some data:
    Put put = new Put(row);
    put.add(fam, splitA, Bytes.toBytes("reference_A"));
    region.put(put);

    put = new Put(row);
    put.add(fam, splitB, Bytes.toBytes("reference_B"));
    region.put(put);

    put = new Put(row);
    put.add(fam, serverinfo, Bytes.toBytes("ip_address"));
    region.put(put);

    // ok now delete a split:
    Delete delete = new Delete(row);
    delete.deleteColumns(fam, splitA);
View Full Code Here

    byte [] row = Bytes.toBytes("table_name");
    // column names
    byte [] serverinfo = Bytes.toBytes("serverinfo");

    // add data in the far future
    Put put = new Put(row);
    put.add(fam, serverinfo, HConstants.LATEST_TIMESTAMP-5,Bytes.toBytes("value"));
    region.put(put);

    // now delete something in the present
    Delete delete = new Delete(row);
    region.delete(delete, null, true);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.client.Put

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.