Java Code Examples for org.apache.hadoop.hbase.client.Delete#setAttribute()

The following examples show how to use org.apache.hadoop.hbase.client.Delete#setAttribute() . 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
Source File: AccessController.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Override
public boolean preCheckAndDelete(final ObserverContext<RegionCoprocessorEnvironment> c,
    final byte [] row, final byte [] family, final byte [] qualifier,
    final CompareOperator op,
    final ByteArrayComparable comparator, final Delete delete,
    final boolean result) throws IOException {
  // An ACL on a delete is useless, we shouldn't allow it
  if (delete.getAttribute(AccessControlConstants.OP_ATTRIBUTE_ACL) != null) {
    throw new DoNotRetryIOException("ACL on checkAndDelete has no effect: " +
        delete.toString());
  }
  // Require READ and WRITE permissions on the table, CF, and the KV covered
  // by the delete
  RegionCoprocessorEnvironment env = c.getEnvironment();
  Map<byte[],? extends Collection<byte[]>> families = makeFamilyMap(family, qualifier);
  User user = getActiveUser(c);
  AuthResult authResult = permissionGranted(
      OpType.CHECK_AND_DELETE, user, env, families, Action.READ, Action.WRITE);
  AccessChecker.logResult(authResult);
  if (!authResult.isAllowed()) {
    if (cellFeaturesEnabled && !compatibleEarlyTermination) {
      delete.setAttribute(CHECK_COVERING_PERM, TRUE);
    } else if (authorizationEnabled) {
      throw new AccessDeniedException("Insufficient permissions " +
        authResult.toContextString());
    }
  }
  return result;
}
 
Example 2
Source File: AccessController.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Override
public void preDelete(final ObserverContext<RegionCoprocessorEnvironment> c,
    final Delete delete, final WALEdit edit, final Durability durability)
    throws IOException {
  // An ACL on a delete is useless, we shouldn't allow it
  if (delete.getAttribute(AccessControlConstants.OP_ATTRIBUTE_ACL) != null) {
    throw new DoNotRetryIOException("ACL on delete has no effect: " + delete.toString());
  }
  // Require WRITE permissions on all cells covered by the delete. Unlike
  // for Puts we need to check all visible prior versions, because a major
  // compaction could remove them. If the user doesn't have permission to
  // overwrite any of the visible versions ('visible' defined as not covered
  // by a tombstone already) then we have to disallow this operation.
  RegionCoprocessorEnvironment env = c.getEnvironment();
  Map<byte[],? extends Collection<Cell>> families = delete.getFamilyCellMap();
  User user = getActiveUser(c);
  AuthResult authResult = permissionGranted(OpType.DELETE,
      user, env, families, Action.WRITE);
  AccessChecker.logResult(authResult);
  if (!authResult.isAllowed()) {
    if (cellFeaturesEnabled && !compatibleEarlyTermination) {
      delete.setAttribute(CHECK_COVERING_PERM, TRUE);
    } else if (authorizationEnabled) {
      throw new AccessDeniedException("Insufficient permissions " +
        authResult.toContextString());
    }
  }
}
 
Example 3
Source File: TransactionAwareHTableTest.java    From phoenix-tephra with Apache License 2.0 4 votes vote down vote up
@Override
protected void makeRollbackOperation(Delete delete) {
  delete.setAttribute(TxConstants.OLD_TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]);
}
 
Example 4
Source File: TransactionAwareHTableTest.java    From phoenix-tephra with Apache License 2.0 4 votes vote down vote up
@Override
protected void makeRollbackOperation(Delete delete) {
  delete.setAttribute(TxConstants.OLD_TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]);
}
 
Example 5
Source File: TransactionAwareHTable.java    From phoenix-tephra with Apache License 2.0 4 votes vote down vote up
protected void makeRollbackOperation(Delete delete) {
  delete.setAttribute(TxConstants.TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]);
}
 
Example 6
Source File: TransactionAwareHTableTest.java    From phoenix-tephra with Apache License 2.0 4 votes vote down vote up
@Override
protected void makeRollbackOperation(Delete delete) {
  delete.setAttribute(TxConstants.OLD_TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]);
}
 
Example 7
Source File: TransactionAwareHTable.java    From phoenix-tephra with Apache License 2.0 4 votes vote down vote up
protected void makeRollbackOperation(Delete delete) {
  delete.setAttribute(TxConstants.TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]);
}
 
Example 8
Source File: TransactionAwareHTableTest.java    From phoenix-tephra with Apache License 2.0 4 votes vote down vote up
@Override
protected void makeRollbackOperation(Delete delete) {
  delete.setAttribute(TxConstants.OLD_TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]);
}
 
Example 9
Source File: TransactionAwareHTable.java    From phoenix-tephra with Apache License 2.0 4 votes vote down vote up
protected void makeRollbackOperation(Delete delete) {
  delete.setAttribute(TxConstants.TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]);
}
 
Example 10
Source File: TransactionAwareHTable.java    From phoenix-tephra with Apache License 2.0 4 votes vote down vote up
protected void makeRollbackOperation(Delete delete) {
  delete.setAttribute(TxConstants.TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]);
}
 
Example 11
Source File: TransactionAwareHTable.java    From phoenix-tephra with Apache License 2.0 4 votes vote down vote up
protected void makeRollbackOperation(Delete delete) {
  delete.setAttribute(TxConstants.TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]);
}
 
Example 12
Source File: TransactionAwareHTableTest.java    From phoenix-tephra with Apache License 2.0 4 votes vote down vote up
@Override
protected void makeRollbackOperation(Delete delete) {
  delete.setAttribute(TxConstants.OLD_TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]);
}
 
Example 13
Source File: TransactionAwareHTable.java    From phoenix-tephra with Apache License 2.0 4 votes vote down vote up
protected void makeRollbackOperation(Delete delete) {
  delete.setAttribute(TxConstants.TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]);
}
 
Example 14
Source File: TransactionAwareHTableTest.java    From phoenix-tephra with Apache License 2.0 4 votes vote down vote up
@Override
protected void makeRollbackOperation(Delete delete) {
  delete.setAttribute(TxConstants.OLD_TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]);
}
 
Example 15
Source File: TransactionAwareHTable.java    From phoenix-tephra with Apache License 2.0 4 votes vote down vote up
protected void makeRollbackOperation(Delete delete) {
  delete.setAttribute(TxConstants.TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]);
}
 
Example 16
Source File: TransactionAwareHTableTest.java    From phoenix-tephra with Apache License 2.0 4 votes vote down vote up
@Override
protected void makeRollbackOperation(Delete delete) {
  delete.setAttribute(TxConstants.OLD_TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]);
}
 
Example 17
Source File: TransactionAwareHTable.java    From phoenix-tephra with Apache License 2.0 4 votes vote down vote up
protected void makeRollbackOperation(Delete delete) {
  delete.setAttribute(TxConstants.TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]);
}
 
Example 18
Source File: TransactionAwareHTableTest.java    From phoenix-tephra with Apache License 2.0 4 votes vote down vote up
@Override
protected void makeRollbackOperation(Delete delete) {
  delete.setAttribute(TxConstants.OLD_TX_ROLLBACK_ATTRIBUTE_KEY, new byte[0]);
}