public static class RangeTombstone.Tracker
extends java.lang.Object
This tracker must be provided all the atoms of a given partition in
order (to the update
method). Given this, it keeps enough
information to be able to decide if one of an atom is deleted (shadowed)
by a previously open RT. One the tracker can prove a given range
tombstone cannot be useful anymore (that is, as soon as we've seen an
atom that is after the end of that RT), it discards this RT. In other
words, the maximum memory used by this object should be proportional to
the maximum number of RT that can be simultaneously open (and this
should fairly low in practice).
Constructor and Description |
---|
Tracker(java.util.Comparator<Composite> comparator)
Creates a new tracker given the table comparator.
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasUnwrittenTombstones() |
boolean |
isDeleted(Cell cell)
Tests if the provided column is deleted by one of the tombstone
tracked by this tracker.
|
boolean |
update(OnDiskAtom atom,
boolean isExpired)
Update this tracker given an
atom . |
long |
writeOpenedMarkers(Composite startPos,
DataOutputPlus out,
OnDiskAtom.SerializerForWriting atomSerializer)
Computes the RangeTombstone that are needed at the beginning of an index
block starting with
firstColumn . |
long |
writeUnwrittenTombstones(DataOutputPlus out,
OnDiskAtom.SerializerForWriting atomSerializer)
Writes out all tombstones that have been accepted after the previous call of this method.
|
int |
writtenAtom()
The total number of atoms written by calls to the above methods.
|
public Tracker(java.util.Comparator<Composite> comparator)
comparator
- the comparator for the table this will track atoms
for. The tracker assumes that atoms will be later provided to the
tracker in comparator
order.public long writeOpenedMarkers(Composite startPos, DataOutputPlus out, OnDiskAtom.SerializerForWriting atomSerializer) throws java.io.IOException
firstColumn
.out
it if isn't null.java.io.IOException
public long writeUnwrittenTombstones(DataOutputPlus out, OnDiskAtom.SerializerForWriting atomSerializer) throws java.io.IOException
java.io.IOException
public int writtenAtom()
public boolean update(OnDiskAtom atom, boolean isExpired)
atom
.
This method first test if some range tombstone can be discarded due to the knowledge of that new atom. Then, if it's a range tombstone, it adds it to the tracker.
Note that this method should be called on *every* atom of a partition for the tracker to work as efficiently as possible (#9486).
public boolean isDeleted(Cell cell)
This method should be called on columns in the same order than for the update()
method. Note that this method does not update the tracker so the update() method
should still be called on column
(it doesn't matter if update is called
before or after this call).
public boolean hasUnwrittenTombstones()
Copyright © 2020 The Apache Software Foundation