org.apache.hadoop.hbase.KeyValue - java examples

Here are the examples of the java api org.apache.hadoop.hbase.KeyValue taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

155 Examples 7

19 View Complete Implementation : MemStore.java
Copyright Apache License 2.0
Author : fengchen8086
private boolean removeFromKVSet(KeyValue e) {
    boolean b = this.kvset.remove(e);
    setOldestEditTimeToNow();
    return b;
}

19 View Complete Implementation : LCCIndexGenerator.java
Copyright Apache License 2.0
Author : fengchen8086
public void processKeyValue(KeyValue kv) throws IOException {
    if (statList != null)
        updateLCRangeStat(kv);
    if (mWinterIsLCCIndexColumn(kv.getQualifier())) {
        mWinterProcessOneKeyValue(kv);
    } else {
        lccQueue.add(kv);
    }
}

19 View Complete Implementation : KeyValueSkipListSet.java
Copyright Apache License 2.0
Author : fengchen8086
public SortedSet<KeyValue> headSet(final KeyValue toElement) {
    return headSet(toElement, false);
}

19 View Complete Implementation : KeyValueSkipListSet.java
Copyright Apache License 2.0
Author : fengchen8086
public NavigableSet<KeyValue> subSet(KeyValue fromElement, boolean fromInclusive, KeyValue toElement, boolean toInclusive) {
    throw new UnsupportedOperationException("Not implemented");
}

19 View Complete Implementation : GetClosestRowBeforeTracker.java
Copyright Apache License 2.0
Author : fengchen8086
boolean isBetterCandidate(final KeyValue contender) {
    return this.candidate == null || (this.kvcomparator.compareRows(this.candidate, contender) < 0 && this.kvcomparator.compareRows(contender, this.targetkey) <= 0);
}

19 View Complete Implementation : KeyValueHeap.java
Copyright Apache License 2.0
Author : fengchen8086
/**
 * Gets the next row of keys from the top-most scanner.
 * <p>
 * This method takes care of updating the heap.
 * <p>
 * This can ONLY be called when you are using Scanners that implement InternalScanner as well as
 * KeyValueScanner (a {@link StoreScanner}).
 * @param result output result list
 * @param limit limit on row count to get
 * @param metric the metric name
 * @return true if there are more keys, false if all scanners are done
 */
public boolean next(List<KeyValue> result, int limit, String metric) throws IOException {
    if (this.current == null) {
        return false;
    }
    InternalScanner currentAsInternal = (InternalScanner) this.current;
    boolean mayContainMoreRows = currentAsInternal.next(result, limit, metric);
    KeyValue pee = this.current.peek();
    /*
     * By definition, any InternalScanner must return false only when it has no further rows to be
     * fetched. So, we can close a scanner if it returns false. All existing implementations seem to
     * be fine with this. It is much more efficient to close scanners which are not needed than keep
     * them in the heap. This is also required for certain optimizations.
     */
    if (pee == null || !mayContainMoreRows) {
        this.current.close();
    } else {
        this.heap.add(this.current);
    }
    this.current = pollRealKV();
    return (this.current != null);
}

19 View Complete Implementation : MemStore.java
Copyright Apache License 2.0
Author : fengchen8086
/**
 * Write an update
 * @param kv
 * @return approximate size of the preplaceded key and value.
 */
long add(final KeyValue kv) {
    KeyValue toAdd = maybeCloneWithAllocator(kv);
    return internalAdd(toAdd);
}

