Examples of Put


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

        break;
      }
      HRegionInfo hri = Writables.getHRegionInfo(b);
      // If start key, add 'aaa'.
      byte [] row = getStartKey(hri);
      Put p = new Put(row);
      p.setWriteToWAL(false);
      p.add(getTestFamily(), getTestQualifier(), row);
      t.put(p);
      rows++;
    }
    s.close();
    Assert.assertEquals(expected, rows);
View Full Code Here

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

        ServerName sn = rs.getRegionServer().getServerName();

        // When we find a diff RS, change the assignment and break
        if (startCode != sn.getStartcode()) {
          Put put = new Put(res.getRow());
          put.setWriteToWAL(false);
          put.add(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER,
            Bytes.toBytes(sn.getHostAndPort()));
          put.add(HConstants.CATALOG_FAMILY, HConstants.STARTCODE_QUALIFIER,
            Bytes.toBytes(sn.getStartcode()));
          meta.put(put);
          break resforloop;
        }
      }
View Full Code Here

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

  private HRegionInfo createRegion(Configuration conf, final HTableDescriptor
      htd, byte[] startKey, byte[] endKey)
      throws IOException {
    HTable meta = new HTable(conf, HConstants.META_TABLE_NAME);
    HRegionInfo hri = new HRegionInfo(htd.getName(), startKey, endKey);
    Put put = new Put(hri.getRegionName());
    put.add(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER,
        Writables.getBytes(hri));
    meta.put(put);
    return hri;
  }
View Full Code Here

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

    TEST_UTIL.getHBaseAdmin().createTable(desc, SPLITS);
    tbl = new HTable(TEST_UTIL.getConfiguration(), tablename);

    List<Put> puts = new ArrayList<Put>();
    for (byte[] row : ROWKEYS) {
      Put p = new Put(row);
      p.add(FAM, Bytes.toBytes("val"), row);
      puts.add(p);
    }
    tbl.put(puts);
    tbl.flushCommits();
    long endTime = System.currentTimeMillis() + 60000;
View Full Code Here

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

    throw new IOException("checkAndPut request timed out");
  }

  public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier,
      byte[] value, Delete delete) throws IOException {
    Put put = new Put(row);
    // column to check-the-value
    put.add(new KeyValue(row, family, qualifier, value));
    CellSetModel model = buildModelFromPut(put);
    StringBuilder sb = new StringBuilder();
    sb.append('/');
    if (accessToken != null) {
      sb.append(accessToken);
View Full Code Here

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

  throws IOException {
    Map<byte[], List<KeyValue>> familyMap;
    familyMap = new HashMap<byte[], List<KeyValue>>();

    familyMap.put(family, edits);
    Put p = new Put();
    p.setFamilyMap(familyMap);
    p.setClusterId(HConstants.DEFAULT_CLUSTER_ID);
    p.setWriteToWAL(true);
    this.internalPut(p, HConstants.DEFAULT_CLUSTER_ID, true);
  }
View Full Code Here

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

      // invocation of this method per table.
      Map<byte[], List<Row>> rows = new TreeMap<byte[], List<Row>>(Bytes.BYTES_COMPARATOR);
      for (HLog.Entry entry : entries) {
        WALEdit edit = entry.getEdit();
        byte[] table = entry.getKey().getTablename();
        Put put = null;
        Delete del = null;
        KeyValue lastKV = null;
        List<KeyValue> kvs = edit.getKeyValues();
        for (KeyValue kv : kvs) {
          if (lastKV == null || lastKV.getType() != kv.getType() || !lastKV.matchingRow(kv)) {
            if (kv.isDelete()) {
              del = new Delete(kv.getRow());
              del.setClusterId(entry.getKey().getClusterId());
              addToMultiMap(rows, table, del);
            } else {
              put = new Put(kv.getRow());
              put.setClusterId(entry.getKey().getClusterId());
              addToMultiMap(rows, table, put);
            }
          }
          if (kv.isDelete()) {
            del.addDeleteMarker(kv);
          } else {
            put.add(kv);
          }
          lastKV = kv;
        }
        totalReplicated++;
      }
View Full Code Here

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

        int num = sequence.getAndIncrement();
        if (num % 10 == 0) {
          System.out.printf("-- writing row %d\n", num);
        }
        if (num <= rows.length) {
          Put put = new Put(rows[num]);
          char[] chars = (FIXED_PART + num % 10).toCharArray();
          put.add(family, qualifier, Bytes.toBytes(chars));
          table.put(put);
        } else {
          return null;
        }
        //Thread.sleep(0L, 100000); // sleep .1 millis
View Full Code Here

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

    int numberOfRows = 10000;

    Random random = new Random(2112L);
    for (int row = 0; row < numberOfRows; row++) {
      Put put = new Put(Bytes.toBytes(random.nextLong()));
      put.add(FAMILY_1_NAME, INT_QUAL_NAME, Bytes.toBytes(row));
      final String str = String.format("%010d", row % 1000);
      put.add(FAMILY_1_NAME, BYTES_QUAL_NAME, str.getBytes());
      put.add(FAMILY_2_NAME, CHARS_QUAL_NAME, Bytes.toBytes(str.toCharArray()));
      region.put(put);
    }

    region.flushcache();
View Full Code Here

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

    initIdxRegion(tableName, method, new HBaseConfiguration(),
      Pair.of(family, new IdxIndexDescriptor[]{indexDescriptor}));

    for (long i = 1; i <= 100; i++) {
      byte[] row = Bytes.toBytes(i);
      Put put = new Put(row);
      put.add(family, qualLong, Bytes.toBytes(i));
      region.put(put);
    }

    region.flushcache();
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.