Package org.apache.hadoop.hbase.client

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


    for (int i = 1; i <= 256; i++) {    // 256 writes should cause 8 log rolls
      BatchUpdate b =
        new BatchUpdate(new Text("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


    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

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

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

    // Wait for the flush to happen
    LOG.info("Waiting, for flushes to complete");
View Full Code Here

    // Do another round so to populate the mem cache
    for (int i = 0; i < NUM_ROWS; i++) {
      BatchUpdate b = new BatchUpdate("row_" + String.format("%1$05d", i));
      b.put(TEXT_COLUMN2, String.format("%1$05d", i).getBytes());
      table.commit(b);
    }

    LOG.info("Print table contents using scanner after map/reduce for " + TABLE_NAME);
    scanTable(TABLE_NAME, true);
    LOG.info("Print table contents using scanner+filter after map/reduce for " + TABLE_NAME);
View Full Code Here

    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

      }
      try {
        HTable table = getTable(tableName);
        BatchUpdate batchUpdate = new BatchUpdate(getText(row));
        batchUpdate.put(getText(column), value);
        table.commit(batchUpdate);
      } catch (IOException e) {
        throw new IOError(e.getMessage());
      } catch (IllegalArgumentException e) {
        throw new IllegalArgument(e.getMessage());
      }
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

    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 (Entry<byte[], Cell> entry : rowResult.entrySet()) {
        columnValues.put(entry.getKey(), entry.getValue().getValue());
      }
      if (IndexMaintenanceUtils.doesApplyToIndex(indexSpec, columnValues)) {
        BatchUpdate indexUpdate = IndexMaintenanceUtils.createIndexUpdate(indexSpec, rowResult.getRow(), columnValues);
        indexTable.commit(indexUpdate);
      }
    }
  }
}
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.