public class CommitLog extends java.lang.Object implements CommitLogMBean
| Modifier and Type | Class and Description |
|---|---|
static class |
CommitLog.Configuration |
| Modifier and Type | Field and Description |
|---|---|
CommitLogArchiver |
archiver |
static CommitLog |
instance |
CommitLogMetrics |
metrics |
AbstractCommitLogSegmentManager |
segmentManager |
| Modifier and Type | Method and Description |
|---|---|
CommitLogPosition |
add(Mutation mutation)
Add a Mutation to the commit log.
|
void |
discardCompletedSegments(TableId id,
CommitLogPosition lowerBound,
CommitLogPosition upperBound)
Modifies the per-CF dirty cursors of any commit log segments for the column family according to the position
given.
|
void |
forceRecycleAllSegments()
Flushes all dirty CFs, waiting for them to free and recycle any segments they were retaining
|
void |
forceRecycleAllSegments(java.lang.Iterable<TableId> droppedTables)
Flushes all dirty CFs, waiting for them to free and recycle any segments they were retaining
|
static long |
freeDiskSpace() |
long |
getActiveContentSize() |
long |
getActiveOnDiskSize() |
java.util.Map<java.lang.String,java.lang.Double> |
getActiveSegmentCompressionRatios() |
java.util.List<java.lang.String> |
getActiveSegmentNames() |
java.lang.String |
getArchiveCommand()
Command to execute to archive a commitlog segment.
|
java.util.List<java.lang.String> |
getArchivingSegmentNames() |
CommitLogPosition |
getCurrentPosition() |
java.lang.String |
getRestoreCommand()
Command to execute to make an archived commitlog live again
|
java.lang.String |
getRestoreDirectories()
Directory to scan the recovery files in
|
long |
getRestorePointInTime()
Restore mutations created up to and including this timestamp in GMT
There are only three different formats to express three time precisions:
Seconds, Milliseconds, and Microseconds.
|
java.lang.String |
getRestorePrecision()
get precision of the timestamp used in the restore (MILLISECONDS, MICROSECONDS, ...)
to determine if passed the restore point in time.
|
java.io.File[] |
getUnmanagedFiles() |
static boolean |
handleCommitError(java.lang.String message,
java.lang.Throwable t) |
boolean |
hasFilesToReplay() |
boolean |
isStarted() |
void |
recover(java.lang.String path)
Perform recovery on a single commit log.
|
int |
recoverFiles(java.io.File... clogs)
Perform recovery on a list of commit log files.
|
void |
recoverPath(java.lang.String path) |
int |
recoverSegmentsOnDisk()
Perform recovery on commit logs located in the directory specified by the config file.
|
void |
requestExtraSync()
Preempts the CLExecutor, telling to to sync immediately
|
void |
resetConfiguration()
FOR TESTING PURPOSES.
|
int |
resetUnsafe(boolean deleteSegments)
FOR TESTING PURPOSES
|
int |
restartUnsafe()
FOR TESTING PURPOSES
|
void |
setCommitlogArchiver(CommitLogArchiver archiver) |
void |
shutdownBlocking()
Shuts down the threads used by the commit log, blocking until completion.
|
CommitLog |
start()
Tries to start the CommitLog if not already started.
|
void |
stopUnsafe(boolean deleteSegments)
FOR TESTING PURPOSES
|
void |
sync(boolean flush)
Forces a disk flush on the commit log files that need it.
|
public static final CommitLog instance
public final AbstractCommitLogSegmentManager segmentManager
public CommitLogArchiver archiver
public final CommitLogMetrics metrics
public CommitLog start()
public boolean isStarted()
public boolean hasFilesToReplay()
public java.io.File[] getUnmanagedFiles()
public int recoverSegmentsOnDisk()
throws java.io.IOException
java.io.IOExceptionpublic int recoverFiles(java.io.File... clogs)
throws java.io.IOException
clogs - the list of commit log files to replayjava.io.IOExceptionpublic void recoverPath(java.lang.String path)
throws java.io.IOException
java.io.IOExceptionpublic void recover(java.lang.String path)
throws java.io.IOException
recover in interface CommitLogMBeanjava.io.IOExceptionpublic CommitLogPosition getCurrentPosition()
>= one returned from add(), implies add() was started
(but not necessarily finished) prior to this callpublic void forceRecycleAllSegments(java.lang.Iterable<TableId> droppedTables)
public void forceRecycleAllSegments()
public void sync(boolean flush)
throws java.io.IOException
java.io.IOExceptionpublic void requestExtraSync()
public CommitLogPosition add(Mutation mutation) throws CDCWriteException
mutation - the Mutation to add to the logCDCWriteExceptionpublic void discardCompletedSegments(TableId id, CommitLogPosition lowerBound, CommitLogPosition upperBound)
id - the table that was flushedlowerBound - the lowest covered replay position of the flushlowerBound - the highest covered replay position of the flushpublic java.lang.String getArchiveCommand()
CommitLogMBeangetArchiveCommand in interface CommitLogMBeanpublic java.lang.String getRestoreCommand()
CommitLogMBeangetRestoreCommand in interface CommitLogMBeanpublic java.lang.String getRestoreDirectories()
CommitLogMBeangetRestoreDirectories in interface CommitLogMBeanpublic long getRestorePointInTime()
CommitLogMBeangetRestorePointInTime in interface CommitLogMBeanpublic java.lang.String getRestorePrecision()
CommitLogMBeangetRestorePrecision in interface CommitLogMBeanpublic void setCommitlogArchiver(CommitLogArchiver archiver)
public java.util.List<java.lang.String> getActiveSegmentNames()
getActiveSegmentNames in interface CommitLogMBeanpublic java.util.List<java.lang.String> getArchivingSegmentNames()
getArchivingSegmentNames in interface CommitLogMBeanpublic long getActiveContentSize()
getActiveContentSize in interface CommitLogMBeanpublic long getActiveOnDiskSize()
getActiveOnDiskSize in interface CommitLogMBeanpublic java.util.Map<java.lang.String,java.lang.Double> getActiveSegmentCompressionRatios()
getActiveSegmentCompressionRatios in interface CommitLogMBeanpublic void shutdownBlocking()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic int resetUnsafe(boolean deleteSegments)
throws java.io.IOException
java.io.IOExceptionpublic void resetConfiguration()
public void stopUnsafe(boolean deleteSegments)
public int restartUnsafe()
throws java.io.IOException
java.io.IOExceptionpublic static long freeDiskSpace()
public static boolean handleCommitError(java.lang.String message,
java.lang.Throwable t)
Copyright © 2009- The Apache Software Foundation