Class 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.
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.