public class IntegrityCheck extends Task
A simple integrity checker that traverses all pages within one or more
Tree
s, verifies the internal structure of each page, and verifies the
relationships between the pages. Any inconsistency is noted as a
IntegrityCheck.Fault
.
An application creates an IntegrityCheck
, invokes its
checkVolume(com.persistit.Volume)
or checkTree(com.persistit.Tree)
method to perform the integrity
check, and then reviews the Fault
s available through the
getFaults()
method.
In this version of Persistit, IntegrityCheck
operates reliably
only on quiescent Tree
s; if other threads are modifying a
Tree
while IntegrityCheck
is reviewing its
structure, spurious faults are likely to be detected.
Modifier and Type | Class and Description |
---|---|
static class |
IntegrityCheck.Fault
A representation of an error or inconsistency within a
Tree . |
_culledMessageCount, _description, _expirationTime, _finishTime, _lastException, _maxMessageLogSize, _messageLog, _messageLogVerbosity, _messageWriter, _owner, _persistit, _startTime, _state, _stop, _suspend, _suspendedDuration, _taskId, _thread, DEFAULT_MAX_MESSAGE_LOG_SIZE, LOG_NORMAL, LOG_VERBOSE, STATE_DONE, STATE_ENDED, STATE_EXPIRED, STATE_FAILED, STATE_NAMES, STATE_NOT_STARTED, STATE_RUNNING, STATE_SUSPENDED
Constructor and Description |
---|
IntegrityCheck(Persistit persistit) |
Modifier and Type | Method and Description |
---|---|
boolean |
checkTree(Tree tree)
Performs the integrity checking process on a
Tree . |
boolean |
checkVolume(Volume volume)
Performs the integrity checking process on a
Volume . |
long |
getDataByteCount()
Returns the total count of bytes in use (not page structure overhead) in
data pages traversed during the integrity checking process.
|
long |
getDataPageCount()
Returns the total count of data pages traversed during the integrity
checking process.
|
IntegrityCheck.Fault[] |
getFaults()
Returns the detected faults
|
long |
getGarbagePageCount() |
long |
getIndexByteCount()
Returns the total count of bytes in use (not page structure overhead) in
index pages traversed during the integrity checking process.
|
long |
getIndexHoleCount() |
long |
getIndexPageCount()
Returns the total count of index pages traversed during the integrity
checking process.
|
long |
getLongRecordByteCount()
Returns the total count of bytes in use (not page structure overhead) in
long record pages traversed during the integrity checking process.
|
long |
getLongRecordPageCount()
Returns the total count of long record pages traversed during the
integrity checking process.
|
long |
getMvvAntiValues() |
long |
getMvvCount() |
long |
getMvvOverhead() |
double |
getProgress()
Returns an approximate indication of progress during the integrity
checking process, where 0.0 indicates that work has not started, and 1.0
represents completion.
|
long |
getPrunedPagesCount() |
long |
getPruningErrorCount() |
String |
getStatus()
Returns a displayable String indicating the tree currently being checked
and the relative counts of pages that have been traversed.
|
String |
getStatusDetail()
Returns a String message describing the current state of this
Task , possibly in greater detail than Task.getStatus() . |
boolean |
hasFaults()
Indicates whether fault have been detected
|
static IntegrityCheck |
icheck(String treeSelectorString,
boolean regex,
boolean dontSuspendUpdates,
boolean fixHoles,
boolean prune,
boolean pruneAndClear,
boolean verbose,
boolean csv) |
boolean |
isCsvMode()
Indicate whether CSV mode is enabled.
|
boolean |
isFixHolesEnabled()
Indicate whether missing index pages should be added when an index "hole"
is discovered.
|
boolean |
isPruneEnabled()
Indicate whether pages containing MVV values should be pruned.
|
boolean |
isSuspendUpdates()
Indicate mode of operation.
|
protected void |
runTask()
Called by a newly created
Thread to perform the task. |
void |
setCsvMode(boolean csvMode)
Control output format.
|
void |
setFixHolesEnabled(boolean fixHoles)
Control whether missing index pages should be added when an index "hole"
is discovered.
|
void |
setPruneEnabled(boolean prune)
Control whether
IntegrityCheck should attempt to prune pages
containing MVV values. |
void |
setSuspendUpdates(boolean suspendUpdates)
Control mode of operation.
|
String |
toString()
Returns a displayable summary of the state of the integrity check,
including the number of detected faults, and the page and byte counts.
|
String |
toString(boolean details)
Creates A displayable representation of the state of the integrity check,
including the number of detected faults, and the page and byte counts.
|
appendMessage, cullMessages, endMessage, getMessageLogSize, getMessageLogVerbosity, getMessages, getMessageWriter, getRemainingTime, isImmediate, now, parseTreeList, poll, populateTaskStatus, postMessage, resume, run, setMaximumTime, setMessageLogVerbosity, setMessageWriter, setPersistit, setup, start, stop, suspend
public IntegrityCheck(Persistit persistit)
public static IntegrityCheck icheck(String treeSelectorString, boolean regex, boolean dontSuspendUpdates, boolean fixHoles, boolean prune, boolean pruneAndClear, boolean verbose, boolean csv) throws Exception
Exception
protected void runTask()
Task
Thread
to perform the task.public boolean isSuspendUpdates()
true
then all threads
attempting to perform updates are blocked while the integrity check is in
progress.true
if updates are suspendedpublic void setSuspendUpdates(boolean suspendUpdates)
true
then all threads
attempting to perform updates are blocked while the integrity check is in
progress.suspendUpdates
- true
to suspend updatespublic void setCsvMode(boolean csvMode)
csvMode
- public boolean isCsvMode()
true if CSV mode is enabled.
public boolean isFixHolesEnabled()
true
if IntegrityCheck will attempt to fix holes.public boolean isPruneEnabled()
true
if IntegrityCheck will attempt to prune MVV
values.public void setFixHolesEnabled(boolean fixHoles)
fixHoles
- true
to attempt to fix holespublic void setPruneEnabled(boolean prune)
IntegrityCheck
should attempt to prune pages
containing MVV values.prune
- true
to attempt to prune MVV valuespublic boolean hasFaults()
public IntegrityCheck.Fault[] getFaults()
public long getIndexPageCount()
public long getDataPageCount()
public long getLongRecordPageCount()
public long getIndexByteCount()
public long getDataByteCount()
public long getLongRecordByteCount()
public long getMvvCount()
public long getMvvOverhead()
public long getMvvAntiValues()
public long getIndexHoleCount()
public long getPrunedPagesCount()
public long getPruningErrorCount()
public long getGarbagePageCount()
public double getProgress()
public String getStatusDetail()
Task
Task
, possibly in greater detail than Task.getStatus()
.
The default implementation returns the same description as
getStatus
.getStatusDetail
in class Task
Task
's current state.public String getStatus()
public String toString()
public String toString(boolean details)
details
- If true the returned representation will include a list
of all detected Faults.public boolean checkVolume(Volume volume) throws PersistitException
Volume
. Logs any
detected Faults for subsequent review.volume
- The Volume
to check.PersistitException
public boolean checkTree(Tree tree) throws PersistitException
Tree
. Logs any
detected Faults for subsequent review.tree
- The Tree
to check.PersistitException
Copyright © 2025 Open Identity Platform Community. All rights reserved.