tIncrement.setAttributes(attributes); Increment increment = incrementFromThrift(tIncrement); assertArrayEquals(increment.getAttribute("attribute1"), attributeValue);
byte[] bytes = increment.getAttribute(AccessControlConstants.OP_ATTRIBUTE_ACL); if (bytes != null) { if (cellFeaturesEnabled) {
/** * 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; }
@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; }
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) {
@Override public List<Mutation> executeAtomicOp(Increment inc) throws IOException { byte[] opBytes = inc.getAttribute(ATOMIC_OP_ATTRIB); if (opBytes == null) { // Unexpected return null;
/** * 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; }
/** * 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; }
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();
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();
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();
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();
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();
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();
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();
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) {
tIncrement.setAttributes(attributes); Increment increment = incrementFromThrift(tIncrement); assertArrayEquals(increment.getAttribute("attribute1"), attributeValue);
tIncrement.setAttributes(attributes); Increment increment = incrementFromThrift(tIncrement); assertArrayEquals(increment.getAttribute("attribute1"), attributeValue);
byte[] bytes = increment.getAttribute(AccessControlConstants.OP_ATTRIBUTE_ACL); if (bytes != null) { if (cellFeaturesEnabled) {
@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; }