Package org.apache.hadoop.hbase.client

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


    for(int i = 0; i < 100; i++) {
      byte [] row = rows[i];
      String value = row.toString();
      BatchUpdate b = new BatchUpdate(row);
      b.put(CONTENTS, value.getBytes(HConstants.UTF8_ENCODING));
      table.commit(b);
    }
   
    // Get HRegionInfo for our table
    Map<HRegionInfo, HServerAddress> regions = table.getRegionsInfo();
    assertEquals(1, regions.size());
View Full Code Here


    // Add new regions to META
    for (int i = 0; i < newRegions.length; i++) {
      update = new BatchUpdate(newRegions[i].getRegionName());
      update.put(COL_REGIONINFO, Writables.getBytes(
        newRegions[i].getRegionInfo()));
      t.commit(update);
    }
       
    // Now tell the master about the new regions
    server.reportSplit(oldRegionInfo, newRegions[0].getRegionInfo(),
      newRegions[1].getRegionInfo());
View Full Code Here

    for (int i = 1; i <= 256; i++) {    // 256 writes should cause 8 log rolls
      BatchUpdate b =
        new BatchUpdate("row" + String.format("%1$04d", i));
      b.put(HConstants.COLUMN_FAMILY, value);
      table.commit(b);

      if (i % 32 == 0) {
        // After every 32 writes sleep to let the log roller run

        try {
View Full Code Here

    BatchUpdate b = new BatchUpdate(row);
    info.setOffline(onlineOffline);
    b.put(HConstants.COL_REGIONINFO, Writables.getBytes(info));
    b.delete(HConstants.COL_SERVER);
    b.delete(HConstants.COL_STARTCODE);
    t.commit(b);
  }
 
  /**
   * Offline version of the online TableOperation,
   * org.apache.hadoop.hbase.master.AddColumn.
 
View Full Code Here

    BatchUpdate b = new BatchUpdate(row);
    info.setOffline(onlineOffline);
    b.put(HConstants.COL_REGIONINFO, Writables.getBytes(info));
    b.delete(HConstants.COL_SERVER);
    b.delete(HConstants.COL_STARTCODE);
    t.commit(b);
  }
 
  /**
   * Offline version of the online TableOperation,
   * org.apache.hadoop.hbase.master.AddColumn.
 
View Full Code Here

    for (Map.Entry<byte [], SortedMap<byte [], Cell>> row: values.entrySet()) {
      BatchUpdate b = new BatchUpdate(row.getKey());
      for (Map.Entry<byte [], Cell> val: row.getValue().entrySet()) {
        b.put(val.getKey(), val.getValue().getValue());
      }
      table.commit(b);
    }

    HRegion region = null;
    try {
      Collection<HRegion> regions =
View Full Code Here

            batchUpdate.delete(getText(m.column));
          } else {
            batchUpdate.put(getText(m.column), m.value);
          }
        }
        table.commit(batchUpdate);
      } catch (IOException e) {
        throw new IOError(e.getMessage());
      } catch (IllegalArgumentException e) {
        throw new IllegalArgument(e.getMessage());
      }
View Full Code Here

      }

      HTable table = null;
      try {
        table = getTable(tableName);
        table.commit(batchUpdates);
      } catch (IOException e) {
        throw new IOError(e.getMessage());
      } catch (IllegalArgumentException e) {
        throw new IllegalArgument(e.getMessage());
      }
View Full Code Here

      byte [] regionName = HRegionInfo.createRegionName(tableName,
        Bytes.toBytes(i == 0? "": Integer.toString(i)),
        Long.toString(System.currentTimeMillis()));
      BatchUpdate b = new BatchUpdate(regionName);
      b.put(HConstants.COL_SERVER, Bytes.toBytes("localhost:1234"));
      t.commit(b);
    }
    long sleepTime =
      conf.getLong("hbase.master.meta.thread.rescanfrequency", 10000);
    int tries = conf.getInt("hbase.client.retries.number", 5);
    int count = 0;
View Full Code Here

    for (int i = 0; i < NUM_ROWS; i++) {
      BatchUpdate b = new BatchUpdate("row_" + String.format("%1$05d", i));

      b.put(TEXT_COLUMN1, VALUE);
      b.put(TEXT_COLUMN2, String.format("%1$05d", i).getBytes());
      table.commit(b);
    }

    // LOG.info("Print table contents using scanner before map/reduce for " + TABLE_NAME);
    // scanTable(TABLE_NAME, false);
    // LOG.info("Print table contents using scanner+filter before map/reduce for " + 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.