public abstract class LogManager
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected EnvironmentImpl |
envImpl |
protected LogBufferPool |
logBufferPool |
protected Latch |
logWriteLatch |
| Constructor and Description |
|---|
LogManager(EnvironmentImpl envImpl,
boolean readOnly)
There is a single log manager per database environment.
|
| Modifier and Type | Method and Description |
|---|---|
abstract void |
countObsoleteDb(DatabaseImpl db) |
(package private) void |
countObsoleteDbInternal(DatabaseImpl db) |
abstract void |
countObsoleteNode(long lsn,
LogEntryType type,
int size,
DatabaseImpl nodeDb,
boolean countExact)
Count node as obsolete under the log write latch.
|
abstract void |
countObsoleteNodeDupsAllowed(long lsn,
LogEntryType type,
int size,
DatabaseImpl nodeDb)
A flavor of countObsoleteNode which does not fire an assert if the
offset has already been counted.
|
(package private) void |
countObsoleteNodeDupsAllowedInternal(long lsn,
LogEntryType type,
int size,
DatabaseImpl nodeDb) |
(package private) void |
countObsoleteNodeInternal(long lsn,
LogEntryType type,
int size,
DatabaseImpl nodeDb,
boolean countExact) |
void |
flush()
Flush all log entries, fsync the log file.
|
(package private) abstract void |
flushInternal(boolean flushRequired) |
void |
flushNoSync()
May be used to avoid sync, for unit tests and for rep syncup.
|
void |
flushWriteNoSync()
Flush all log entries and write to the log but do not fsync.
|
StatGroup |
getBufferPoolLatchStats()
For unit testing.
|
java.nio.ByteBuffer |
getByteBufferFromLog(long lsn)
Return a ByteBuffer holding the log entry at this LSN.
|
boolean |
getChecksumOnRead() |
java.lang.Object |
getEntry(long lsn)
Fault in the first object in the log entry log entry at this LSN.
|
java.lang.Object |
getEntryHandleFileNotFound(long lsn) |
long |
getLastLsnAtRecovery() |
LogEntry |
getLogEntry(long lsn)
Instantiate all the objects in the log entry at this LSN.
|
(package private) LogEntry |
getLogEntryAllowChecksumException(long lsn)
Throws ChecksumException rather than translating it to
EnvironmentFailureException and invalidating the environment.
|
(package private) LogEntry |
getLogEntryAllowChecksumException(long lsn,
java.io.RandomAccessFile file,
int logVersion) |
WholeEntry |
getLogEntryAllowInvisible(long lsn)
Instantiate all the objects in the log entry at this LSN.
|
LogEntry |
getLogEntryAllowInvisibleAtRecovery(long lsn)
Instantiate all the objects in the log entry at this LSN.
|
(package private) WholeEntry |
getLogEntryFromLogSource(long lsn,
LogSource logSource,
boolean invisibleReadAllowed)
Instantiate all the objects in the log entry at this LSN.
|
LogEntry |
getLogEntryHandleFileNotFound(long lsn) |
LogSource |
getLogSource(long lsn)
Find the LSN, whether in a file or still in the log buffers.
|
long |
getNCacheMiss()
Return the current number of cache misses in a lightweight fashion,
without incurring the cost of loading all the stats, and without clearing
any stats.
|
LogBuffer |
getReadBufferByLsn(long lsn)
Return a log buffer locked for reading, or null if no log buffer
holds this LSN location.
|
abstract TrackedFileSummary |
getUnflushableTrackedSummary(long file)
Returns a tracked summary for the given file which will not be flushed.
|
(package private) TrackedFileSummary |
getUnflushableTrackedSummaryInternal(long file) |
abstract void |
loadEndOfLogStat() |
(package private) void |
loadEndOfLogStatInternal() |
StatGroup |
loadStats(StatsConfig config) |
long |
log(LogEntry entry,
boolean isProvisional,
boolean backgroundIO,
long oldNodeLsn,
DatabaseImpl nodeDb,
ReplicationContext repContext)
Write a log entry.
|
long |
log(LogEntry entry,
Provisional provisional,
boolean backgroundIO,
long oldNodeLsn,
DatabaseImpl nodeDb,
ReplicationContext repContext)
Write a log entry.
|
long |
log(LogEntry entry,
ReplicationContext repContext)
Write a log entry.
|
void |
log(LogItem item,
LogContext context)
Convenience method for logging a single entry.
|
long |
logForceFlip(LogEntry entry)
Log this single object and force a flip of the log files.
|
long |
logForceFlush(LogEntry entry,
boolean fsyncRequired,
ReplicationContext repContext)
Log this single object and force a write of the log files.
|
void |
logLazily(LogEntry entry,
ReplicationContext repContext)
Write a log entry lazily.
|
void |
multiLog(LogItem[] itemArray,
LogContext context) |
(package private) java.nio.ByteBuffer |
putIntoBuffer(LogEntry entry,
long prevLogEntryOffset)
Serialize a log entry into this buffer with proper entry header.
|
abstract boolean |
removeDbFileSummaries(DatabaseImpl db,
java.util.Collection<java.lang.Long> fileNums) |
(package private) boolean |
removeDbFileSummariesInternal(DatabaseImpl db,
java.util.Collection<java.lang.Long> fileNums) |
abstract void |
removeTrackedFile(TrackedFileSummary tfs)
Removes the tracked summary for the given file.
|
protected void |
removeTrackedFileInternal(TrackedFileSummary tfs) |
void |
resetPool(DbConfigManager configManager)
Reset the pool when the cache is resized.
|
(package private) abstract void |
serialLog(LogItem[] itemArray,
LogContext context)
Log one or more items while latched or synchronized in order to
serialize log output.
|
(package private) void |
serialLogInternal(LogItem[] itemArray,
LogContext context)
Called within the log write critical section.
|
void |
setDelayVLSNRegisterHook(TestHook<java.lang.Object> hook) |
void |
setFlushLogHook(TestHook<java.util.concurrent.CountDownLatch> hook) |
void |
setLastLsnAtRecovery(long lastLsnAtRecovery) |
void |
setReadHook(TestHook hook) |
abstract void |
transferToUtilizationTracker(LocalUtilizationTracker localTracker) |
(package private) void |
transferToUtilizationTrackerInternal(LocalUtilizationTracker localTracker) |
protected LogBufferPool logBufferPool
protected Latch logWriteLatch
protected EnvironmentImpl envImpl
public LogManager(EnvironmentImpl envImpl, boolean readOnly) throws DatabaseException
DatabaseExceptionpublic boolean getChecksumOnRead()
public long getLastLsnAtRecovery()
public void setLastLsnAtRecovery(long lastLsnAtRecovery)
public void resetPool(DbConfigManager configManager) throws DatabaseException
DatabaseExceptionpublic long logForceFlush(LogEntry entry, boolean fsyncRequired, ReplicationContext repContext) throws DatabaseException
entry - object to be loggedfsyncRequired - if true, log files should also be fsynced.DatabaseExceptionpublic long logForceFlip(LogEntry entry) throws DatabaseException
entry - object to be loggedDatabaseExceptionpublic long log(LogEntry entry, ReplicationContext repContext) throws DatabaseException
entry - object to be loggedDatabaseExceptionpublic void logLazily(LogEntry entry, ReplicationContext repContext)
entry - object to be loggedpublic long log(LogEntry entry, boolean isProvisional, boolean backgroundIO, long oldNodeLsn, DatabaseImpl nodeDb, ReplicationContext repContext) throws DatabaseException
entry - object to be loggedisProvisional - true if this entry should not be read during
recovery.backgroundIO - if true, sleep when the backgroundIOLimit is
exceeded.oldNodeLsn - is the previous version of the node to be counted as
obsolete, or NULL_LSN if the entry is not a node or has no old LSN.nodeDb - database of the node, or null if entry is not a node.DatabaseExceptionpublic long log(LogEntry entry, Provisional provisional, boolean backgroundIO, long oldNodeLsn, DatabaseImpl nodeDb, ReplicationContext repContext) throws DatabaseException
entry - object to be loggedprovisional - whether this entry should be processed during
recovery.backgroundIO - if true, sleep when the backgroundIOLimit is
exceeded.oldNodeLsn - is the previous version of the node to be counted as
obsolete, or NULL_LSN if the entry is not a node or has no old LSN.nodeDb - database of the node, or null if entry is not a node.DatabaseExceptionpublic void log(LogItem item, LogContext context) throws DatabaseException
DatabaseExceptionpublic void multiLog(LogItem[] itemArray, LogContext context) throws DatabaseException
DatabaseExceptionabstract void serialLog(LogItem[] itemArray, LogContext context) throws java.io.IOException, DatabaseException
java.io.IOExceptionDatabaseExceptionvoid serialLogInternal(LogItem[] itemArray, LogContext context) throws java.io.IOException, DatabaseException
java.io.IOExceptionDatabaseExceptionjava.nio.ByteBuffer putIntoBuffer(LogEntry entry, long prevLogEntryOffset)
public LogEntry getLogEntry(long lsn) throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic LogEntry getLogEntryAllowInvisibleAtRecovery(long lsn) throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic WholeEntry getLogEntryAllowInvisible(long lsn) throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic LogEntry getLogEntryHandleFileNotFound(long lsn) throws DatabaseException
DatabaseExceptionLogEntry getLogEntryAllowChecksumException(long lsn) throws ChecksumException, java.io.FileNotFoundException, DatabaseException
ChecksumExceptionjava.io.FileNotFoundExceptionDatabaseExceptionLogEntry getLogEntryAllowChecksumException(long lsn, java.io.RandomAccessFile file, int logVersion) throws ChecksumException, DatabaseException
ChecksumExceptionDatabaseExceptionWholeEntry getLogEntryFromLogSource(long lsn, LogSource logSource, boolean invisibleReadAllowed) throws ChecksumException, DatabaseException
lsn - location of entry in loginvisibleReadAllowed - if true, we will permit the read of invisible
log entries, and we will adjust the invisible bit so that the checksum
will validateChecksumExceptionDatabaseExceptionpublic java.nio.ByteBuffer getByteBufferFromLog(long lsn)
throws DatabaseException
lsn - location of entry in logDatabaseExceptionpublic java.lang.Object getEntry(long lsn)
throws java.io.FileNotFoundException,
DatabaseException
lsn - location of object in logjava.io.FileNotFoundExceptionDatabaseExceptionpublic java.lang.Object getEntryHandleFileNotFound(long lsn)
public LogSource getLogSource(long lsn) throws java.io.FileNotFoundException, ChecksumException, DatabaseException
java.io.FileNotFoundExceptionChecksumExceptionDatabaseExceptionpublic LogBuffer getReadBufferByLsn(long lsn)
public void flush()
throws DatabaseException
DatabaseExceptionpublic void flushNoSync()
throws DatabaseException
DatabaseExceptionpublic void flushWriteNoSync()
throws DatabaseException
DatabaseExceptionabstract void flushInternal(boolean flushRequired)
throws DatabaseException
DatabaseExceptionpublic StatGroup loadStats(StatsConfig config) throws DatabaseException
DatabaseExceptionpublic long getNCacheMiss()
public StatGroup getBufferPoolLatchStats()
public abstract TrackedFileSummary getUnflushableTrackedSummary(long file) throws DatabaseException
DatabaseExceptionTrackedFileSummary getUnflushableTrackedSummaryInternal(long file)
public abstract void removeTrackedFile(TrackedFileSummary tfs) throws DatabaseException
DatabaseExceptionprotected void removeTrackedFileInternal(TrackedFileSummary tfs)
public abstract void countObsoleteNode(long lsn,
LogEntryType type,
int size,
DatabaseImpl nodeDb,
boolean countExact)
throws DatabaseException
DatabaseExceptionvoid countObsoleteNodeInternal(long lsn,
LogEntryType type,
int size,
DatabaseImpl nodeDb,
boolean countExact)
public abstract void countObsoleteNodeDupsAllowed(long lsn,
LogEntryType type,
int size,
DatabaseImpl nodeDb)
throws DatabaseException
DatabaseExceptionvoid countObsoleteNodeDupsAllowedInternal(long lsn,
LogEntryType type,
int size,
DatabaseImpl nodeDb)
public abstract void transferToUtilizationTracker(LocalUtilizationTracker localTracker) throws DatabaseException
void transferToUtilizationTrackerInternal(LocalUtilizationTracker localTracker) throws DatabaseException
DatabaseExceptionpublic abstract void countObsoleteDb(DatabaseImpl db) throws DatabaseException
void countObsoleteDbInternal(DatabaseImpl db)
public abstract boolean removeDbFileSummaries(DatabaseImpl db, java.util.Collection<java.lang.Long> fileNums) throws DatabaseException
DatabaseExceptionboolean removeDbFileSummariesInternal(DatabaseImpl db, java.util.Collection<java.lang.Long> fileNums)
public abstract void loadEndOfLogStat()
throws DatabaseException
DatabaseExceptionvoid loadEndOfLogStatInternal()
public void setReadHook(TestHook hook)
public void setDelayVLSNRegisterHook(TestHook<java.lang.Object> hook)
public void setFlushLogHook(TestHook<java.util.concurrent.CountDownLatch> hook)
Copyright (c) 2004-2012 Oracle. All rights reserved.