com.sleepycat.je.log
Class LogBufferPool

java.lang.Object
  extended by com.sleepycat.je.log.LogBufferPool

 class LogBufferPool
extends Object

LogBufferPool keeps a set of log buffers.


Constructor Summary
LogBufferPool(FileManager fileManager, EnvironmentImpl envImpl)
           
 
Method Summary
 StatGroup getBufferPoolLatchStats()
          For unit testing.
(package private)  int getLogBufferSize()
           
 long getNCacheMiss()
          Return the current nCacheMiss statistic in a lightweight fashion, without perturbing other statistics or requiring synchronization.
(package private)  LogBuffer getReadBufferByLsn(long lsn)
          Find a buffer that contains the given LSN location.
(package private)  LogBuffer getWriteBuffer(int sizeNeeded, boolean flippedFile)
          Get a log buffer for writing sizeNeeded bytes.
(package private)  StatGroup loadStats(StatsConfig config)
           
(package private)  void reset(DbConfigManager configManager)
          Initialize the pool at construction time and when the cache is resized.
(package private)  void writeBufferToFile(int sizeNeeded, boolean flushRequired)
          Write the contents of the currentWriteBuffer to disk.
(package private)  void writeCompleted(long lsn, boolean flushRequired, boolean fsyncRequired)
          A loggable object has been freshly marshalled into the write log buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogBufferPool

LogBufferPool(FileManager fileManager,
              EnvironmentImpl envImpl)
        throws DatabaseException
Throws:
DatabaseException
Method Detail

getLogBufferSize

final int getLogBufferSize()

reset

void reset(DbConfigManager configManager)
     throws DatabaseException
Initialize the pool at construction time and when the cache is resized. This method is called after the memory budget has been calculated.

Throws:
DatabaseException

getWriteBuffer

LogBuffer getWriteBuffer(int sizeNeeded,
                         boolean flippedFile)
                   throws IOException,
                          DatabaseException
Get a log buffer for writing sizeNeeded bytes. If currentWriteBuffer is too small or too full, flush currentWriteBuffer and get a new one. Called within the log write latch.

Returns:
a buffer that can hold sizeNeeded bytes.
Throws:
IOException
DatabaseException

writeBufferToFile

void writeBufferToFile(int sizeNeeded,
                       boolean flushRequired)
                 throws DatabaseException
Write the contents of the currentWriteBuffer to disk. Leave this buffer in memory to be available to would be readers. Set up a new currentWriteBuffer. Assumes the log write latch is held.

Parameters:
sizeNeeded - is the size of the next object we need to write to the log. 0 if this is called on behalf of LogManager.flush() and indicates that a flush is required (i.e. the write() must complete and may not be queued before returning.
flushRequired - true if a write must finish prior to returning from this call (i.e. this is a TxnWriteNoSync call). false if the write may be queued and executed later by placing it in the Write Queue.
Throws:
DatabaseException

writeCompleted

void writeCompleted(long lsn,
                    boolean flushRequired,
                    boolean fsyncRequired)
              throws DatabaseException
A loggable object has been freshly marshalled into the write log buffer. 1. Update buffer so it knows what LSNs it contains. 2. If this object requires a flush, write this buffer out to the backing file. Assumes log write latch is held.

Throws:
DatabaseException

getReadBufferByLsn

LogBuffer getReadBufferByLsn(long lsn)
                       throws DatabaseException
Find a buffer that contains the given LSN location.

Returns:
the buffer that contains the given LSN location, latched and ready to read, or return null.
Throws:
DatabaseException

loadStats

StatGroup loadStats(StatsConfig config)
              throws DatabaseException
Throws:
DatabaseException

getNCacheMiss

public long getNCacheMiss()
Return the current nCacheMiss statistic in a lightweight fashion, without perturbing other statistics or requiring synchronization.


getBufferPoolLatchStats

public StatGroup getBufferPoolLatchStats()
For unit testing.



Copyright (c) 2004-2012 Oracle. All rights reserved.