public class CompactionMap extends Object
SegmentId
instances of the old,
compacted segments.
The data structure used by this class consists of four parts:
recent
map of recently compacted entries is maintained
while the compaction is in progress and new entries need to be added.
These entries are periodically compressed into the more
memory-efficient structure described below.
msbs
and lsbs
arrays store the identifiers
of all old, compacted segments. The identifiers are stored in
increasing order, with the i'th identifier stored in the
msbs[i]
and lsbs[i]
slots. Interpolation search
is used to quickly locate any given identifier.
entryIndex
array is used to to locate these lists within
the larger entry arrays described below. The list of entries for
the i'th identifier consists of entries from entryIndex[i]
(inclusive) to entryIndex[i+1]
(exclusive). An extra
sentinel slot is added at the end of the array to make the above
rule work also for the last compacted segment identifier.
beforeOffsets
,
afterSegmentIds
and afterOffsets
arrays. Once the
list of entries for a given compacted segment is found, the
before record offsets are scanned to find a match. If a match is
found, the corresponding compacted record will be identified by the
respective after segment identifier and offset.
Assuming each compacted segment contains n
compacted records on
average, the amortized size of each entry in this mapping is about
20/n + 8
bytes, assuming compressed pointers.
Modifier and Type | Method and Description |
---|---|
RecordId |
get(RecordId before) |
String |
getCompactionStats() |
long |
getEstimatedWeight() |
long |
getLastMergeWeight() |
boolean |
wasCompacted(UUID id)
Checks whether content in the segment with the given identifier was
compacted to new segments.
|
public boolean wasCompacted(UUID id)
id
- segment identifierpublic String getCompactionStats()
public long getEstimatedWeight()
public long getLastMergeWeight()
"Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"