Java 类org.apache.hadoop.hbase.util.MD5Hash 实例源码

项目:ditb    文件:TestHRegionInfo.java   
@Test
public void testCreateHRegionInfoName() throws Exception {
  String tableName = "tablename";
  final TableName tn = TableName.valueOf(tableName);
  String startKey = "startkey";
  final byte[] sk = Bytes.toBytes(startKey);
  String id = "id";

  // old format region name
  byte [] name = HRegionInfo.createRegionName(tn, sk, id, false);
  String nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + "," + id, nameStr);


  // new format region name.
  String md5HashInHex = MD5Hash.getMD5AsHex(name);
  assertEquals(HRegionInfo.MD5_HEX_LENGTH, md5HashInHex.length());
  name = HRegionInfo.createRegionName(tn, sk, id, true);
  nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + ","
               + id + "." + md5HashInHex + ".",
               nameStr);
}
项目:LCIndex-HBase-0.94.16    文件:TestFSVisitor.java   
private Path createTableFiles(final Path rootDir, final String tableName,
    final Set<String> tableRegions, final Set<String> tableFamilies,
    final Set<String> tableHFiles) throws IOException {
  Path tableDir = new Path(rootDir, tableName);
  for (int r = 0; r < 10; ++r) {
    String regionName = MD5Hash.getMD5AsHex(Bytes.toBytes(r));
    tableRegions.add(regionName);
    Path regionDir = new Path(tableDir, regionName);
    for (int f = 0; f < 3; ++f) {
      String familyName = "f" + f;
      tableFamilies.add(familyName);
      Path familyDir = new Path(regionDir, familyName);
      fs.mkdirs(familyDir);
      for (int h = 0; h < 5; ++h) {
       String hfileName = UUID.randomUUID().toString().replaceAll("-", "");
       tableHFiles.add(hfileName);
       fs.createNewFile(new Path(familyDir, hfileName));
      }
    }
  }
  return tableDir;
}
项目:LCIndex-HBase-0.94.16    文件:TestHRegionInfo.java   
@Test
public void testCreateHRegionInfoName() throws Exception {
  String tableName = "tablename";
  final byte [] tn = Bytes.toBytes(tableName);
  String startKey = "startkey";
  final byte [] sk = Bytes.toBytes(startKey);
  String id = "id";

  // old format region name
  byte [] name = HRegionInfo.createRegionName(tn, sk, id, false);
  String nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + "," + id, nameStr);


  // new format region name.
  String md5HashInHex = MD5Hash.getMD5AsHex(name);
  assertEquals(HRegionInfo.MD5_HEX_LENGTH, md5HashInHex.length());
  name = HRegionInfo.createRegionName(tn, sk, id, true);
  nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + ","
               + id + "." + md5HashInHex + ".",
               nameStr);
}
项目:pbase    文件:TestHRegionInfo.java   
@Test
public void testCreateHRegionInfoName() throws Exception {
  String tableName = "tablename";
  final TableName tn = TableName.valueOf(tableName);
  String startKey = "startkey";
  final byte[] sk = Bytes.toBytes(startKey);
  String id = "id";

  // old format region name
  byte [] name = HRegionInfo.createRegionName(tn, sk, id, false);
  String nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + "," + id, nameStr);


  // new format region name.
  String md5HashInHex = MD5Hash.getMD5AsHex(name);
  assertEquals(HRegionInfo.MD5_HEX_LENGTH, md5HashInHex.length());
  name = HRegionInfo.createRegionName(tn, sk, id, true);
  nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + ","
               + id + "." + md5HashInHex + ".",
               nameStr);
}
项目:HIndex    文件:TestHRegionInfo.java   
@Test
public void testCreateHRegionInfoName() throws Exception {
  String tableName = "tablename";
  final TableName tn = TableName.valueOf(tableName);
  String startKey = "startkey";
  final byte[] sk = Bytes.toBytes(startKey);
  String id = "id";

  // old format region name
  byte [] name = HRegionInfo.createRegionName(tn, sk, id, false);
  String nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + "," + id, nameStr);


  // new format region name.
  String md5HashInHex = MD5Hash.getMD5AsHex(name);
  assertEquals(HRegionInfo.MD5_HEX_LENGTH, md5HashInHex.length());
  name = HRegionInfo.createRegionName(tn, sk, id, true);
  nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + ","
               + id + "." + md5HashInHex + ".",
               nameStr);
}
项目:IRIndex    文件:TestFSVisitor.java   
private Path createTableFiles(final Path rootDir, final String tableName,
    final Set<String> tableRegions, final Set<String> tableFamilies,
    final Set<String> tableHFiles) throws IOException {
  Path tableDir = new Path(rootDir, tableName);
  for (int r = 0; r < 10; ++r) {
    String regionName = MD5Hash.getMD5AsHex(Bytes.toBytes(r));
    tableRegions.add(regionName);
    Path regionDir = new Path(tableDir, regionName);
    for (int f = 0; f < 3; ++f) {
      String familyName = "f" + f;
      tableFamilies.add(familyName);
      Path familyDir = new Path(regionDir, familyName);
      fs.mkdirs(familyDir);
      for (int h = 0; h < 5; ++h) {
       String hfileName = UUID.randomUUID().toString().replaceAll("-", "");
       tableHFiles.add(hfileName);
       fs.createNewFile(new Path(familyDir, hfileName));
      }
    }
  }
  return tableDir;
}
项目:IRIndex    文件:TestHRegionInfo.java   
@Test
public void testCreateHRegionInfoName() throws Exception {
  String tableName = "tablename";
  final byte [] tn = Bytes.toBytes(tableName);
  String startKey = "startkey";
  final byte [] sk = Bytes.toBytes(startKey);
  String id = "id";

  // old format region name
  byte [] name = HRegionInfo.createRegionName(tn, sk, id, false);
  String nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + "," + id, nameStr);


  // new format region name.
  String md5HashInHex = MD5Hash.getMD5AsHex(name);
  assertEquals(HRegionInfo.MD5_HEX_LENGTH, md5HashInHex.length());
  name = HRegionInfo.createRegionName(tn, sk, id, true);
  nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + ","
               + id + "." + md5HashInHex + ".",
               nameStr);
}
项目:PyroDB    文件:TestHRegionInfo.java   
@Test
public void testCreateHRegionInfoName() throws Exception {
  String tableName = "tablename";
  final TableName tn = TableName.valueOf(tableName);
  String startKey = "startkey";
  final byte[] sk = Bytes.toBytes(startKey);
  String id = "id";

  // old format region name
  byte [] name = HRegionInfo.createRegionName(tn, sk, id, false);
  String nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + "," + id, nameStr);


  // new format region name.
  String md5HashInHex = MD5Hash.getMD5AsHex(name);
  assertEquals(HRegionInfo.MD5_HEX_LENGTH, md5HashInHex.length());
  name = HRegionInfo.createRegionName(tn, sk, id, true);
  nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + ","
               + id + "." + md5HashInHex + ".",
               nameStr);
}
项目:c5    文件:TestHRegionInfo.java   
@Test
public void testCreateHRegionInfoName() throws Exception {
  String tableName = "tablename";
  final TableName tn = TableName.valueOf(tableName);
  String startKey = "startkey";
  final byte[] sk = Bytes.toBytes(startKey);
  String id = "id";

  // old format region name
  byte [] name = HRegionInfo.createRegionName(tn, sk, id, false);
  String nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + "," + id, nameStr);


  // new format region name.
  String md5HashInHex = MD5Hash.getMD5AsHex(name);
  assertEquals(HRegionInfo.MD5_HEX_LENGTH, md5HashInHex.length());
  name = HRegionInfo.createRegionName(tn, sk, id, true);
  nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + ","
               + id + "." + md5HashInHex + ".",
               nameStr);
}
项目:HBase-Research    文件:TestFSVisitor.java   
private Path createTableFiles(final Path rootDir, final String tableName,
    final Set<String> tableRegions, final Set<String> tableFamilies,
    final Set<String> tableHFiles) throws IOException {
  Path tableDir = new Path(rootDir, tableName);
  for (int r = 0; r < 10; ++r) {
    String regionName = MD5Hash.getMD5AsHex(Bytes.toBytes(r));
    tableRegions.add(regionName);
    Path regionDir = new Path(tableDir, regionName);
    for (int f = 0; f < 3; ++f) {
      String familyName = "f" + f;
      tableFamilies.add(familyName);
      Path familyDir = new Path(regionDir, familyName);
      fs.mkdirs(familyDir);
      for (int h = 0; h < 5; ++h) {
       String hfileName = UUID.randomUUID().toString().replaceAll("-", "");
       tableHFiles.add(hfileName);
       fs.createNewFile(new Path(familyDir, hfileName));
      }
    }
  }
  return tableDir;
}
项目:HBase-Research    文件:TestHRegionInfo.java   
@Test
public void testCreateHRegionInfoName() throws Exception {
  String tableName = "tablename";
  final byte [] tn = Bytes.toBytes(tableName);
  String startKey = "startkey";
  final byte [] sk = Bytes.toBytes(startKey);
  String id = "id";

  // old format region name
  byte [] name = HRegionInfo.createRegionName(tn, sk, id, false);
  String nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + "," + id, nameStr);


  // new format region name.
  String md5HashInHex = MD5Hash.getMD5AsHex(name);
  assertEquals(HRegionInfo.MD5_HEX_LENGTH, md5HashInHex.length());
  name = HRegionInfo.createRegionName(tn, sk, id, true);
  nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + ","
               + id + "." + md5HashInHex + ".",
               nameStr);
}
项目:hbase-0.94.8-qod    文件:TestFSVisitor.java   
private Path createTableFiles(final Path rootDir, final String tableName,
    final Set<String> tableRegions, final Set<String> tableFamilies,
    final Set<String> tableHFiles) throws IOException {
  Path tableDir = new Path(rootDir, tableName);
  for (int r = 0; r < 10; ++r) {
    String regionName = MD5Hash.getMD5AsHex(Bytes.toBytes(r));
    tableRegions.add(regionName);
    Path regionDir = new Path(tableDir, regionName);
    for (int f = 0; f < 3; ++f) {
      String familyName = "f" + f;
      tableFamilies.add(familyName);
      Path familyDir = new Path(regionDir, familyName);
      fs.mkdirs(familyDir);
      for (int h = 0; h < 5; ++h) {
       String hfileName = UUID.randomUUID().toString().replaceAll("-", "");
       tableHFiles.add(hfileName);
       fs.createNewFile(new Path(familyDir, hfileName));
      }
    }
  }
  return tableDir;
}
项目:hbase-0.94.8-qod    文件:TestHRegionInfo.java   
@Test
public void testCreateHRegionInfoName() throws Exception {
  String tableName = "tablename";
  final byte [] tn = Bytes.toBytes(tableName);
  String startKey = "startkey";
  final byte [] sk = Bytes.toBytes(startKey);
  String id = "id";

  // old format region name
  byte [] name = HRegionInfo.createRegionName(tn, sk, id, false);
  String nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + "," + id, nameStr);


  // new format region name.
  String md5HashInHex = MD5Hash.getMD5AsHex(name);
  assertEquals(HRegionInfo.MD5_HEX_LENGTH, md5HashInHex.length());
  name = HRegionInfo.createRegionName(tn, sk, id, true);
  nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + ","
               + id + "." + md5HashInHex + ".",
               nameStr);
}
项目:hbase-0.94.8-qod    文件:TestFSVisitor.java   
private Path createTableFiles(final Path rootDir, final String tableName,
    final Set<String> tableRegions, final Set<String> tableFamilies,
    final Set<String> tableHFiles) throws IOException {
  Path tableDir = new Path(rootDir, tableName);
  for (int r = 0; r < 10; ++r) {
    String regionName = MD5Hash.getMD5AsHex(Bytes.toBytes(r));
    tableRegions.add(regionName);
    Path regionDir = new Path(tableDir, regionName);
    for (int f = 0; f < 3; ++f) {
      String familyName = "f" + f;
      tableFamilies.add(familyName);
      Path familyDir = new Path(regionDir, familyName);
      fs.mkdirs(familyDir);
      for (int h = 0; h < 5; ++h) {
       String hfileName = UUID.randomUUID().toString().replaceAll("-", "");
       tableHFiles.add(hfileName);
       fs.createNewFile(new Path(familyDir, hfileName));
      }
    }
  }
  return tableDir;
}
项目:hbase-0.94.8-qod    文件:TestHRegionInfo.java   
@Test
public void testCreateHRegionInfoName() throws Exception {
  String tableName = "tablename";
  final byte [] tn = Bytes.toBytes(tableName);
  String startKey = "startkey";
  final byte [] sk = Bytes.toBytes(startKey);
  String id = "id";

  // old format region name
  byte [] name = HRegionInfo.createRegionName(tn, sk, id, false);
  String nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + "," + id, nameStr);


  // new format region name.
  String md5HashInHex = MD5Hash.getMD5AsHex(name);
  assertEquals(HRegionInfo.MD5_HEX_LENGTH, md5HashInHex.length());
  name = HRegionInfo.createRegionName(tn, sk, id, true);
  nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + ","
               + id + "." + md5HashInHex + ".",
               nameStr);
}
项目:DominoHBase    文件:TestHRegionInfo.java   
@Test
public void testCreateHRegionInfoName() throws Exception {
  String tableName = "tablename";
  final byte [] tn = Bytes.toBytes(tableName);
  String startKey = "startkey";
  final byte [] sk = Bytes.toBytes(startKey);
  String id = "id";

  // old format region name
  byte [] name = HRegionInfo.createRegionName(tn, sk, id, false);
  String nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + "," + id, nameStr);


  // new format region name.
  String md5HashInHex = MD5Hash.getMD5AsHex(name);
  assertEquals(HRegionInfo.MD5_HEX_LENGTH, md5HashInHex.length());
  name = HRegionInfo.createRegionName(tn, sk, id, true);
  nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + ","
               + id + "." + md5HashInHex + ".",
               nameStr);
}
项目:hindex    文件:TestFSVisitor.java   
private Path createTableFiles(final Path rootDir, final String tableName,
    final Set<String> tableRegions, final Set<String> tableFamilies,
    final Set<String> tableHFiles) throws IOException {
  Path tableDir = new Path(rootDir, tableName);
  for (int r = 0; r < 10; ++r) {
    String regionName = MD5Hash.getMD5AsHex(Bytes.toBytes(r));
    tableRegions.add(regionName);
    Path regionDir = new Path(tableDir, regionName);
    for (int f = 0; f < 3; ++f) {
      String familyName = "f" + f;
      tableFamilies.add(familyName);
      Path familyDir = new Path(regionDir, familyName);
      fs.mkdirs(familyDir);
      for (int h = 0; h < 5; ++h) {
       String hfileName = UUID.randomUUID().toString().replaceAll("-", "");
       tableHFiles.add(hfileName);
       fs.createNewFile(new Path(familyDir, hfileName));
      }
    }
  }
  return tableDir;
}
项目:hindex    文件:TestHRegionInfo.java   
@Test
public void testCreateHRegionInfoName() throws Exception {
  String tableName = "tablename";
  final byte [] tn = Bytes.toBytes(tableName);
  String startKey = "startkey";
  final byte [] sk = Bytes.toBytes(startKey);
  String id = "id";

  // old format region name
  byte [] name = HRegionInfo.createRegionName(tn, sk, id, false);
  String nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + "," + id, nameStr);


  // new format region name.
  String md5HashInHex = MD5Hash.getMD5AsHex(name);
  assertEquals(HRegionInfo.MD5_HEX_LENGTH, md5HashInHex.length());
  name = HRegionInfo.createRegionName(tn, sk, id, true);
  nameStr = Bytes.toString(name);
  assertEquals(tableName + "," + startKey + ","
               + id + "." + md5HashInHex + ".",
               nameStr);
}
项目:ditb    文件:LoadTestKVGenerator.java   
/**
 * Converts the given key to string, and prefixes it with the MD5 hash of
 * the index's string representation.
 */
