org.apache.hadoop.hbase.regionserver.Region.checkAndMutate()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中org.apache.hadoop.hbase.regionserver.Region.checkAndMutate方法的一些代码示例,展示了Region.checkAndMutate的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Region.checkAndMutate方法的具体详情如下:
包路径:org.apache.hadoop.hbase.regionserver.Region
类名称:Region
方法名:checkAndMutate

Region.checkAndMutate介绍

[英]Atomically checks if a row/family/qualifier value matches the expected value and if it does, it performs the mutation. If the passed value is null, the lack of column value (ie: non-existence) is used. See checkAndRowMutate to do many checkAndPuts at a time on a single row.
[中]原子地检查行/族/限定符值是否与预期值匹配,如果匹配,则执行变异。如果传递的值为null,则使用缺少列值(即:不存在)。请参阅checkAndRowMutate,一次在一行上执行多个checkAndPuts。

代码示例

代码示例来源:origin: apache/hbase

/**
 * Atomically checks if a row/family/qualifier value matches the expected value and if it does,
 * it performs the mutation. If the passed value is null, the lack of column value
 * (ie: non-existence) is used. See checkAndRowMutate to do many checkAndPuts at a time on a
 * single row.
 * @param row to check
 * @param family column family to check
 * @param qualifier column qualifier to check
 * @param op the comparison operator
 * @param comparator the expected value
 * @param mutation data to put if check succeeds
 * @return true if mutation was applied, false otherwise
 */
default boolean checkAndMutate(byte [] row, byte [] family, byte [] qualifier, CompareOperator op,
 ByteArrayComparable comparator, Mutation mutation) throws IOException {
 return checkAndMutate(row, family, qualifier, op, comparator, TimeRange.allTime(), mutation);
}

代码示例来源:origin: apache/hbase

@Override
 public void doWork() throws Exception {
  Put[] puts = new Put[1];
  Put put = new Put(Bytes.toBytes("r1"));
  put.addColumn(Bytes.toBytes(family), Bytes.toBytes("q1"), Bytes.toBytes("11"));
  puts[0] = put;
  while (testStep != TestStep.PUT_COMPLETED) {
   Thread.sleep(100);
  }
  testStep = TestStep.CHECKANDPUT_STARTED;
  region.checkAndMutate(Bytes.toBytes("r1"), Bytes.toBytes(family), Bytes.toBytes("q1"),
   CompareOperator.EQUAL, new BinaryComparator(Bytes.toBytes("10")), put);
  testStep = TestStep.CHECKANDPUT_COMPLETED;
 }
}

代码示例来源:origin: org.apache.hbase/hbase-server

@Override
 public void doWork() throws Exception {
  Put[] puts = new Put[1];
  Put put = new Put(Bytes.toBytes("r1"));
  put.addColumn(Bytes.toBytes(family), Bytes.toBytes("q1"), Bytes.toBytes("11"));
  puts[0] = put;
  while (testStep != TestStep.PUT_COMPLETED) {
   Thread.sleep(100);
  }
  testStep = TestStep.CHECKANDPUT_STARTED;
  region.checkAndMutate(Bytes.toBytes("r1"), Bytes.toBytes(family), Bytes.toBytes("q1"),
   CompareOperator.EQUAL, new BinaryComparator(Bytes.toBytes("10")), put);
  testStep = TestStep.CHECKANDPUT_COMPLETED;
 }
}

代码示例来源:origin: harbby/presto-connectors

boolean result = region.checkAndMutate(row, family,
 qualifier, compareOp, comparator, put, true);
if (region.getCoprocessorHost() != null) {
boolean result = region.checkAndMutate(row, family,
 qualifier, compareOp, comparator, delete, true);
if (region.getCoprocessorHost() != null) {

相关文章