19 View Complete Implementation : Import.java
Copyright Apache License 2.0
Author : fengchen8086
// helper: create a new KeyValue based on CF rename map
private static KeyValue convertKv(KeyValue kv, Map<byte[], byte[]> cfRenameMap) {
    if (cfRenameMap != null) {
        // If there's a rename mapping for this CF, create a new KeyValue
        byte[] newCfName = cfRenameMap.get(kv.getFamily());
        if (newCfName != null) {
            kv = new // row buffer
            KeyValue(// row buffer
            kv.getBuffer(), // row offset
            kv.getRowOffset(), // row length
            kv.getRowLength(), // CF buffer
            newCfName, // CF offset
            0, // CF length
            newCfName.length, // qualifier buffer
            kv.getBuffer(), // qualifier offset
            kv.getQualifierOffset(), // qualifier length
            kv.getQualifierLength(), // timestamp
            kv.getTimestamp(), // KV Type
            KeyValue.Type.codeToType(kv.getType()), // value buffer
            kv.getBuffer(), // value offset
            kv.getValueOffset(), // value length
            kv.getValueLength());
        }
    }
    return kv;
}

19 View Complete Implementation : HLogPerformanceEvaluation.java
Copyright Apache License 2.0
Author : fengchen8086
private void addFamilyMapToWALEdit(Map<byte[], List<KeyValue>> familyMap, WALEdit walEdit) {
    for (List<KeyValue> edits : familyMap.values()) {
        for (KeyValue kv : edits) {
            walEdit.add(kv);
        }
    }
}

19 View Complete Implementation : TestCacheOnWriteInSchema.java
Copyright Apache License 2.0
Author : fengchen8086
private void writeStoreFile(StoreFile.Writer writer) throws IOException {
    final int rowLen = 32;
    for (int i = 0; i < NUM_KV; ++i) {
        byte[] k = TestHFileWriterV2.randomOrderedKey(rand, i);
        byte[] v = TestHFileWriterV2.randomValue(rand);
        int cfLen = rand.nextInt(k.length - rowLen + 1);
        KeyValue kv = new KeyValue(k, 0, rowLen, k, rowLen, cfLen, k, rowLen + cfLen, k.length - rowLen - cfLen, rand.nextLong(), generateKeyType(rand), v, 0, v.length);
        writer.append(kv);
    }
}

19 View Complete Implementation : TestSingleColumnValueFilter.java
Copyright Apache License 2.0
Author : fengchen8086
private void regexFilterTests(Filter filter) throws Exception {
    KeyValue kv = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER, FULLSTRING_1);
    replacedertTrue("regexTrue", filter.filterKeyValue(kv) == Filter.ReturnCode.INCLUDE);
    kv = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER, FULLSTRING_2);
    replacedertTrue("regexFalse", filter.filterKeyValue(kv) == Filter.ReturnCode.INCLUDE);
    replacedertFalse("regexFilterAllRemaining", filter.filterAllRemaining());
    replacedertFalse("regexFilterNotNull", filter.filterRow());
}

19 View Complete Implementation : KeyValueSkipListSet.java
Copyright Apache License 2.0
Author : fengchen8086
public KeyValue higher(KeyValue e) {
    throw new UnsupportedOperationException("Not implemented");
}

19 View Complete Implementation : MemStore.java
Copyright Apache License 2.0
Author : fengchen8086
/*
   * Calculate how the MemStore size has changed.  Includes overhead of the
   * backing Map.
   * @param kv
   * @param notpresent True if the kv was NOT present in the set.
   * @return Size
   */
long heapSizeChange(final KeyValue kv, final boolean notpresent) {
    return notpresent ? ClreplacedSize.align(ClreplacedSize.CONCURRENT_SKIPLISTMAP_ENTRY + kv.heapSize()) : 0;
}

19 View Complete Implementation : RowResultGenerator.java
Copyright Apache License 2.0
Author : fengchen8086
public void putBack(KeyValue kv) {
    this.cache = kv;
}