public static String md5PrefixedKey(long key) {
  String stringKey = Long.toString(key);
  String md5hash = MD5Hash.getMD5AsHex(Bytes.toBytes(stringKey));

  // flip the key to randomize
  return md5hash + "-" + stringKey;
}
项目:ditb    文件:Context.java   
public Context setKey(Key key) {
  Preconditions.checkNotNull(cipher, "Context does not have a cipher");
  // validate the key length
  byte[] encoded = key.getEncoded();
  if (encoded.length != cipher.getKeyLength()) {
    throw new RuntimeException("Illegal key length, have=" + encoded.length +
      ", want=" + cipher.getKeyLength());
  }
  this.key = key;
  this.keyHash = MD5Hash.getMD5AsHex(encoded);
  return this;
}
项目:LCIndex-HBase-0.94.16    文件:LoadTestKVGenerator.java   
/**
 * Converts the given key to string, and prefixes it with the MD5 hash of
 * the index's string representation.
 */
public static String md5PrefixedKey(long key) {
  String stringKey = Long.toString(key);
  String md5hash = MD5Hash.getMD5AsHex(Bytes.toBytes(stringKey));

  // flip the key to randomize
  return md5hash + "-" + stringKey;
}
项目:pbase    文件:LoadTestKVGenerator.java   
/**
 * Converts the given key to string, and prefixes it with the MD5 hash of
 * the index's string representation.
 */
