Class BinLog
java.lang.Object
org.apache.cassandra.utils.binlog.BinLog
- All Implemented Interfaces:
Runnable
Bin log is a is quick and dirty binary log that is kind of a NIH version of binary logging with a traditional logging
framework. It's goal is good enough performance, predictable footprint, simplicity in terms of implementation and configuration
and most importantly minimal impact on producers of log records.
Performance safety is accomplished by feeding items to the binary log using a weighted queue and dropping records if the binary log falls
sufficiently far behind.
Simplicity and good enough perforamance is achieved by using a single log writing thread as well as Chronicle Queue
to handle writing the log, making it available for readers, as well as log rolling.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic ThrowablecleanDirectory(File directory, Throwable accumulate) voidfinalize()There is a race where we might not release a buffer, going to let finalization catch it since it shouldn't happen to a lot of buffers.voidbooleanOffer a record to the log.voidPut a record into the log.voidrun()voidstop()Stop the consumer thread that writes log records.
-
Field Details
-
path
-
VERSION
- See Also:
-
TYPE
- See Also:
-
-
Method Details
-
getBinLogOptions
-
stop
Stop the consumer thread that writes log records. Can be called multiple times.- Throws:
InterruptedException
-
offer
Offer a record to the log. If the in memory queue is full the record will be dropped and offer will return false.- Parameters:
record- The record to write to the log- Returns:
- true if the record was queued and false otherwise
-
put
Put a record into the log. If the in memory queue is full the putting thread will be blocked until there is space or it is interrupted.- Parameters:
record- The record to write to the log- Throws:
InterruptedException
-
run
public void run() -
finalize
public void finalize()There is a race where we might not release a buffer, going to let finalization catch it since it shouldn't happen to a lot of buffers. Only test code would run into it anyways. -
logRecord
-
cleanDirectory
-