19 View Complete Implementation : TestSingleColumnValueFilter.java
Copyright Apache License 2.0
Author : fengchen8086
private void basicFilterTests(SingleColumnValueFilter filter) throws Exception {
    KeyValue kv = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER, VAL_2);
    replacedertTrue("basicFilter1", filter.filterKeyValue(kv) == Filter.ReturnCode.INCLUDE);
    kv = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER, VAL_3);
    replacedertTrue("basicFilter2", filter.filterKeyValue(kv) == Filter.ReturnCode.INCLUDE);
    kv = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER, VAL_4);
    replacedertTrue("basicFilter3", filter.filterKeyValue(kv) == Filter.ReturnCode.INCLUDE);
    replacedertFalse("basicFilterNotNull", filter.filterRow());
    filter.reset();
    kv = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER, VAL_1);
    replacedertTrue("basicFilter4", filter.filterKeyValue(kv) == Filter.ReturnCode.NEXT_ROW);
    kv = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER, VAL_2);
    replacedertTrue("basicFilter4", filter.filterKeyValue(kv) == Filter.ReturnCode.NEXT_ROW);
    replacedertFalse("basicFilterAllRemaining", filter.filterAllRemaining());
    replacedertTrue("basicFilterNotNull", filter.filterRow());
    filter.reset();
    filter.setLatestVersionOnly(false);
    kv = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER, VAL_1);
    replacedertTrue("basicFilter5", filter.filterKeyValue(kv) == Filter.ReturnCode.INCLUDE);
    kv = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER, VAL_2);
    replacedertTrue("basicFilter5", filter.filterKeyValue(kv) == Filter.ReturnCode.INCLUDE);
    replacedertFalse("basicFilterNotNull", filter.filterRow());
}

19 View Complete Implementation : StoreIndexScanner.java
Copyright Apache License 2.0
Author : fengchen8086
private boolean shouldStop(KeyValue currentKV) {
    if (stopKV != null && comparator.compare(stopKV, currentKV) <= stopRowCmpValue) {
        return true;
    }
    return false;
}

19 View Complete Implementation : Result.java
Copyright Apache License 2.0
Author : fengchen8086
public static long getWriteArraySize(Result[] results) {
    // RESULT_VERSION
    long size = Bytes.SIZEOF_BYTE;
    if (results == null || results.length == 0) {
        size += Bytes.SIZEOF_INT;
        return size;
    }
    // results.length
    size += Bytes.SIZEOF_INT;
    // bufLen
    size += Bytes.SIZEOF_INT;
    for (Result result : results) {
        // either 0 or result.size()
        size += Bytes.SIZEOF_INT;
        if (result == null || result.isEmpty())
            continue;
        for (KeyValue kv : result.raw()) {
            // kv.getLength();
            size += Bytes.SIZEOF_INT;
            size += kv.getLength();
        }
    }
    return size;
}

19 View Complete Implementation : TestScanner.java
Copyright Apache License 2.0
Author : fengchen8086
private boolean hasColumn(final List<KeyValue> kvs, final byte[] family, final byte[] qualifier) {
    for (KeyValue kv : kvs) {
        if (kv.matchingFamily(family) && kv.matchingQualifier(qualifier)) {
            return true;
        }
    }
    return false;
}

19 View Complete Implementation : TestResult.java
Copyright Apache License 2.0
Author : fengchen8086
/**
 * Verify that Result.compareResults(...) behaves correctly.
 */
public void testCompareResults() throws Exception {
    byte[] value1 = Bytes.toBytes("value1");
    byte[] qual = Bytes.toBytes("qual");
    KeyValue kv1 = new KeyValue(row, family, qual, value);
    KeyValue kv2 = new KeyValue(row, family, qual, value1);
    Result r1 = new Result(new KeyValue[] { kv1 });
    Result r2 = new Result(new KeyValue[] { kv2 });
    // no exception thrown
    Result.compareResults(r1, r1);
    try {
        // these are different (HBASE-4800)
        Result.compareResults(r1, r2);
        fail();
    } catch (Exception x) {
        replacedertTrue(x.getMessage().startsWith("This result was different:"));
    }
}

