com.sleepycat.je.cleaner
Class FileSummary

java.lang.Object
  extended by com.sleepycat.je.cleaner.FileSummary
All Implemented Interfaces:
Loggable, Cloneable
Direct Known Subclasses:
TrackedFileSummary

public class FileSummary
extends Object
implements Loggable, Cloneable

Per-file utilization counters. The UtilizationProfile stores a persistent map of file number to FileSummary.


Field Summary
 int maxLNSize
           
 int obsoleteINCount
           
 int obsoleteLNCount
           
 int obsoleteLNSize
           
 int obsoleteLNSizeCounted
           
 int totalCount
           
 int totalINCount
           
 int totalINSize
           
 int totalLNCount
           
 int totalLNSize
           
 int totalSize
           
 
Constructor Summary
FileSummary()
          Creates an empty summary.
 
Method Summary
 void add(FileSummary o)
          Add the totals of the given summary object to the totals of this object.
 FileSummary clone()
           
 void dumpLog(StringBuilder buf, boolean verbose)
          Write the object into the string buffer for log dumping.
 float getAvgObsoleteLNSizeNotCounted()
          Returns the average size for LNs with sizes not counted, or NaN if there are no such LNs.
 int getEntriesCounted()
          Returns the total number of entries counted.
 int getLogSize()
           
 int getMaxObsoleteLNSize()
          Returns the maximum possible obsolete LN size, using the maximum LN size for LN sizes that were not counted.
 int getMaxObsoleteSize()
          Returns an estimate of the total bytes that are obsolete, using getMaxObsoleteLNSize instead of getObsoleteLNSize.
 int getNonObsoleteCount()
          Returns the number of non-obsolete LN and IN entries.
 int getObsoleteINSize()
          Returns the approximate byte size of all obsolete IN entries.
 int getObsoleteLNSize()
          Returns the approximate byte size of all obsolete LN entries, using the default average LN size for LN sizes that were not counted.
 int getObsoleteLNSize(float obsoleteLNSizeCorrectionFactor)
          Returns the approximate byte size of all obsolete LN entries, using the given average LN size for LN sizes that were not counted.
 int getObsoleteSize()
          Returns an estimate of the total bytes that are obsolete, using getObsoleteLNSize instead of getMaxObsoleteLNSize.
 int getObsoleteSize(float obsoleteLNSizeCorrectionFactor)
          Returns an estimate of the total bytes that are obsolete, using a given correction factor for LN sizes that were not counted.
 long getTransactionId()
          Never called.
 boolean isEmpty()
          Returns whether this summary contains any non-zero totals.
 boolean logicalEquals(Loggable other)
           
 void readFromLog(ByteBuffer buf, int entryVersion)
          Initialize this object from the data in itemBuf.
 void reset()
          Reset all totals to zero.
 String toString()
           
 int utilization()
          Calculates utilization percentage using average LN sizes.
 int utilization(float obsoleteLNSizeCorrectionFactor)
          Calculates utilization percentage using average LN sizes, using a given correction factor for LN sizes that were not counted.
static int utilization(long obsoleteSize, long totalSize)
          Calculates a utilization percentage.
 void writeToLog(ByteBuffer buf)
          Serialize this object into the buffer.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

totalCount

public int totalCount

totalSize

public int totalSize

totalINCount

public int totalINCount

totalINSize

public int totalINSize

totalLNCount

public int totalLNCount

totalLNSize

public int totalLNSize

maxLNSize

public int maxLNSize

obsoleteINCount

public int obsoleteINCount

obsoleteLNCount

public int obsoleteLNCount

obsoleteLNSize

public int obsoleteLNSize

obsoleteLNSizeCounted

public int obsoleteLNSizeCounted
Constructor Detail

FileSummary

public FileSummary()
Creates an empty summary.

Method Detail

clone

public FileSummary clone()
Overrides:
clone in class Object

isEmpty

public boolean isEmpty()
Returns whether this summary contains any non-zero totals.


getObsoleteLNSize

public int getObsoleteLNSize()
Returns the approximate byte size of all obsolete LN entries, using the default average LN size for LN sizes that were not counted.


getObsoleteLNSize

public int getObsoleteLNSize(float obsoleteLNSizeCorrectionFactor)
Returns the approximate byte size of all obsolete LN entries, using the given average LN size for LN sizes that were not counted.

