public class CompactTask extends Object implements Callable<Journal>
Note: The new Journal
WILL NOT include any historical commit points
other than the one selected by the caller specified commitTime.
Note: If any indices use references to raw records then they MUST define an
IOverflowHandler
in order for the raw records to be copied to the new
store and those references updated in the index to point to the records in
the new store. For example, the BigdataFileSystem
uses such
references and defines an IOverflowHandler
so that the raw file
blocks will not be lost on overflow.
Journal.compact(File)
Modifier and Type | Class and Description |
---|---|
protected class |
CompactTask.CopyIndexTask
Copy an index to the new journal.
|
Modifier and Type | Field and Description |
---|---|
protected ICommitRecord |
commitRecord
The
ICommitRecord corresponding to the caller specified commit
time. |
protected long |
commitTime
The caller specified commit time.
|
protected static boolean |
DEBUG |
protected AtomicInteger |
doneCount |
protected AtomicReference<Throwable> |
firstCause |
protected static boolean |
INFO |
protected static org.apache.log4j.Logger |
log
Logger.
|
protected Journal |
oldJournal
The source
Journal . |
protected File |
outFile
The output
File . |
protected AtomicInteger |
startCount |
Constructor and Description |
---|
CompactTask(Journal src,
File outFile,
long commitTime)
The task reads the state of each named index as of the given
commitTime and writes the index data in order on the output journal.
|
Modifier and Type | Method and Description |
---|---|
Journal |
call()
Compact the
oldJournal journal onto the outFile
file. |
protected void |
copyIndices(Journal newJournal)
Copy all named indices from the
oldJournal to the new
journal. |
protected Journal |
createJournal()
Create the output journal.
|
protected static final org.apache.log4j.Logger log
protected static final boolean INFO
protected static final boolean DEBUG
protected final long commitTime
protected final ICommitRecord commitRecord
ICommitRecord
corresponding to the caller specified commit
time.protected final AtomicReference<Throwable> firstCause
protected final AtomicInteger startCount
protected final AtomicInteger doneCount
public CompactTask(Journal src, File outFile, long commitTime)
Note: Unlike the IndexSegmentBuilder
, this does not produce
a perfect read-optimized index. However, in many cases this task does
significantly improve the locality of reference for the BTree
s
and will discard any deleted data or data which has been
overrwritten.
src
- The source journal.outFile
- The output file.commitTime
- The commit time whose state will be compacted onto the
output file (the first commit point whose commit time is
LTE to the given commit time will be used).public Journal call() throws Exception
oldJournal
journal onto the outFile
file.call
in interface Callable<Journal>
Journal
iff this task succeeds. If
the task fails, then the Journal
(if created) will
have been closed. If you are backing up data, then be sure to
shutdown the returned Journal
so that it can release
its resources.Exception
protected Journal createJournal()
protected void copyIndices(Journal newJournal)
oldJournal
to the new
journal.
Note: This code is similar to that found in the
OverflowManager
.
newJournal
- The new journal.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.