Java Code Examples for org.apache.hadoop.hbase.regionserver.Region#put()

The following examples show how to use org.apache.hadoop.hbase.regionserver.Region#put() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
protected void addSystemLabel(Region region, Map<String, Integer> labels,
    Map<String, List<Integer>> userAuths) throws IOException {
  if (!labels.containsKey(SYSTEM_LABEL)) {
    byte[] row = Bytes.toBytes(SYSTEM_LABEL_ORDINAL);
    Put p = new Put(row);
    p.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)
                  .setRow(row)
                  .setFamily(LABELS_TABLE_FAMILY)
                  .setQualifier(LABEL_QUALIFIER)
                  .setTimestamp(p.getTimestamp())
                  .setType(Type.Put)
                  .setValue(Bytes.toBytes(SYSTEM_LABEL))
                  .build());
    region.put(p);
    labels.put(SYSTEM_LABEL, SYSTEM_LABEL_ORDINAL);
  }
}
 
Example 2
private static void generateTestData(Region region, int numRows) throws IOException {
  // generating 1Mb values
  LoadTestKVGenerator dataGenerator = new LoadTestKVGenerator(1024 * 1024, 1024 * 1024);
  for (int i = 0; i < numRows; ++i) {
    byte[] key = Bytes.add(region.getRegionInfo().getStartKey(), Bytes.toBytes(i));
    for (int j = 0; j < 1; ++j) {
      Put put = new Put(key);
      byte[] col = Bytes.toBytes(String.valueOf(j));
      byte[] value = dataGenerator.generateRandomSizeValue(key, col);
      put.addColumn(FAMILY_NAME, col, value);
      region.put(put);
    }
  }
}
 
Example 3
Source Project: hbase   File: AbstractTestDLS.java    License: Apache License 2.0 5 votes vote down vote up
private void putData(Region region, byte[] startRow, int numRows, byte[] qf, byte[]... families)
    throws IOException {
  for (int i = 0; i < numRows; i++) {
    Put put = new Put(Bytes.add(startRow, Bytes.toBytes(i)));
    for (byte[] family : families) {
      put.addColumn(family, qf, null);
    }
    region.put(put);
  }
}
 
Example 4
Source Project: hbase   File: AbstractTestWALReplay.java    License: Apache License 2.0 5 votes vote down vote up
public static List<Put> addRegionEdits(final byte[] rowName, final byte[] family, final int count,
    EnvironmentEdge ee, final Region r, final String qualifierPrefix) throws IOException {
  List<Put> puts = new ArrayList<>();
  for (int j = 0; j < count; j++) {
    byte[] qualifier = Bytes.toBytes(qualifierPrefix + Integer.toString(j));
    Put p = new Put(rowName);
    p.addColumn(family, qualifier, ee.currentTime(), rowName);
    r.put(p);
    puts.add(p);
  }
  return puts;
}