/** * Count the number of different row keys in the given edit because of * mini-batching. We assume that there's at least one KV in the WALEdit. * @param edit edit to count row keys from * @return number of different row keys */ private int countDistinctRowKeys(WALEdit edit) { List<KeyValue> kvs = edit.getKeyValues(); int distinctRowKeys = 1; KeyValue lastKV = kvs.get(0); for (int i = 0; i < edit.size(); i++) { if (!kvs.get(i).matchingRow(lastKV)) { distinctRowKeys++; } } return distinctRowKeys; }
/** * Count the number of different row keys in the given edit because of mini-batching. We assume * that there's at least one Cell in the WALEdit. * @param edit edit to count row keys from * @return number of different row keys */ private int countDistinctRowKeys(WALEdit edit) { List<Cell> cells = edit.getCells(); int distinctRowKeys = 1; Cell lastCell = cells.get(0); for (int i = 0; i < edit.size(); i++) { if (!CellUtil.matchingRow(cells.get(i), lastCell)) { distinctRowKeys++; } } return distinctRowKeys; }
/** * We only want KVs that are scoped other than local * @param edit The KV to check for replication */ protected void removeNonReplicableEdits(WALEdit edit) { NavigableMap<byte[], Integer> scopes = edit.getScopes(); List<KeyValue> kvs = edit.getKeyValues(); for (int i = edit.size()-1; i >= 0; i--) { KeyValue kv = kvs.get(i); // The scope will be null or empty if // there's nothing to replicate in that WALEdit if (scopes == null || !scopes.containsKey(kv.getFamily())) { kvs.remove(i); } } }
@Override public void append(Entry entry) throws IOException { entry.setCompressionContext(compressionContext); entry.getKey().getBuilder(compressor). setFollowingKvCount(entry.getEdit().size()).build().writeDelimitedTo(output); for (Cell cell : entry.getEdit().getCells()) { // cellEncoder must assume little about the stream, since we write PB and cells in turn. cellEncoder.write(cell); } }
edit.size() != 0 && replicating.get()) {
intervalEdits += val.size(); if (intervalEdits >= interval) {
if (edit != null && edit.size() != 0) {
if (walEdit.size() > 0) { syncOrDefer(txid);
intervalEdits += val.size(); if (intervalEdits >= interval) {