Parameters:
obsoleteLNSizeCorrectionFactor - is the correction factor to use for uncounted LNs, or NaN to use the default average size calculation.

getAvgObsoleteLNSizeNotCounted

public float getAvgObsoleteLNSizeNotCounted()
Returns the average size for LNs with sizes not counted, or NaN if there are no such LNs. In FileSummaryLN version 3 and greater the obsolete size is normally counted, but not in exceptional circumstances such as recovery. If it is not counted, obsoleteLNSizeCounted will be less than obsoleteLNCount. In log version 8 and greater, we don't count the size when the LN is not resident in cache during update/delete. We added maxLNSize in version 8 for use in estimating obsolete LN sizes. To compute the average LN size, we only consider the LNs (both obsolete and non-obsolete) for which the size has not been counted. This increases accuracy when counted and uncounted LN sizes are not uniform. An example is when large LNs are inserted and deleted. The size of the deleted LN log entry (which is small) is always counted, but the previous version (which has a large size) may not be counted.


getMaxObsoleteLNSize

public int getMaxObsoleteLNSize()
Returns the maximum possible obsolete LN size, using the maximum LN size for LN sizes that were not counted.


getObsoleteINSize

public int getObsoleteINSize()
Returns the approximate byte size of all obsolete IN entries.


getObsoleteSize

public int getObsoleteSize()
Returns an estimate of the total bytes that are obsolete, using getObsoleteLNSize instead of getMaxObsoleteLNSize.


getObsoleteSize

public int getObsoleteSize(float obsoleteLNSizeCorrectionFactor)
Returns an estimate of the total bytes that are obsolete, using a given correction factor for LN sizes that were not counted.


getMaxObsoleteSize

public int getMaxObsoleteSize()
Returns an estimate of the total bytes that are obsolete, using getMaxObsoleteLNSize instead of getObsoleteLNSize.


getEntriesCounted

public int getEntriesCounted()
Returns the total number of entries counted. This value is guaranted to increase whenever the tracking information about a file changes. It is used a key discriminator for FileSummaryLN records.


getNonObsoleteCount

public int getNonObsoleteCount()
Returns the number of non-obsolete LN and IN entries.


utilization

public int utilization()
Calculates utilization percentage using average LN sizes.


utilization

public int utilization(float obsoleteLNSizeCorrectionFactor)
Calculates utilization percentage using average LN sizes, using a given correction factor for LN sizes that were not counted.


utilization

public static int utilization(long obsoleteSize,
                              long totalSize)
Calculates a utilization percentage.


reset

public void reset()
Reset all totals to zero.


add

public void add(FileSummary o)
Add the totals of the given summary object to the totals of this object.


getLogSize

public int getLogSize()
Specified by:
getLogSize in interface Loggable
Returns:
number of bytes used to store this object.
See Also:
Loggable.getLogSize()

writeToLog

public void writeToLog(ByteBuffer buf)
Description copied from interface: Loggable
Serialize this object into the buffer.

Specified by:
writeToLog in interface Loggable
Parameters:
buf - is the destination buffer
See Also:
Loggable.writeToLog(java.nio.ByteBuffer)

readFromLog

public void readFromLog(ByteBuffer buf,
                        int entryVersion)
Description copied from interface: Loggable
Initialize this object from the data in itemBuf.

Specified by:
readFromLog in interface Loggable
See Also:
Loggable.readFromLog(java.nio.ByteBuffer, int)

dumpLog

public void dumpLog(StringBuilder buf,
                    boolean verbose)
Description copied from interface: Loggable
Write the object into the string buffer for log dumping. Each object should be dumped without indentation or new lines and should be valid XML.

Specified by:
dumpLog in interface Loggable
Parameters:
buf - destination string buffer
verbose - if true, dump the full, verbose version
See Also:
Loggable.dumpLog(java.lang.StringBuilder, boolean)

getTransactionId

public long getTransactionId()
Never called.

Specified by:
getTransactionId in interface Loggable
Returns:
the transaction id embedded within this loggable object. Objects that have no transaction id should return 0.
See Also:
Loggable.getTransactionId()

logicalEquals

public boolean logicalEquals(Loggable other)
Specified by:
logicalEquals in interface Loggable
Returns:
true if these two loggable items are logically the same. Used for replication testing.
See Also:
Always return false, this item should never be compared.

toString

public String toString()
Overrides:
toString in class Object


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