19 View Complete Implementation : KeyValueSkipListSet.java
Copyright Apache License 2.0
Author : fengchen8086
public SortedSet<KeyValue> tailSet(KeyValue fromElement) {
    return tailSet(fromElement, true);
}

19 View Complete Implementation : TestMultiColumnScanner.java
Copyright Apache License 2.0
Author : fengchen8086
private static boolean matchesQuery(KeyValue kv, Set<String> qualSet, int maxVersions, Map<String, Long> lastDelTimeMap) {
    Long lastDelTS = lastDelTimeMap.get(getRowQualStr(kv));
    long ts = kv.getTimestamp();
    return qualSet.contains(qualStr(kv)) && ts >= TIMESTAMPS[TIMESTAMPS.length - maxVersions] && (lastDelTS == null || ts > lastDelTS);
}

19 View Complete Implementation : GenerateIndexFromIR.java
Copyright Apache License 2.0
Author : fengchen8086
private boolean isIndexColumn(KeyValue kv) {
    return indexMap.containsKey(kv.getQualifier());
}

19 View Complete Implementation : TestColumnPaginationFilter.java
Copyright Apache License 2.0
Author : fengchen8086
/**
 * The more specific functionality tests are contained within the TestFilters clreplaced.  This clreplaced is mainly for testing
 * serialization
 *
 * @param filter
 * @throws Exception
 */
private void basicFilterTests(ColumnPaginationFilter filter) throws Exception {
    KeyValue kv = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER, VAL_1);
    replacedertTrue("basicFilter1", filter.filterKeyValue(kv) == Filter.ReturnCode.INCLUDE_AND_NEXT_COL);
}

19 View Complete Implementation : TestResult.java
Copyright Apache License 2.0
Author : fengchen8086
static KeyValue[] genKVs(final byte[] row, final byte[] family, final byte[] value, final long timestamp, final int cols) {
    KeyValue[] kvs = new KeyValue[cols];
    for (int i = 0; i < cols; i++) {
        kvs[i] = new KeyValue(row, family, Bytes.toBytes(i), timestamp, Bytes.add(value, Bytes.toBytes(i)));
    }
    return kvs;
}

19 View Complete Implementation : MemStore.java
Copyright Apache License 2.0
Author : fengchen8086
/*
   * @param a
   * @param b
   * @return Return lowest of a or b or null if both a and b are null
   */
private KeyValue getLowest(final KeyValue a, final KeyValue b) {
    if (a == null) {
        return b;
    }
    if (b == null) {
        return a;
    }
    return comparator.compareRows(a, b) <= 0 ? a : b;
}

19 View Complete Implementation : MemStore.java
Copyright Apache License 2.0
Author : fengchen8086
/**
 * @param kv Find the row that comes after this one.  If null, we return the
 * first.
 * @return Next row or null if none found.
 */
KeyValue getNextRow(final KeyValue kv) {
    return getLowest(getNextRow(kv, this.kvset), getNextRow(kv, this.snapshot));
}

19 View Complete Implementation : MemStore.java
Copyright Apache License 2.0
Author : fengchen8086
private boolean addToKVSet(KeyValue e) {
    boolean b = this.kvset.add(e);
    setOldestEditTimeToNow();
    return b;
}

19 View Complete Implementation : IndexKeyValue.java
Copyright Apache License 2.0
Author : fengchen8086
// ---------------------------------------------------------------------------
// 
// KeyValue cloning
// 
// ---------------------------------------------------------------------------
/**
 * Clones a KeyValue. This creates a copy, re-allocating the buffer.
 * @return Fully copied clone of this KeyValue
 */
public KeyValue clone() {
    byte[] b = new byte[this.length];
    System.arraycopy(this.bytes, this.offset, b, 0, this.length);
    KeyValue ret = new KeyValue(b, 0, b.length);
    return ret;
}

