org.apache.hadoop.hbase.client.Increment.getAttribute()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(12.4k)|赞(0)|评价(0)|浏览(192)

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

Increment.getAttribute介绍

暂无

代码示例

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

tIncrement.setAttributes(attributes);
Increment increment = incrementFromThrift(tIncrement);
assertArrayEquals(increment.getAttribute("attribute1"), attributeValue);

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

byte[] bytes = increment.getAttribute(AccessControlConstants.OP_ATTRIBUTE_ACL);
if (bytes != null) {
 if (cellFeaturesEnabled) {

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

/**
 * Determines whether a request for incrementing the sequence was a bulk allocation and if so
 * what the number of slots to allocate is. This is triggered by the NEXT <n> VALUES FOR expression.
 * For backwards compatibility with older clients, we default the value to 1 which preserves
 * existing behavior when invoking NEXT VALUE FOR. 
 */
private long calculateNumSlotsToAllocate(final Increment increment) {
  long numToAllocate = 1;
  byte[] numToAllocateBytes = increment.getAttribute(SequenceRegionObserver.NUM_TO_ALLOCATE);
  if (numToAllocateBytes != null) {
    numToAllocate = Bytes.toLong(numToAllocateBytes);
  }
  return numToAllocate;
}

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

@Override
public Result preIncrementAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c,
  final Increment increment) throws IOException {
 if (increment.getAttribute(CHECK_COVERING_PERM) != null) {
  // We had failure with table, cf and q perm checks and now giving a chance for cell
  // perm check
  TableName table = c.getEnvironment().getRegion().getRegionInfo().getTable();
  AuthResult authResult = null;
  User user = getActiveUser(c);
  if (checkCoveringPermission(user, OpType.INCREMENT, c.getEnvironment(), increment.getRow(),
    increment.getFamilyCellMap(), increment.getTimeRange().getMax(), Action.WRITE)) {
   authResult = AuthResult.allow(OpType.INCREMENT.toString(), "Covering cell set",
     user, Action.WRITE, table, increment.getFamilyCellMap());
  } else {
   authResult = AuthResult.deny(OpType.INCREMENT.toString(), "Covering cell set",
     user, Action.WRITE, table, increment.getFamilyCellMap());
  }
  AccessChecker.logResult(authResult);
  if (authorizationEnabled && !authResult.isAllowed()) {
   throw new AccessDeniedException("Insufficient permissions " +
    authResult.toContextString());
  }
 }
 return null;
}

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

Result result = (Result)resultObjects[i];
try {
  long numToAllocate = Bytes.toLong(incrementBatch.get(i).getAttribute(SequenceRegionObserver.NUM_TO_ALLOCATE));
  values[indexes[i]] = sequence.incrementValue(result, op, numToAllocate);
} catch (SQLException e) {

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

@Override
public List<Mutation> executeAtomicOp(Increment inc) throws IOException {
  byte[] opBytes = inc.getAttribute(ATOMIC_OP_ATTRIB);
  if (opBytes == null) { // Unexpected
    return null;

代码示例来源:origin: org.apache.phoenix/phoenix-core

/**
 * Determines whether a request for incrementing the sequence was a bulk allocation and if so
 * what the number of slots to allocate is. This is triggered by the NEXT <n> VALUES FOR expression.
 * For backwards compatibility with older clients, we default the value to 1 which preserves
 * existing behavior when invoking NEXT VALUE FOR. 
 */
private long calculateNumSlotsToAllocate(final Increment increment) {
  long numToAllocate = 1;
  byte[] numToAllocateBytes = increment.getAttribute(SequenceRegionObserver.NUM_TO_ALLOCATE);
  if (numToAllocateBytes != null) {
    numToAllocate = Bytes.toLong(numToAllocateBytes);
  }
  return numToAllocate;
}

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

/**
 * Determines whether a request for incrementing the sequence was a bulk allocation and if so
 * what the number of slots to allocate is. This is triggered by the NEXT <n> VALUES FOR expression.
 * For backwards compatibility with older clients, we default the value to 1 which preserves
 * existing behavior when invoking NEXT VALUE FOR. 
 */
private long calculateNumSlotsToAllocate(final Increment increment) {
  long numToAllocate = 1;
  byte[] numToAllocateBytes = increment.getAttribute(SequenceRegionObserver.NUM_TO_ALLOCATE);
  if (numToAllocateBytes != null) {
    numToAllocate = Bytes.toLong(numToAllocateBytes);
  }
  return numToAllocate;
}

代码示例来源:origin: cdapio/cdap

boolean isIncrement = increment.getAttribute(HBaseTable.DELTA_WRITE) != null;
boolean transactional = state.containsTransactionalFamily(increment.getFamilyCellMap().keySet());
if (!isIncrement || !transactional) {
 return null;
byte[] txBytes = increment.getAttribute(TxConstants.TX_OPERATION_ATTRIBUTE_KEY);
if (txBytes == null) {
 throw new IllegalArgumentException("Attribute " + TxConstants.TX_OPERATION_ATTRIBUTE_KEY
                    + " must be set for transactional readless increments");
byte[] wpBytes = increment.getAttribute(HBaseTable.WRITE_POINTER);
if (wpBytes == null) {
 throw new IllegalArgumentException("Attribute " + HBaseTable.WRITE_POINTER
         increment.getAttribute(HBaseTable.TX_MAX_LIFETIME_MILLIS_KEY));
put.setAttribute(HBaseTable.TX_ID, increment.getAttribute(HBaseTable.TX_ID));
for (Map.Entry<byte[], NavigableMap<byte[], Long>> entry : increment.getFamilyMapOfLongs().entrySet()) {
 byte[] family = entry.getKey();

代码示例来源:origin: caskdata/cdap

boolean isIncrement = increment.getAttribute(HBaseTable.DELTA_WRITE) != null;
boolean transactional = state.containsTransactionalFamily(increment.getFamilyCellMap().keySet());
if (!isIncrement || !transactional) {
 return null;
byte[] txBytes = increment.getAttribute(TxConstants.TX_OPERATION_ATTRIBUTE_KEY);
if (txBytes == null) {
 throw new IllegalArgumentException("Attribute " + TxConstants.TX_OPERATION_ATTRIBUTE_KEY
                    + " must be set for transactional readless increments");
byte[] wpBytes = increment.getAttribute(HBaseTable.WRITE_POINTER);
if (wpBytes == null) {
 throw new IllegalArgumentException("Attribute " + HBaseTable.WRITE_POINTER
         increment.getAttribute(HBaseTable.TX_MAX_LIFETIME_MILLIS_KEY));
put.setAttribute(HBaseTable.TX_ID, increment.getAttribute(HBaseTable.TX_ID));
for (Map.Entry<byte[], NavigableMap<byte[], Long>> entry : increment.getFamilyMapOfLongs().entrySet()) {
 byte[] family = entry.getKey();

代码示例来源:origin: cdapio/cdap

boolean isIncrement = increment.getAttribute(HBaseTable.DELTA_WRITE) != null;
boolean transactional = state.containsTransactionalFamily(increment.getFamilyCellMap().keySet());
if (!isIncrement || !transactional) {
 return null;
byte[] txBytes = increment.getAttribute(TxConstants.TX_OPERATION_ATTRIBUTE_KEY);
if (txBytes == null) {
 throw new IllegalArgumentException("Attribute " + TxConstants.TX_OPERATION_ATTRIBUTE_KEY
                    + " must be set for transactional readless increments");
byte[] wpBytes = increment.getAttribute(HBaseTable.WRITE_POINTER);
if (wpBytes == null) {
 throw new IllegalArgumentException("Attribute " + HBaseTable.WRITE_POINTER
         increment.getAttribute(HBaseTable.TX_MAX_LIFETIME_MILLIS_KEY));
put.setAttribute(HBaseTable.TX_ID, increment.getAttribute(HBaseTable.TX_ID));
for (Map.Entry<byte[], NavigableMap<byte[], Long>> entry : increment.getFamilyMapOfLongs().entrySet()) {
 byte[] family = entry.getKey();

代码示例来源:origin: cdapio/cdap

boolean isIncrement = increment.getAttribute(HBaseTable.DELTA_WRITE) != null;
boolean transactional = state.containsTransactionalFamily(increment.getFamilyCellMap().keySet());
if (!isIncrement || !transactional) {
 return null;
byte[] txBytes = increment.getAttribute(TxConstants.TX_OPERATION_ATTRIBUTE_KEY);
if (txBytes == null) {
 throw new IllegalArgumentException("Attribute " + TxConstants.TX_OPERATION_ATTRIBUTE_KEY
                    + " must be set for transactional readless increments");
byte[] wpBytes = increment.getAttribute(HBaseTable.WRITE_POINTER);
if (wpBytes == null) {
 throw new IllegalArgumentException("Attribute " + HBaseTable.WRITE_POINTER
         increment.getAttribute(HBaseTable.TX_MAX_LIFETIME_MILLIS_KEY));
put.setAttribute(HBaseTable.TX_ID, increment.getAttribute(HBaseTable.TX_ID));
for (Map.Entry<byte[], NavigableMap<byte[], Long>> entry : increment.getFamilyMapOfLongs().entrySet()) {
 byte[] family = entry.getKey();

代码示例来源:origin: caskdata/cdap

boolean isIncrement = increment.getAttribute(HBaseTable.DELTA_WRITE) != null;
boolean transactional = state.containsTransactionalFamily(increment.getFamilyCellMap().keySet());
if (!isIncrement || !transactional) {
 return null;
byte[] txBytes = increment.getAttribute(TxConstants.TX_OPERATION_ATTRIBUTE_KEY);
if (txBytes == null) {
 throw new IllegalArgumentException("Attribute " + TxConstants.TX_OPERATION_ATTRIBUTE_KEY
                    + " must be set for transactional readless increments");
byte[] wpBytes = increment.getAttribute(HBaseTable.WRITE_POINTER);
if (wpBytes == null) {
 throw new IllegalArgumentException("Attribute " + HBaseTable.WRITE_POINTER
         increment.getAttribute(HBaseTable.TX_MAX_LIFETIME_MILLIS_KEY));
put.setAttribute(HBaseTable.TX_ID, increment.getAttribute(HBaseTable.TX_ID));
for (Map.Entry<byte[], NavigableMap<byte[], Long>> entry : increment.getFamilyMapOfLongs().entrySet()) {
 byte[] family = entry.getKey();

代码示例来源:origin: cdapio/cdap

boolean isIncrement = increment.getAttribute(HBaseTable.DELTA_WRITE) != null;
boolean transactional = state.containsTransactionalFamily(increment.getFamilyCellMap().keySet());
if (!isIncrement || !transactional) {
 return null;
byte[] txBytes = increment.getAttribute(TxConstants.TX_OPERATION_ATTRIBUTE_KEY);
if (txBytes == null) {
 throw new IllegalArgumentException("Attribute " + TxConstants.TX_OPERATION_ATTRIBUTE_KEY
                    + " must be set for transactional readless increments");
byte[] wpBytes = increment.getAttribute(HBaseTable.WRITE_POINTER);
if (wpBytes == null) {
 throw new IllegalArgumentException("Attribute " + HBaseTable.WRITE_POINTER
         increment.getAttribute(HBaseTable.TX_MAX_LIFETIME_MILLIS_KEY));
put.setAttribute(HBaseTable.TX_ID, increment.getAttribute(HBaseTable.TX_ID));
for (Map.Entry<byte[], NavigableMap<byte[], Long>> entry : increment.getFamilyMapOfLongs().entrySet()) {
 byte[] family = entry.getKey();

代码示例来源:origin: caskdata/cdap

boolean isIncrement = increment.getAttribute(HBaseTable.DELTA_WRITE) != null;
boolean transactional = state.containsTransactionalFamily(increment.getFamilyCellMap().keySet());
if (!isIncrement || !transactional) {
 return null;
byte[] txBytes = increment.getAttribute(TxConstants.TX_OPERATION_ATTRIBUTE_KEY);
if (txBytes == null) {
 throw new IllegalArgumentException("Attribute " + TxConstants.TX_OPERATION_ATTRIBUTE_KEY
                    + " must be set for transactional readless increments");
byte[] wpBytes = increment.getAttribute(HBaseTable.WRITE_POINTER);
if (wpBytes == null) {
 throw new IllegalArgumentException("Attribute " + HBaseTable.WRITE_POINTER
          increment.getAttribute(HBaseTable.TX_MAX_LIFETIME_MILLIS_KEY));
 put.setAttribute(HBaseTable.TX_ID, increment.getAttribute(HBaseTable.TX_ID));
 for (Map.Entry<byte[], NavigableMap<byte[], Long>> entry : increment.getFamilyMapOfLongs().entrySet()) {
  byte[] family = entry.getKey();

代码示例来源:origin: org.apache.phoenix/phoenix-core

Result result = (Result)resultObjects[i];
try {
  long numToAllocate = Bytes.toLong(incrementBatch.get(i).getAttribute(SequenceRegionObserver.NUM_TO_ALLOCATE));
  values[indexes[i]] = sequence.incrementValue(result, op, numToAllocate);
} catch (SQLException e) {

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

tIncrement.setAttributes(attributes);
Increment increment = incrementFromThrift(tIncrement);
assertArrayEquals(increment.getAttribute("attribute1"), attributeValue);

代码示例来源:origin: com.aliyun.hbase/alihbase-thrift

tIncrement.setAttributes(attributes);
Increment increment = incrementFromThrift(tIncrement);
assertArrayEquals(increment.getAttribute("attribute1"), attributeValue);

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

byte[] bytes = increment.getAttribute(AccessControlConstants.OP_ATTRIBUTE_ACL);
if (bytes != null) {
 if (cellFeaturesEnabled) {

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

@Override
public Result preIncrementAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c,
  final Increment increment) throws IOException {
 if (increment.getAttribute(CHECK_COVERING_PERM) != null) {
  // We had failure with table, cf and q perm checks and now giving a chance for cell
  // perm check
  TableName table = c.getEnvironment().getRegion().getRegionInfo().getTable();
  AuthResult authResult = null;
  if (checkCoveringPermission(OpType.INCREMENT, c.getEnvironment(), increment.getRow(),
    increment.getFamilyCellMap(), increment.getTimeRange().getMax(), Action.WRITE)) {
   authResult = AuthResult.allow(OpType.INCREMENT.toString(), "Covering cell set",
     getActiveUser(), Action.WRITE, table, increment.getFamilyCellMap());
  } else {
   authResult = AuthResult.deny(OpType.INCREMENT.toString(), "Covering cell set",
     getActiveUser(), Action.WRITE, table, increment.getFamilyCellMap());
  }
  logResult(authResult);
  if (authorizationEnabled && !authResult.isAllowed()) {
   throw new AccessDeniedException("Insufficient permissions " +
    authResult.toContextString());
  }
 }
 return null;
}

相关文章