public class LocalCBVLSNUpdater extends Object
GlobalCBVLSN.
When the GlobalCBVLSN is not defunct, this class supports updating the group database with each node's local CBVLSN when it is in the Master state. There is one instance per feeder connection, plus one for the Master. There is, logically, a LocalCBVLSNTracker instance associated with each instance of the updater. The instance is local for an update associated with a node in the Master state and is remote for each Replica.
The nodeCBVLSN can only increase during the lifetime of the LocalCBVLSNUpdater instance. Note however that the value of the node's CBVLSN as stored in the database, which represents the values from multiple updaters associated with a node over its lifetime, may both decrease and increase over its lifetime. The decreases are due primarily to rollbacks, and should be relatively rare.
The updaters used to maintain the Replica's local CBVLSNs are stored in the Feeder.InputThread. The lifetime of such a LocalCBVLSNUpdater is therefore determined by the lifetime of the connection between the Master and the Replica. The node CBVLSN is updated each time a heart beat response is processed by the FeederInput thread. It's also updated when an old Master detects that a Replica needs a network restore. In this case, it updates cbvlsn to the value expected from the node after a network restore so that the global CBVLSN can continue to make forward progress and not hold up the cleaner.
The Master maintains an updater for its own CBVLSN in the FeederManager. This updater exists as long as the node retains its Master state.
Local CBVLSNs are used only to contribute to the calculation of the global CBVLSN. The global CBVLSN acts as the cleaner throttle on old nodes. Any invariants, such as the rule that the cleaner throttle cannot regress, are applied when doing the global calculation.
Note that CBVLSNs are not stored in the database for secondary nodes, but transient information about them is still maintained.
| Constructor and Description |
|---|
LocalCBVLSNUpdater(NameIdPair nameIdPair,
NodeType trackedNodeType,
RepNode repNode) |
| Modifier and Type | Method and Description |
|---|---|
static void |
setSuppressGroupDBUpdates(boolean suppressGroupDBUpdates)
Used during testing to suppress CBVLSN updates at this node.
|
void |
update()
If the GlobalCBVLSN is not defunct, update the database, with the local
CBVLSN associated with the node ID if required.
|
void |
updateForMaster(LocalCBVLSNTracker tracker)
If the GlobalCBVLSN is not defunct, as a master, update the database
with the local CBVLSN for this node.
|
void |
updateForReplica(BaseProtocol.HeartbeatResponse heartbeat)
If the GlobalCBVLSN is not defunct, sets the current CBVLSN for this
node.
|
public LocalCBVLSNUpdater(NameIdPair nameIdPair, NodeType trackedNodeType, RepNode repNode)
public void updateForReplica(BaseProtocol.HeartbeatResponse heartbeat)
heartbeat - The incoming heartbeat response message from the
replica containing its newest local cbvlsn.public void updateForMaster(LocalCBVLSNTracker tracker)
public void update()
public static void setSuppressGroupDBUpdates(boolean suppressGroupDBUpdates)
suppressGroupDBUpdates - If true, the group DB and the group CBVLSN
won't be updated at the master.Copyright © 2024. All rights reserved.