19 View Complete Implementation : FilterBase.java
Copyright Apache License 2.0
Author : fengchen8086
/**
 * Filters that are not sure which key must be next seeked to, can inherit
 * this implementation that, by default, returns a null KeyValue.
 *
 * @inheritDoc
 */
public KeyValue getNextKeyHint(KeyValue currentKV) {
    return null;
}

19 View Complete Implementation : WALEdit.java
Copyright Apache License 2.0
Author : fengchen8086
public long heapSize() {
    long ret = ClreplacedSize.ARRAYLIST;
    for (KeyValue kv : kvs) {
        ret += kv.heapSize();
    }
    ret += ClreplacedSize.TREEMAP;
    ret += ClreplacedSize.align(scopes.size() * ClreplacedSize.MAP_ENTRY);
    // TODO this isn't quite right, need help here
    return ret;
}

19 View Complete Implementation : KeyValueSkipListSet.java
Copyright Apache License 2.0
Author : fengchen8086
public NavigableSet<KeyValue> headSet(final KeyValue toElement, boolean inclusive) {
    return new KeyValueSkipListSet(this.delegatee.headMap(toElement, inclusive));
}

19 View Complete Implementation : GetClosestRowBeforeTracker.java
Copyright Apache License 2.0
Author : fengchen8086
/*
   * @param kv Adds candidate if nearer the target than previous candidate.
   * @return True if updated candidate.
   */
private boolean addCandidate(final KeyValue kv) {
    if (!isDeleted(kv) && isBetterCandidate(kv)) {
        this.candidate = kv;
        return true;
    }
    return false;
}

19 View Complete Implementation : GenerateIndexFromIR.java
Copyright Apache License 2.0
Author : fengchen8086
private boolean isIndexColumn(KeyValue kv) {
    return indexMap.containsKey(kv.getQualifier());
}

19 View Complete Implementation : KeyValueHeap.java
Copyright Apache License 2.0
Author : fengchen8086
public KeyValue next() throws IOException {
    if (this.current == null) {
        return null;
    }
    KeyValue kvReturn = this.current.next();
    KeyValue kvNext = this.current.peek();
    if (kvNext == null) {
        this.current.close();
        this.current = pollRealKV();
    } else {
        KeyValueScanner topScanner = this.heap.peek();
        // if (topScanner instanceof MemStoreScanner) {
        // System.out.println("winter topScanner is MemStoreScanner, peek value: "
        // + LCCIndexGenerator.mWinterToPrint(topScanner.peek()));
        // }
        if (topScanner == null || this.comparator.compare(kvNext, topScanner.peek()) >= 0) {
            this.heap.add(this.current);
            this.current = pollRealKV();
        }
    }
    return kvReturn;
}

19 View Complete Implementation : NonLazyKeyValueScanner.java
Copyright Apache License 2.0
Author : fengchen8086
public static boolean doRealSeek(KeyValueScanner scanner, KeyValue kv, boolean forward) throws IOException {
    return forward ? scanner.reseek(kv) : scanner.seek(kv);
}

19 View Complete Implementation : Result.java
Copyright Apache License 2.0
Author : fengchen8086
/**
 * Does a deep comparison of two Results, down to the byte arrays.
 * @param res1 first result to compare
 * @param res2 second result to compare
 * @throws Exception Every difference is throwing an exception
 */
public static void compareResults(Result res1, Result res2) throws Exception {
    if (res2 == null) {
        throw new Exception("There wasn't enough rows, we stopped at " + Bytes.toStringBinary(res1.getRow()));
    }
    if (res1.size() != res2.size()) {
        throw new Exception("This row doesn't have the same number of KVs: " + res1.toString() + " compared to " + res2.toString());
    }
    KeyValue[] ourKVs = res1.raw();
    KeyValue[] replicatedKVs = res2.raw();
    for (int i = 0; i < res1.size(); i++) {
        if (!ourKVs[i].equals(replicatedKVs[i]) || !Bytes.equals(ourKVs[i].getValue(), replicatedKVs[i].getValue())) {
            throw new Exception("This result was different: " + res1.toString() + " compared to " + res2.toString());
        }
    }
}

