@Override public boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException { boolean ret = scanner.next(result, scannerContext); for (int i = 0; i < result.size(); i++) { Cell c = result.get(i); // Replace the Cell if the value is the one we're replacing if (CellUtil.isPut(c) && comparator.compare(CellUtil.cloneValue(c), sourceValue) == 0) { try { cellBuilder.setRow(CellUtil.copyRow(c)); cellBuilder.setFamily(CellUtil.cloneFamily(c)); cellBuilder.setQualifier(CellUtil.cloneQualifier(c)); cellBuilder.setTimestamp(c.getTimestamp()); cellBuilder.setType(Cell.Type.Put); // Make sure each cell gets a unique value byte[] clonedValue = new byte[replacedValue.length]; System.arraycopy(replacedValue, 0, clonedValue, 0, replacedValue.length); cellBuilder.setValue(clonedValue); result.set(i, cellBuilder.build()); } finally { cellBuilder.clear(); } } } return ret; }
put.add(builder.clear() .setRow(put.getRow()) .setFamily(famAndQf[0])
public static Put addLocation(Put p, ServerName sn, long openSeqNum, int replicaId) throws IOException { CellBuilder builder = CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY); return p.add(builder.clear() .setRow(p.getRow()) .setFamily(getCatalogFamily()) .setQualifier(getServerColumn(replicaId)) .setTimestamp(p.getTimestamp()) .setType(Cell.Type.Put) .setValue(Bytes.toBytes(sn.getAddress().toString())) .build()) .add(builder.clear() .setRow(p.getRow()) .setFamily(getCatalogFamily()) .setQualifier(getStartCodeColumn(replicaId)) .setTimestamp(p.getTimestamp()) .setType(Cell.Type.Put) .setValue(Bytes.toBytes(sn.getStartcode())) .build()) .add(builder.clear() .setRow(p.getRow()) .setFamily(getCatalogFamily()) .setQualifier(getSeqNumColumn(replicaId)) .setTimestamp(p.getTimestamp()) .setType(Type.Put) .setValue(Bytes.toBytes(openSeqNum)) .build()); }
private static Put addEmptyLocation(Put p, int replicaId) throws IOException { CellBuilder builder = CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY); return p.add(builder.clear() .setRow(p.getRow()) .setFamily(getCatalogFamily()) .setQualifier(getServerColumn(replicaId)) .setTimestamp(p.getTimestamp()) .setType(Type.Put) .build()) .add(builder.clear() .setRow(p.getRow()) .setFamily(getCatalogFamily()) .setQualifier(getStartCodeColumn(replicaId)) .setTimestamp(p.getTimestamp()) .setType(Cell.Type.Put) .build()) .add(builder.clear() .setRow(p.getRow()) .setFamily(getCatalogFamily()) .setQualifier(getSeqNumColumn(replicaId)) .setTimestamp(p.getTimestamp()) .setType(Cell.Type.Put) .build()); }
+ "over the whole column family."); } else { put.add(builder.clear() .setRow(put.getRow()) .setFamily(famAndQf[0])
@Override public OperationStatus[] setAuths(byte[] user, List<byte[]> authLabels) throws IOException { assert labelsRegion != null; OperationStatus[] finalOpStatus = new OperationStatus[authLabels.size()]; Put p = new Put(user); CellBuilder builder = CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY); for (byte[] auth : authLabels) { p.add(builder.clear() .setRow(p.getRow()) .setFamily(LABELS_TABLE_FAMILY) .setQualifier(auth) .setTimestamp(p.getTimestamp()) .setType(Cell.Type.Put) .setValue(DUMMY_VALUE) .build()); } this.labelsRegion.put(p); // This is a testing impl and so not doing any caching for (int i = 0; i < authLabels.size(); i++) { finalOpStatus[i] = new OperationStatus(OperationStatusCode.SUCCESS); } return finalOpStatus; }
private static Put addEmptyLocation(Put p, int replicaId) throws IOException { CellBuilder builder = CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY); return p.add(builder.clear() .setRow(p.getRow()) .setFamily(getCatalogFamily()) .setQualifier(getServerColumn(replicaId)) .setTimestamp(p.getTimestamp()) .setType(Type.Put) .build()) .add(builder.clear() .setRow(p.getRow()) .setFamily(getCatalogFamily()) .setQualifier(getStartCodeColumn(replicaId)) .setTimestamp(p.getTimestamp()) .setType(Cell.Type.Put) .build()) .add(builder.clear() .setRow(p.getRow()) .setFamily(getCatalogFamily()) .setQualifier(getSeqNumColumn(replicaId)) .setTimestamp(p.getTimestamp()) .setType(Cell.Type.Put) .build()); }
public static Put addLocation(Put p, ServerName sn, long openSeqNum, int replicaId) throws IOException { CellBuilder builder = CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY); return p.add(builder.clear() .setRow(p.getRow()) .setFamily(getCatalogFamily()) .setQualifier(getServerColumn(replicaId)) .setTimestamp(p.getTimestamp()) .setType(Cell.Type.Put) .setValue(Bytes.toBytes(sn.getAddress().toString())) .build()) .add(builder.clear() .setRow(p.getRow()) .setFamily(getCatalogFamily()) .setQualifier(getStartCodeColumn(replicaId)) .setTimestamp(p.getTimestamp()) .setType(Cell.Type.Put) .setValue(Bytes.toBytes(sn.getStartcode())) .build()) .add(builder.clear() .setRow(p.getRow()) .setFamily(getCatalogFamily()) .setQualifier(getSeqNumColumn(replicaId)) .setTimestamp(p.getTimestamp()) .setType(Type.Put) .setValue(Bytes.toBytes(openSeqNum)) .build()); }
put.add(builder.clear() .setRow(put.getRow()) .setFamily(famAndQf[0])
put.add(builder.clear() .setRow(put.getRow()) .setFamily(famAndQf[0])
@Override public boolean next(List<Cell> result, ScannerContext scannerContext) throws IOException { boolean ret = scanner.next(result, scannerContext); for (int i = 0; i < result.size(); i++) { Cell c = result.get(i); // Replace the Cell if the value is the one we're replacing if (CellUtil.isPut(c) && comparator.compare(CellUtil.cloneValue(c), sourceValue) == 0) { try { cellBuilder.setRow(CellUtil.copyRow(c)); cellBuilder.setFamily(CellUtil.cloneFamily(c)); cellBuilder.setQualifier(CellUtil.cloneQualifier(c)); cellBuilder.setTimestamp(c.getTimestamp()); cellBuilder.setType(Cell.Type.Put); // Make sure each cell gets a unique value byte[] clonedValue = new byte[replacedValue.length]; System.arraycopy(replacedValue, 0, clonedValue, 0, replacedValue.length); cellBuilder.setValue(clonedValue); result.set(i, cellBuilder.build()); } finally { cellBuilder.clear(); } } } return ret; }
public static Put addLocation(Put p, ServerName sn, long openSeqNum, int replicaId) throws IOException { CellBuilder builder = CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY); return p.add(builder.clear() .setRow(p.getRow()) .setFamily(getCatalogFamily()) .setQualifier(getServerColumn(replicaId)) .setTimestamp(p.getTimestamp()) .setType(Cell.Type.Put) .setValue(Bytes.toBytes(sn.getAddress().toString())) .build()) .add(builder.clear() .setRow(p.getRow()) .setFamily(getCatalogFamily()) .setQualifier(getStartCodeColumn(replicaId)) .setTimestamp(p.getTimestamp()) .setType(Cell.Type.Put) .setValue(Bytes.toBytes(sn.getStartcode())) .build()) .add(builder.clear() .setRow(p.getRow()) .setFamily(getCatalogFamily()) .setQualifier(getSeqNumColumn(replicaId)) .setTimestamp(p.getTimestamp()) .setType(Type.Put) .setValue(Bytes.toBytes(openSeqNum)) .build()); }
private static Put addEmptyLocation(Put p, int replicaId) throws IOException { CellBuilder builder = CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY); return p.add(builder.clear() .setRow(p.getRow()) .setFamily(getCatalogFamily()) .setQualifier(getServerColumn(replicaId)) .setTimestamp(p.getTimestamp()) .setType(Type.Put) .build()) .add(builder.clear() .setRow(p.getRow()) .setFamily(getCatalogFamily()) .setQualifier(getStartCodeColumn(replicaId)) .setTimestamp(p.getTimestamp()) .setType(Cell.Type.Put) .build()) .add(builder.clear() .setRow(p.getRow()) .setFamily(getCatalogFamily()) .setQualifier(getSeqNumColumn(replicaId)) .setTimestamp(p.getTimestamp()) .setType(Cell.Type.Put) .build()); }
+ "over the whole column family."); } else { put.add(builder.clear() .setRow(put.getRow()) .setFamily(famAndQf[0])
+ "over the whole column family."); } else { put.add(builder.clear() .setRow(put.getRow()) .setFamily(famAndQf[0])
@Override public OperationStatus[] setAuths(byte[] user, List<byte[]> authLabels) throws IOException { assert labelsRegion != null; OperationStatus[] finalOpStatus = new OperationStatus[authLabels.size()]; Put p = new Put(user); CellBuilder builder = CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY); for (byte[] auth : authLabels) { p.add(builder.clear() .setRow(p.getRow()) .setFamily(LABELS_TABLE_FAMILY) .setQualifier(auth) .setTimestamp(p.getTimestamp()) .setType(Cell.Type.Put) .setValue(DUMMY_VALUE) .build()); } this.labelsRegion.put(p); // This is a testing impl and so not doing any caching for (int i = 0; i < authLabels.size(); i++) { finalOpStatus[i] = new OperationStatus(OperationStatusCode.SUCCESS); } return finalOpStatus; }