/** * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. * No replacement. */ @Deprecated @Override public int hashCode() { // TODO: This is wrong. Can't have two gets the same just because on same row. But it // matches how equals works currently and gets rid of the findbugs warning. return Bytes.hashCode(this.getRow()); }
Maps.newTreeMap(Bytes.BYTES_COMPARATOR); for (Increment inc : incs) { byte[] row = inc.getRow(); Map<byte[], NavigableMap<byte[], Long>> families = getFamilyMap(inc); for (Map.Entry<byte[], NavigableMap<byte[], Long>> familyEntry : families.entrySet()) {
Maps.newTreeMap(Bytes.BYTES_COMPARATOR); for (Increment inc : incs) { byte[] row = inc.getRow(); Map<byte[], NavigableMap<byte[], Long>> families = getFamilyMap(inc); for (Map.Entry<byte[], NavigableMap<byte[], Long>> familyEntry : families.entrySet()) {
private static Cell createCustomCell(Increment inc) { return createCustomCell(inc.getRow(), FAMILY, QUALIFIER_FROM_CP, Cell.Type.Put, VALUE); }
@Override public Result increment(final Increment increment) throws IOException { checkHasFamilies(increment); NoncedRegionServerCallable<Result> callable = new NoncedRegionServerCallable<Result>(this.connection, getName(), increment.getRow(), this.rpcControllerFactory.newController(), increment.getPriority()) { @Override protected Result rpcCall() throws Exception { MutateRequest request = RequestConverter.buildMutateRequest( getLocation().getRegionInfo().getRegionName(), increment, getNonceGroup(), getNonce()); MutateResponse response = doMutate(request); // Should this check for null like append does? return ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner()); } }; return rpcCallerFactory.<Result> newCaller(writeRpcTimeoutMs).callWithRetries(callable, this.operationTimeoutMs); }
public static TIncrement incrementFromHBase(Increment in) throws IOException { TIncrement out = new TIncrement(); out.setRow(in.getRow());
@Override public Result preIncrement(ObserverContext<RegionCoprocessorEnvironment> c, Increment increment) throws IOException { byte[] row = increment.getRow(); Put put = new Put(row); long ts = getUniqueTimestamp(row); for (Map.Entry<byte[], List<Cell>> entry : increment.getFamilyCellMap().entrySet()) { for (Cell cell : entry.getValue()) { put.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY).setRow(row) .setFamily(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength()) .setQualifier(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()) .setValue(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()) .setType(Cell.Type.Put).setTimestamp(ts).build()); } } c.getEnvironment().getRegion().put(put); c.bypass(); return Result.EMPTY_RESULT; }
@Test public void testIncrementCopyConstructor() throws IOException { Increment origin = new Increment(Bytes.toBytes("ROW-01")); origin.setPriority(100); byte[] family = Bytes.toBytes("CF-01"); origin.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY) .setRow(origin.getRow()) .setFamily(family) .setQualifier(Bytes.toBytes("q")) .setType(Cell.Type.Put) .setValue(Bytes.toBytes(100)) .build()); origin.addColumn(family, Bytes.toBytes("q0"), 4); origin.setTimeRange(100, 1000); Increment clone = new Increment(origin); assertEquals(origin, clone); origin.addColumn(family, Bytes.toBytes("q1"), 3); //They should have different cell lists assertNotEquals(origin.getCellList(family), clone.getCellList(family)); }
/** * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. * No replacement. */ @Deprecated @Override public int hashCode() { // TODO: This is wrong. Can't have two gets the same just because on same row. But it // matches how equals works currently and gets rid of the findbugs warning. return Bytes.hashCode(this.getRow()); }
private static List<Mutation> convertIncrementToPutInSingletonList(Increment inc) { byte[] rowKey = inc.getRow(); Put put = new Put(rowKey); transferCells(inc, put); transferAttributes(inc, put); return Collections.<Mutation>singletonList(put); }
@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; }
@Override public Result increment(final Increment increment) throws IOException { checkHasFamilies(increment); NoncedRegionServerCallable<Result> callable = new NoncedRegionServerCallable<Result>(this.connection, getName(), increment.getRow(), this.rpcControllerFactory.newController(), increment.getPriority()) { @Override protected Result rpcCall() throws Exception { MutateRequest request = RequestConverter.buildMutateRequest( getLocation().getRegionInfo().getRegionName(), increment, getNonceGroup(), getNonce()); MutateResponse response = doMutate(request); // Should this check for null like append does? return ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner()); } }; return rpcCallerFactory.<Result> newCaller(writeRpcTimeoutMs).callWithRetries(callable, this.operationTimeoutMs); }
"Unable to process ON DUPLICATE IGNORE for " + e.getEnvironment().getRegion().getRegionInfo().getTable().getNameAsString() + "(" + Bytes.toStringBinary(inc.getRow()) + ")", t); } finally { long duration = EnvironmentEdgeManager.currentTimeMillis() - start;
byte[] rowKey = inc.getRow(); final Get get = new Get(rowKey); if (isDupKeyIgnore(opBytes)) {
@Test public void testIncrementCopyConstructor() throws IOException { Increment origin = new Increment(Bytes.toBytes("ROW-01")); origin.setPriority(100); byte[] family = Bytes.toBytes("CF-01"); origin.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY) .setRow(origin.getRow()) .setFamily(family) .setQualifier(Bytes.toBytes("q")) .setType(Cell.Type.Put) .setValue(Bytes.toBytes(100)) .build()); origin.addColumn(family, Bytes.toBytes("q0"), 4); origin.setTimeRange(100, 1000); Increment clone = new Increment(origin); assertEquals(origin, clone); origin.addColumn(family, Bytes.toBytes("q1"), 3); //They should have different cell lists assertNotEquals(origin.getCellList(family), clone.getCellList(family)); }
private static List<Mutation> convertIncrementToPutInSingletonList(Increment inc) { byte[] rowKey = inc.getRow(); Put put = new Put(rowKey); transferCells(inc, put); transferAttributes(inc, put); return Collections.<Mutation>singletonList(put); }
e.complete(); HRegion region = env.getRegion(); byte[] row = increment.getRow(); TimeRange tr = increment.getTimeRange(); region.startRegionOperation();
byte[] row = increment.getRow(); List<RowLock> locks = Lists.newArrayList(); TimeRange tr = increment.getTimeRange();
@Override public int compareTo(Row i) { return Bytes.compareTo(this.getRow(), i.getRow()); } }
@Override public IncrementBuilder add(byte[] family, byte[] qualifier, long ts, long value) throws IOException { increment.add(new KeyValue(increment.getRow(), family, qualifier, ts, Bytes.toBytes(value))); return this; }