19 View Complete Implementation : ScanQueryMatcher.java
Copyright Apache License 2.0
Author : fengchen8086
public boolean moreRowsMayExistAfter(KeyValue kv) {
    if (!Bytes.equals(stopRow, HConstants.EMPTY_END_ROW) && rowComparator.compareRows(kv.getBuffer(), kv.getRowOffset(), kv.getRowLength(), stopRow, 0, stopRow.length) >= 0) {
        // KV >= STOPROW
        // then NO there is nothing left.
        return false;
    } else {
        return true;
    }
}

19 View Complete Implementation : Result.java
Copyright Apache License 2.0
Author : fengchen8086
/**
 * Checks for existence of the specified column.
 * @param family family name
 * @param qualifier column qualifier
 * @return true if at least one value exists in the result, false if not
 */
public boolean containsColumn(byte[] family, byte[] qualifier) {
    KeyValue kv = getColumnLatest(family, qualifier);
    return kv != null;
}

19 View Complete Implementation : GetClosestRowBeforeTracker.java
Copyright Apache License 2.0
Author : fengchen8086
boolean isTargetTable(final KeyValue kv) {
    if (!metaregion)
        return true;
    // Compare start of keys row.  Compare including delimiter.  Saves having
    // to calculate where tablename ends in the candidate kv.
    return Bytes.compareTo(this.targetkey.getBuffer(), this.rowoffset, this.tablenamePlusDelimiterLength, kv.getBuffer(), kv.getRowOffset(), this.tablenamePlusDelimiterLength) == 0;
}

19 View Complete Implementation : MemStore.java
Copyright Apache License 2.0
Author : fengchen8086
/**
 * Internal version of add() that doesn't clone KVs with the
 * allocator, and doesn't take the lock.
 *
 * Callers should ensure they already have the read lock taken
 */
private long internalAdd(final KeyValue toAdd) {
    long s = heapSizeChange(toAdd, addToKVSet(toAdd));
    timeRangeTracker.includeTimestamp(toAdd);
    this.size.addAndGet(s);
    return s;
}

19 View Complete Implementation : TestScanner.java
Copyright Apache License 2.0
Author : fengchen8086
private KeyValue getColumn(final List<KeyValue> kvs, final byte[] family, final byte[] qualifier) {
    for (KeyValue kv : kvs) {
        if (kv.matchingFamily(family) && kv.matchingQualifier(qualifier)) {
            return kv;
        }
    }
    return null;
}

19 View Complete Implementation : MemStore.java
Copyright Apache License 2.0
Author : fengchen8086
/**
 * Update or insert the specified KeyValues.
 * <p>
 * For each KeyValue, insert into MemStore.  This will atomically upsert the
 * value for that row/family/qualifier.  If a KeyValue did already exist,
 * it will then be removed.
 * <p>
 * Currently the memstoreTS is kept at 0 so as each insert happens, it will
 * be immediately visible.  May want to change this so it is atomic across
 * all KeyValues.
 * <p>
 * This is called under row lock, so Get operations will still see updates
 * atomically.  Scans will only see each KeyValue update as atomic.
 *
 * @param kvs
 * @return change in memstore size
 */
public long upsert(List<KeyValue> kvs) {
    long size = 0;
    for (KeyValue kv : kvs) {
        kv.setMemstoreTS(0);
        size += upsert(kv);
    }
    return size;
}

19 View Complete Implementation : KeyValueSkipListSet.java
Copyright Apache License 2.0
Author : fengchen8086
public boolean add(KeyValue e) {
    return this.delegatee.put(e, e) == null;
}