public static String md5PrefixedKey(long key) {
  String stringKey = Long.toString(key);
  String md5hash = MD5Hash.getMD5AsHex(Bytes.toBytes(stringKey));

  // flip the key to randomize
  return md5hash + "-" + stringKey;
}
项目:pbase    文件:Context.java   
public Context setKey(Key key) {
  Preconditions.checkNotNull(cipher, "Context does not have a cipher");
  // validate the key length
  byte[] encoded = key.getEncoded();
  if (encoded.length != cipher.getKeyLength()) {
    throw new RuntimeException("Illegal key length, have=" + encoded.length +
      ", want=" + cipher.getKeyLength());
  }
  this.key = key;
  this.keyHash = MD5Hash.getMD5AsHex(encoded);
  return this;
}
项目:HIndex    文件:LoadTestKVGenerator.java   
/**
 * Converts the given key to string, and prefixes it with the MD5 hash of
 * the index's string representation.
 */
public static String md5PrefixedKey(long key) {
  String stringKey = Long.toString(key);
  String md5hash = MD5Hash.getMD5AsHex(Bytes.toBytes(stringKey));

  // flip the key to randomize
  return md5hash + "-" + stringKey;
}
项目:HIndex    文件:Context.java   
public Context setKey(Key key) {
  Preconditions.checkNotNull(cipher, "Context does not have a cipher");
  // validate the key length
  byte[] encoded = key.getEncoded();
  if (encoded.length != cipher.getKeyLength()) {
    throw new RuntimeException("Illegal key length, have=" + encoded.length +
      ", want=" + cipher.getKeyLength());
  }
  this.key = key;
  this.keyHash = MD5Hash.getMD5AsHex(encoded);
  return this;
}
项目:IRIndex    文件:LoadTestKVGenerator.java   
/**
 * Converts the given key to string, and prefixes it with the MD5 hash of
 * the index's string representation.
 */
