public class CommitLog extends java.lang.Object implements CommitLogMBean
Modifier and Type | Field and Description |
---|---|
CommitLogSegmentManager |
allocator |
CommitLogArchiver |
archiver |
static CommitLog |
instance |
Modifier and Type | Method and Description |
---|---|
int |
activeSegments()
Used by tests.
|
ReplayPosition |
add(Mutation mutation)
Add a Mutation to the commit log.
|
void |
discardCompletedSegments(java.util.UUID cfId,
ReplayPosition context)
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<java.util.UUID> droppedCfs)
Flushes all dirty CFs, waiting for them to free and recycle any segments they were retaining
|
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() |
long |
getCompletedTasks()
Get the number of completed tasks
|
ReplayPosition |
getContext() |
long |
getPendingTasks()
Get the number of tasks waiting to be executed
|
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
Format: yyyy:MM:dd HH:mm:ss (2012:04:31 20:43:12)
Recovery will continue through the segment when the first client-supplied
timestamp greater than this time is encountered, but only mutations less than
or equal to this timestamp will be applied.
|
java.lang.String |
getRestorePrecision()
get precision of the timestamp used in the restore (MILLISECONDS, MICROSECONDS, ...)
to determine if passed the restore point in time.
|
long |
getTotalCommitlogSize()
Get the current size used by all the commitlog segments.
|
static boolean |
handleCommitError(java.lang.String message,
java.lang.Throwable t) |
int |
recover()
Perform recovery on commit logs located in the directory specified by the config file.
|
int |
recover(java.io.File... clogs)
Perform recovery on a list of commit log files.
|
void |
recover(java.lang.String path)
Perform recovery on a single commit log.
|
void |
requestExtraSync()
Preempts the CLExecutor, telling to to sync immediately
|
void |
resetUnsafe()
FOR TESTING PURPOSES.
|
void |
shutdownBlocking()
Shuts down the threads used by the commit log, blocking until completion.
|
void |
sync(boolean syncAllSegments)
Forces a disk flush on the commit log files that need it.
|
public static final CommitLog instance
public final CommitLogSegmentManager allocator
public final CommitLogArchiver archiver
public int recover() throws java.io.IOException
java.io.IOException
public int recover(java.io.File... clogs) throws java.io.IOException
clogs
- the list of commit log files to replayjava.io.IOException
public void recover(java.lang.String path) throws java.io.IOException
recover
in interface CommitLogMBean
java.io.IOException
public ReplayPosition getContext()
public void forceRecycleAllSegments(java.lang.Iterable<java.util.UUID> droppedCfs)
public void forceRecycleAllSegments()
public void sync(boolean syncAllSegments)
public void requestExtraSync()
public ReplayPosition add(Mutation mutation)
mutation
- the Mutation to add to the logpublic void discardCompletedSegments(java.util.UUID cfId, ReplayPosition context)
cfId
- the column family ID that was flushedcontext
- the replay position of the flushpublic long getCompletedTasks()
CommitLogMBean
getCompletedTasks
in interface CommitLogMBean
CommitLogMetrics.completedTasks
public long getPendingTasks()
CommitLogMBean
getPendingTasks
in interface CommitLogMBean
CommitLogMetrics.pendingTasks
public long getTotalCommitlogSize()
CommitLogMBean
getTotalCommitlogSize
in interface CommitLogMBean
CommitLogMetrics.totalCommitLogSize
public java.lang.String getArchiveCommand()
CommitLogMBean
getArchiveCommand
in interface CommitLogMBean
public java.lang.String getRestoreCommand()
CommitLogMBean
getRestoreCommand
in interface CommitLogMBean
public java.lang.String getRestoreDirectories()
CommitLogMBean
getRestoreDirectories
in interface CommitLogMBean
public long getRestorePointInTime()
CommitLogMBean
getRestorePointInTime
in interface CommitLogMBean
public java.lang.String getRestorePrecision()
CommitLogMBean
getRestorePrecision
in interface CommitLogMBean
public java.util.List<java.lang.String> getActiveSegmentNames()
getActiveSegmentNames
in interface CommitLogMBean
public java.util.List<java.lang.String> getArchivingSegmentNames()
getArchivingSegmentNames
in interface CommitLogMBean
public void shutdownBlocking() throws java.lang.InterruptedException
java.lang.InterruptedException
public void resetUnsafe()
public int activeSegments()
public static boolean handleCommitError(java.lang.String message, java.lang.Throwable t)
Copyright © 2016 The Apache Software Foundation