Package com.mckoi.database
Class MasterTableGarbageCollector
- java.lang.Object
-
- com.mckoi.database.MasterTableGarbageCollector
-
final class MasterTableGarbageCollector extends java.lang.Object
A row garbage collector for a master table data source that manages garbage collection over a MasterTableDataSource object. Each time a row is committed deleted from a master table, this object is notified. When the master table has no root locks on it, then the garbage collector can kick in and mark all deleted rows as reclaimable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
MasterTableGarbageCollector.CollectionEvent
The garbage collection event.
-
Field Summary
Fields Modifier and Type Field Description private MasterTableDataSource
data_source
The MasterTableDataSource that this collector is managing.private BlockIntegerList
deleted_rows
The list of all rows from the master table that we have been notified of being deleted.private boolean
full_sweep_due
If this is true, then a full sweep of the table is due to reclaim all deleted rows from the table.private long
last_garbage_success_event
The time when the last garbage collection event occurred.private long
last_garbage_try_event
-
Constructor Summary
Constructors Constructor Description MasterTableGarbageCollector(MasterTableDataSource data_source)
Constructs the garbage collector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DebugLogger
Debug()
Returns the DebugLogger object that we can use to log debug messages.(package private) void
markFullSweep()
Called by the MasterTableDataSoruce to notify the collector to do a full sweep and remove of records in the table at the next scheduled collection.(package private) void
markRowAsDeleted(int row_index)
Called by the MasterTableDataSoruce to notify the collector that a row has been marked as committed deleted.(package private) void
performCollectionEvent(boolean force)
Performs the actual garbage collection event.
-
-
-
Field Detail
-
data_source
private MasterTableDataSource data_source
The MasterTableDataSource that this collector is managing.
-
full_sweep_due
private boolean full_sweep_due
If this is true, then a full sweep of the table is due to reclaim all deleted rows from the table.
-
deleted_rows
private BlockIntegerList deleted_rows
The list of all rows from the master table that we have been notified of being deleted.NOTE: This list shouldn't get too large. If it does, we should clear it and toggle the 'full_sweep_due' variable to true.
-
last_garbage_success_event
private long last_garbage_success_event
The time when the last garbage collection event occurred.
-
last_garbage_try_event
private long last_garbage_try_event
-
-
Constructor Detail
-
MasterTableGarbageCollector
MasterTableGarbageCollector(MasterTableDataSource data_source)
Constructs the garbage collector.
-
-
Method Detail
-
Debug
public final DebugLogger Debug()
Returns the DebugLogger object that we can use to log debug messages.
-
markRowAsDeleted
void markRowAsDeleted(int row_index)
Called by the MasterTableDataSoruce to notify the collector that a row has been marked as committed deleted.SYNCHRONIZATION: We must be synchronized over 'data_source' when this is called. (This is guarenteed if called from MasterTableDataSource).
-
markFullSweep
void markFullSweep()
Called by the MasterTableDataSoruce to notify the collector to do a full sweep and remove of records in the table at the next scheduled collection.SYNCHRONIZATION: We must be synchronized over 'data_source' when this is called. (This is guarenteed if called from MasterTableDataSource).
-
performCollectionEvent
void performCollectionEvent(boolean force)
Performs the actual garbage collection event. This is called by the CollectionEvent object. Note that it synchronizes over the master table data source object.If 'force' is true, then the collection event is forced even if there are root locks or transaction changes pending. It is only recommended that force is true when the table is shut down.
-
-