public static String md5PrefixedKey(long key) {
  String stringKey = Long.toString(key);
  String md5hash = MD5Hash.getMD5AsHex(Bytes.toBytes(stringKey));

  // flip the key to randomize
  return md5hash + "-" + stringKey;
}
项目:hbase    文件:TestMobFileName.java   
@Test
public void testGet() {
  MobFileName mobFileName = MobFileName.create(startKey, dateStr, uuid);
  assertEquals(MD5Hash.getMD5AsHex(startKey, 0, startKey.length), mobFileName.getStartKey());
  assertEquals(dateStr, mobFileName.getDate());
  assertEquals(mobFileName.getFileName(), MD5Hash.getMD5AsHex(startKey, 0, startKey.length)
      + dateStr + uuid);
}
项目:hbase    文件:Context.java   
public Context setKey(Key key) {
  Preconditions.checkNotNull(cipher, "Context does not have a cipher");
  // validate the key length
  byte[] encoded = key.getEncoded();
  if (encoded.length != cipher.getKeyLength()) {
    throw new RuntimeException("Illegal key length, have=" + encoded.length +
      ", want=" + cipher.getKeyLength());
  }
  this.key = key;
  this.keyHash = MD5Hash.getMD5AsHex(encoded);
  return this;
}
项目:PyroDB    文件:LoadTestKVGenerator.java   
/**
 * Converts the given key to string, and prefixes it with the MD5 hash of
 * the index's string representation.
 */
