Examples of Put


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

      for (byte b2 = 'a'; b2 <= 'z'; b2++) {
        for (byte b3 = 'a'; b3 <= 'z'; b3++) {
          k[0] = b1;
          k[1] = b2;
          k[2] = b3;
          Put put = new Put(k);
          for (int i = 0; i < f.length; i++) {
            put.add(f[i], null, k);
          }
          t.put(put);
          rowCount++;
        }
      }
View Full Code Here

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

      for (byte b2 = 'a'; b2 <= 'z'; b2++) {
        for (byte b3 = 'a'; b3 <= 'z'; b3++) {
          k[0] = b1;
          k[1] = b2;
          k[2] = b3;
          Put put = new Put(k);
          put.add(f, null, k);
          if (r.getLog() == null) put.setWriteToWAL(false);
          r.put(put);
          rowCount++;
        }
      }
      if (flush) {
View Full Code Here

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

    int count = 0;
    for (int i = 0; i < startKeys.length; i++) {
      int j = (i + 1) % startKeys.length;
      HRegionInfo hri = new HRegionInfo(table.getTableName(),
        startKeys[i], startKeys[j]);
      Put put = new Put(hri.getRegionName());
      put.add(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER,
        Writables.getBytes(hri));
      meta.put(put);
      LOG.info("createMultiRegions: inserted " + hri.toString());
      newRegions.add(hri);
      count++;
View Full Code Here

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

    // add custom ones
    for (int i = 0; i < startKeys.length; i++) {
      int j = (i + 1) % startKeys.length;
      HRegionInfo hri = new HRegionInfo(htd.getName(), startKeys[i],
          startKeys[j]);
      Put put = new Put(hri.getRegionName());
      put.add(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER,
        Writables.getBytes(hri));
      meta.put(put);
      LOG.info("createMultiRegionsInMeta: inserted " + hri.toString());
      newRegions.add(hri);
    }
View Full Code Here

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

    for (int iFlush = 0; iFlush < numFlushes; ++iFlush) {
      for (int iRow = 0; iRow < numRowsPerFlush; ++iRow) {
        final byte[] row = Bytes.toBytes(String.format(keyFormat,
            actualStartKey + rand.nextInt(actualEndKey - actualStartKey)));

        Put put = new Put(row);
        Delete del = new Delete(row);
        for (int iCol = 0; iCol < numColsPerRow; ++iCol) {
          final byte[] cf = cfBytes[rand.nextInt(numCF)];
          final long ts = rand.nextInt();
          final byte[] qual = Bytes.toBytes("col" + iCol);
          if (rand.nextBoolean()) {
            final byte[] value = Bytes.toBytes("value_for_row_" + iRow +
                "_cf_" + Bytes.toStringBinary(cf) + "_col_" + iCol + "_ts_" +
                ts + "_random_" + rand.nextLong());
            put.add(cf, qual, ts, value);
          } else if (rand.nextDouble() < 0.8) {
            del.deleteColumn(cf, qual, ts);
          } else {
            del.deleteColumns(cf, qual, ts);
          }
        }

        if (!put.isEmpty()) {
          table.put(put);
        }

        if (!del.isEmpty()) {
          table.delete(del);
View Full Code Here

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

    Event e = EventBuilder.withBody(Bytes.toBytes(logMsg));
    s.initialize(e, "CF".getBytes());
    List<Row> actions = s.getActions();
    assertTrue(actions.size() == 1);
    assertTrue(actions.get(0) instanceof Put);
    Put put = (Put) actions.get(0);
   
    assertTrue(put.getFamilyMap().containsKey(s.cf));
    List<KeyValue> kvPairs = put.getFamilyMap().get(s.cf);
    assertTrue(kvPairs.size() == 1);
   
    Map<String, String> resultMap = Maps.newHashMap();
    for (KeyValue kv : kvPairs) {
      resultMap.put(new String(kv.getQualifier()), new String(kv.getValue()));
View Full Code Here

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

    s.initialize(e, "CF".getBytes());
    List<Row> actions = s.getActions();
    assertEquals(1, s.getActions().size());
    assertTrue(actions.get(0) instanceof Put);
   
    Put put = (Put) actions.get(0);
    assertTrue(put.getFamilyMap().containsKey(s.cf));
    List<KeyValue> kvPairs = put.getFamilyMap().get(s.cf);
    assertTrue(kvPairs.size() == 11);
   
    Map<String, String> resultMap = Maps.newHashMap();
    for (KeyValue kv : kvPairs) {
      resultMap.put(new String(kv.getQualifier()), new String(kv.getValue()));
View Full Code Here

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

      return Lists.newArrayList();
    }
   
    try {
      rowKey = getRowKey();
      Put put = new Put(rowKey);
     
      for (int i = 0; i < colNames.size(); i++) {
        put.add(cf, colNames.get(i), m.group(i + 1).getBytes(Charsets.UTF_8));
      }
      actions.add(put);
    }
    catch (Exception e) {
      throw new FlumeException("Could not get row key!", e);
View Full Code Here

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

      }

      assertNotNull(regionName);
      assertNotNull(serverName);
      HTable meta = new HTable(conf, HConstants.META_TABLE_NAME);
      Put put = new Put(regionName);
      put.add(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER,
        Bytes.toBytes(serverName.getHostAndPort()));
      meta.put(put);

      // fix the problem.
      HBaseFsck fsck = new HBaseFsck(conf);
View Full Code Here

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

      HRegionInfo a = new HRegionInfo(tbl.getTableName(),
        Bytes.toBytes("B"), Bytes.toBytes("BM"));
      HRegionInfo b = new HRegionInfo(tbl.getTableName(),
        Bytes.toBytes("BM"), Bytes.toBytes("C"));
      Put p = new Put(hri.getRegionName());
      hri.setOffline(true);
      hri.setSplit(true);
      p.add(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER,
        Writables.getBytes(hri));
      p.add(HConstants.CATALOG_FAMILY, HConstants.SPLITA_QUALIFIER,
        Writables.getBytes(a));
      p.add(HConstants.CATALOG_FAMILY, HConstants.SPLITB_QUALIFIER,
        Writables.getBytes(b));
      meta.put(p);
      meta.flushCommits();
      TEST_UTIL.getHBaseAdmin().flush(HConstants.META_TABLE_NAME);
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.