19 View Complete Implementation : GenerateIndexFromIR.java
Copyright Apache License 2.0
Author : fengchen8086
private static String toPrint(KeyValue kv) {
    String valueStr;
    valueStr = Bytes.toString(kv.getValue());
    return Bytes.toString(kv.getRow()) + "[" + Bytes.toString(kv.getFamily()) + ":" + Bytes.toString(kv.getQualifier()) + "]" + valueStr;
}

19 View Complete Implementation : HTable.java
Copyright Apache License 2.0
Author : fengchen8086
// validate for well-formedness
private void validatePut(final Put put) throws IllegalArgumentException {
    if (put.isEmpty()) {
        throw new IllegalArgumentException("No columns to insert");
    }
    if (maxKeyValueSize > 0) {
        for (List<KeyValue> list : put.getFamilyMap().values()) {
            for (KeyValue kv : list) {
                if (kv.getLength() > maxKeyValueSize) {
                    throw new IllegalArgumentException("KeyValue size too large");
                }
            }
        }
    }
}

19 View Complete Implementation : GetClosestRowBeforeTracker.java
Copyright Apache License 2.0
Author : fengchen8086
/*
   * Handle keys whose values hold deletes.
   * Add to the set of deletes and then if the candidate keys contain any that
   * might match, then check for a match and remove it.  Implies candidates
   * is made with a Comparator that ignores key type.
   * @param kv
   * @return True if we removed <code>k</code> from <code>candidates</code>.
   */
boolean handleDeletes(final KeyValue kv) {
    addDelete(kv);
    boolean deleted = false;
    if (!hasCandidate())
        return deleted;
    if (isDeleted(this.candidate)) {
        this.candidate = null;
        deleted = true;
    }
    return deleted;
}

19 View Complete Implementation : MemStore.java
Copyright Apache License 2.0
Author : fengchen8086
/**
 * Write a delete
 * @param delete
 * @return approximate size of the preplaceded key and value.
 */
long delete(final KeyValue delete) {
    KeyValue toAdd = maybeCloneWithAllocator(delete);
    long s = heapSizeChange(toAdd, addToKVSet(toAdd));
    timeRangeTracker.includeTimestamp(toAdd);
    this.size.addAndGet(s);
    return s;
}

19 View Complete Implementation : ReplicationSource.java
Copyright Apache License 2.0
Author : fengchen8086
/**
 * Count the number of different row keys in the given edit because of
 * mini-batching. We replacedume 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;
}

19 View Complete Implementation : MemStore.java
Copyright Apache License 2.0
Author : fengchen8086
/**
 * Remove n key from the memstore. Only kvs that have the same key and the
 * same memstoreTS are removed.  It is ok to not update timeRangeTracker
 * in this call. It is possible that we can optimize this method by using
 * tailMap/iterator, but since this method is called rarely (only for
 * error recovery), we can leave those optimization for the future.
 * @param kv
 */
void rollback(final KeyValue kv) {
    // If the key is in the snapshot, delete it. We should not update
    // this.size, because that tracks the size of only the memstore and
    // not the snapshot. The flush of this snapshot to disk has not
    // yet started because Store.flush() waits for all rwcc transactions to
    // commit before starting the flush to disk.
    KeyValue found = this.snapshot.get(kv);
    if (found != null && found.getMemstoreTS() == kv.getMemstoreTS()) {
        this.snapshot.remove(kv);
    }
    // If the key is in the memstore, delete it. Update this.size.
    found = this.kvset.get(kv);
    if (found != null && found.getMemstoreTS() == kv.getMemstoreTS()) {
        removeFromKVSet(kv);
        long s = heapSizeChange(kv, true);
        this.size.addAndGet(-s);
    }
}

19 View Complete Implementation : SkipFilter.java
Copyright Apache License 2.0
Author : fengchen8086
public ReturnCode filterKeyValue(KeyValue v) {
    ReturnCode c = filter.filterKeyValue(v);
    changeFR(c != ReturnCode.INCLUDE);
    return c;
}