public static String md5PrefixedKey(long key) {
  String stringKey = Long.toString(key);
  String md5hash = MD5Hash.getMD5AsHex(Bytes.toBytes(stringKey));

  // flip the key to randomize
  return md5hash + "-" + stringKey;
}
项目:PyroDB    文件:Context.java   
public Context setKey(Key key) {
  Preconditions.checkNotNull(cipher, "Context does not have a cipher");
  // validate the key length
  byte[] encoded = key.getEncoded();
  if (encoded.length != cipher.getKeyLength()) {
    throw new RuntimeException("Illegal key length, have=" + encoded.length +
      ", want=" + cipher.getKeyLength());
  }
  this.key = key;
  this.keyHash = MD5Hash.getMD5AsHex(encoded);
  return this;
}
项目:c5    文件:LoadTestKVGenerator.java   
/**
 * Converts the given key to string, and prefixes it with the MD5 hash of
 * the index's string representation.
 */
public static String md5PrefixedKey(long key) {
  String stringKey = Long.toString(key);
  String md5hash = MD5Hash.getMD5AsHex(Bytes.toBytes(stringKey));

  // flip the key to randomize
  return md5hash + "-" + stringKey;
}
项目:HBase-LOB    文件:TestMobFileName.java   
@Test
public void testGet() {
  MobFileName mobFileName = MobFileName.create(startKey, dateStr, uuid);
  assertEquals(MD5Hash.getMD5AsHex(startKey, 0, startKey.length), mobFileName.getStartKey());
  assertEquals(dateStr, mobFileName.getDate());
  assertEquals(mobFileName.getFileName(), MD5Hash.getMD5AsHex(startKey, 0, startKey.length)
      + dateStr + uuid);
}
项目:HBase-Research    文件:TestRestoreSnapshotFromClient.java   
public void loadData(final HTable table, int rows, byte[]... families) throws IOException {
  byte[] qualifier = Bytes.toBytes("q");
  table.setAutoFlush(false);
  while (rows-- > 0) {
    byte[] value = Bytes.add(Bytes.toBytes(System.currentTimeMillis()), Bytes.toBytes(rows));
    byte[] key = Bytes.toBytes(MD5Hash.getMD5AsHex(value));
    Put put = new Put(key);
    put.setWriteToWAL(false);
    for (byte[] family: families) {
      put.add(family, qualifier, value);
    }
    table.put(put);
  }
  table.flushCommits();
}
项目:HBase-Research    文件:TestCloneSnapshotFromClient.java   
public void loadData(final HTable table, int rows, byte[]... families) throws IOException {
  byte[] qualifier = Bytes.toBytes("q");
  table.setAutoFlush(false);
  while (rows-- > 0) {
    byte[] value = Bytes.add(Bytes.toBytes(System.currentTimeMillis()), Bytes.toBytes(rows));
    byte[] key = Bytes.toBytes(MD5Hash.getMD5AsHex(value));
    Put put = new Put(key);
    put.setWriteToWAL(false);
    for (byte[] family: families) {
      put.add(family, qualifier, value);
    }
    table.put(put);
  }
  table.flushCommits();
}
项目:HBase-Research    文件:TestRestoreFlushSnapshotFromClient.java   
public void loadData(final HTable table, int rows, byte[]... families) throws IOException {
  byte[] qualifier = Bytes.toBytes("q");
  table.setAutoFlush(false);
  while (rows-- > 0) {
    byte[] value = Bytes.add(Bytes.toBytes(System.currentTimeMillis()), Bytes.toBytes(rows));
    byte[] key = Bytes.toBytes(MD5Hash.getMD5AsHex(value));
    Put put = new Put(key);
    put.setWriteToWAL(false);
    for (byte[] family: families) {
      put.add(family, qualifier, value);
    }
    table.put(put);
  }
  table.flushCommits();
}
项目:HBase-Research    文件:LoadTestKVGenerator.java   
/**
 * Converts the given key to string, and prefixes it with the MD5 hash of
 * the index's string representation.
 */
