@Override /** * Compares two RPCs. */ public int compare(final BatchableRpc a, final BatchableRpc b) { int d; if ((d = Bytes.memcmp(a.getRegion().name(), b.getRegion().name())) != 0) { return d; } else if ((d = a.code() - b.code()) != 0) { // Sort by code before key. // Note that DeleteRequest.code() < PutRequest.code() and this matters // as the RegionServer processes deletes before puts, and we want to // send RPCs in the same order as they will be processed. return d; } else if ((d = Bytes.memcmp(a.key, b.key)) != 0) { return d; } return Bytes.memcmp(a.family(), b.family()); }
final byte[] family = rpc.family(); final boolean new_key = (new_region || prev.code() != rpc.code() || !Bytes.equals(prev.key, rpc.key) || family == DeleteRequest.WHOLE_ROW); buf.writeByte(rpc.code()); // Code this object. if (prev.code() == PutRequest.CODE) { buf.setInt(nkeys_per_family_index + 4, nbytes_per_family); if (rpc.code() == PutRequest.CODE) { if (prev.code() == PutRequest.CODE) { buf.setInt(nkeys_per_family_index + 4, nbytes_per_family);