1.0

Table Of Contents
Example Compaction Run on page 82
How Compaction Works
When a DML operation is added to a disk store, any preexisting operation record for the same record becomes
obsolete, and SQLFire marks it as garbage. For example, when you update a record, the update operation is
added to the store. If you delete the record later, the delete operation is added and the update operation becomes
garbage. SQLFire does not remove garbage records as it goes, but it tracks the percentage of garbage in each
operation log, and provides mechanisms for removing garbage to compact your log les.
SQLFire compacts an old operation log by copying all non-garbage records into the current log and discarding
the old les. As with logging, oplogs are rolled as needed during compaction to stay within the MAXLOGSIZE
setting.
You can congure the system to automatically compact any closed operation log when its garbage content
reaches a certain percentage. You can also manually request compaction for online and ofine disk stores. For
the online disk store, the current operation log is not available for compaction, no matter how much garbage it
contains.
Online Compaction Diagram
Ofine compaction runs essentially in the same way, but without the incoming DML operations. Also, because
there is no current open log, the compaction creates a new one to get started.
Run Online Compaction
Old log les become eligible for online compaction when their garbage content surpasses a congured percentage
of the total le. A record is garbage when its operation is superseded by a more recent operation for the same
record. During compaction, the non-garbage records are added to the current log along with new DML operations.
Online compaction does not block current system operations.
Run automatic compaction. When AUTOCOMPACT is true, SQLFire automatically compacts each oplog when
its garbage content surpasses the COMPACTIONTHRESHOLD. Automatic compaction takes cycles from your
other operations, so you may want to disable it and only do manual compaction, to control the timing.
Run manual compaction. To run manual compaction:
81
Using Disk Stores to Persist Data