public static String md5PrefixedKey(long key) {
  String stringKey = Long.toString(key);
  String md5hash = MD5Hash.getMD5AsHex(Bytes.toBytes(stringKey));

  // flip the key to randomize
  return md5hash + "-" + stringKey;
}
项目:hbase-0.94.8-qod    文件:TestRestoreSnapshotFromClient.java   
public void loadData(final HTable table, int rows, byte[]... families) throws IOException {
  byte[] qualifier = Bytes.toBytes("q");
  table.setAutoFlush(false);
  while (rows-- > 0) {
    byte[] value = Bytes.add(Bytes.toBytes(System.currentTimeMillis()), Bytes.toBytes(rows));
    byte[] key = Bytes.toBytes(MD5Hash.getMD5AsHex(value));
    Put put = new Put(key);
    put.setWriteToWAL(false);
    for (byte[] family: families) {
      put.add(family, qualifier, value);
    }
    table.put(put);
  }
  table.flushCommits();
}
项目:hbase-0.94.8-qod    文件:TestCloneSnapshotFromClient.java   
public void loadData(final HTable table, int rows, byte[]... families) throws IOException {
  byte[] qualifier = Bytes.toBytes("q");
  table.setAutoFlush(false);
  while (rows-- > 0) {
    byte[] value = Bytes.add(Bytes.toBytes(System.currentTimeMillis()), Bytes.toBytes(rows));
    byte[] key = Bytes.toBytes(MD5Hash.getMD5AsHex(value));
    Put put = new Put(key);
    put.setWriteToWAL(false);
    for (byte[] family: families) {
      put.add(family, qualifier, value);
    }
    table.put(put);
  }
  table.flushCommits();
}
项目:hbase-0.94.8-qod    文件:TestRestoreFlushSnapshotFromClient.java   
public void loadData(final HTable table, int rows, byte[]... families) throws IOException {
  byte[] qualifier = Bytes.toBytes("q");
  table.setAutoFlush(false);
  while (rows-- > 0) {
    byte[] value = Bytes.add(Bytes.toBytes(System.currentTimeMillis()), Bytes.toBytes(rows));
    byte[] key = Bytes.toBytes(MD5Hash.getMD5AsHex(value));
    Put put = new Put(key);
    put.setWriteToWAL(false);
    for (byte[] family: families) {
      put.add(family, qualifier, value);
    }
    table.put(put);
  }
  table.flushCommits();
}
项目:hbase-0.94.8-qod    文件:LoadTestKVGenerator.java   
/**
 * Converts the given key to string, and prefixes it with the MD5 hash of
 * the index's string representation.
 */
public static String md5PrefixedKey(long key) {
  String stringKey = Long.toString(key);
  String md5hash = MD5Hash.getMD5AsHex(Bytes.toBytes(stringKey));

  // flip the key to randomize
  return md5hash + "-" + stringKey;
}