The contents of the FileSummaryLN are not fixed until the moment at which the LN is added to the log. A base summary object contains the summary last added to the log. A tracked summary object contains live summary info being updated in real time. The tracked summary is added to the base summary just before logging it, and then the tracked summary is reset. This ensures that the logged summary will accurately reflect the totals calculated at the point in the log where the LN is added.
This is all done in the writeToLog method, which operates under the log write latch. All utilization tracking must be done under the log write latch.
In record version 1, obsolete offset tracking was added and multiple records are stored for a single file rather than a single record. Each record contains the offsets that were tracked since the last record was written.
The key is 8 bytes: 4 bytes for the file number followed by 4 bytes for the sequence number. The lowest valued key for a given file contains the most recent summary information, while to get a complete list of obsolete offsets all records for the file must be read. A range search using just the first 4 bytes can be used to find the most recent record -- this is possible because the sequence number values are decreasing over time for a given file. Here are example keys for three summary records in file 1:
(file=1, sequence=Integer.MAX_VALUE - 300) (file=1, sequence=Integer.MAX_VALUE - 200) (file=1, sequence=Integer.MAX_VALUE - 100)
The sequence number is the number of obsolete entries counted so far, subtracted from Integer.MAX_VALUE to cause the latest written record to have the lowest key.
Version 0: Keys are old format strings. No obsolete detail is present.
Version 1: Keys are two 4 byte integers: {file, sequence}. Obsolete detail is present. Some offsets may be invalid if RMW was used.
Version 2: The RMW problem with invalid offsets was corrected. There is no data format change; all versions of JE 2.0.x can read version 1.
@see com.sleepycat.je.cleaner.UtilizationProfile
|
|
|
|
|
|
|
|
|
|