Class AbstractCommitLogSegmentManager
- java.lang.Object
-
- org.apache.cassandra.db.commitlog.AbstractCommitLogSegmentManager
-
- Direct Known Subclasses:
CommitLogSegmentManagerCDC,CommitLogSegmentManagerStandard
public abstract class AbstractCommitLogSegmentManager extends java.lang.ObjectPerforms eager-creation of commit log segments in a background thread. All the public methods are thread safe.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract CommitLogSegment.Allocationallocate(Mutation mutation, int size)Allocate a segment within this CLSM.voidawaitManagementTasksCompletion()To be used by tests only.booleanawaitTermination(long timeout, java.util.concurrent.TimeUnit units)Returns when the management thread terminates.protected CommitLogSegmentcreateSegment()Hook to allow segment managers to track state surrounding creation of new segments.java.util.Collection<CommitLogSegment>getActiveSegments()longonDiskSize()voidshutdown()Initiates the shutdown process for the management thread.voidstopUnsafe(boolean deleteSegments)Stops CL, for testing purposes.voidsync(boolean flush)Requests commit log files sync themselves, if needed.
-
-
-
Method Detail
-
allocate
public abstract CommitLogSegment.Allocation allocate(Mutation mutation, int size)
Allocate a segment within this CLSM. Should either succeed or throw.
-
createSegment
protected CommitLogSegment createSegment()
Hook to allow segment managers to track state surrounding creation of new segments. Onl perform as task submit to segment manager so it's performed on segment management thread.
-
onDiskSize
public long onDiskSize()
- Returns:
- the space (in bytes) used by all segment files.
-
stopUnsafe
public void stopUnsafe(boolean deleteSegments)
Stops CL, for testing purposes. DO NOT USE THIS OUTSIDE OF TESTS. Only call this after the AbstractCommitLogService is shut down.
-
awaitManagementTasksCompletion
public void awaitManagementTasksCompletion()
To be used by tests only. Not safe if mutation slots are being allocated concurrently.
-
shutdown
public void shutdown()
Initiates the shutdown process for the management thread.
-
awaitTermination
public boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit units) throws java.lang.InterruptedExceptionReturns when the management thread terminates.- Throws:
java.lang.InterruptedException
-
getActiveSegments
public java.util.Collection<CommitLogSegment> getActiveSegments()
- Returns:
- a read-only collection of the active commit log segments
-
sync
public void sync(boolean flush) throws java.io.IOExceptionRequests commit log files sync themselves, if needed. This may or may not involve flushing to disk.- Parameters:
flush- Request that the sync operation flush the file to disk.- Throws:
java.io.IOException
-
-