Class PartitionUpdateCounterTrackingImpl

  • All Implemented Interfaces:
    Iterable<long[]>, PartitionUpdateCounter

    public class PartitionUpdateCounterTrackingImpl
    extends Object
    implements PartitionUpdateCounter
    Update counter implementation used for cache groups in persistent mode for both tx and atomic caches.

    Implements the partition update counter flow to avoid situations when:

    1. update counter could be incremented and persisted while corresponding update is not recorded to WAL.
    2. update counter could be updated out of order.
    All these situations are sources of partitions desync in case of node failure under load.

    The main idea is to track updates received out-of-order to ensure valid state of the update counter for rebalancing.

    Below a short description of new flow:

    1. Update counter is reserved for each update in partition on tx prepare phase (which always happens on primary partition owner). Reservation causes HWM increment.
    2. Reserved counter values are propagated on backup nodes and stored in backup transactions.
    3. On commit reserved counters are assigned to cache entries.
    4. LWM is incremented ONLY after corresponding WAL data record for each entry was written.
    5. In case of rollback (manual or during tx recovery on node failure) reserved updates are also applied and logged to WAL using RollbackRecord for further recovery purposes.