public class LocalCBVLSNTracker extends Object
GlobalCBVLSN.
When GlobalCBVLSN} is not defunct, the LocalCBVLSNTracker tracks this node's local CBVLSN. Each node has a single tracker instance.
The GlobalCBVLSN must be durable. Since the GlobalCBVLSN is derived from the LocalCBVLSN, we need to make the LocalCBVLSN durable too. [#18728]
The local CBVLSN is maintained by each node. Replicas periodically update the Master with their current CBVLSN via a response to a heartbeat message from the Master, where it is managed by the LocalCBVLSNUpdater and flushed out to RepGroup database, whenever the updater notices that it has changed. The change is then effectively broadcast to all the Replicas including the originating Replica, via the replication stream. For this reason, the CBVLSN for the node as represented in the RepGroup database will generally lag the value contained in the tracker.
Note that track() api is invoked in critical code with locks being held and must be lightweight.
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. In addition, we enforce the rule against regressing local CBVLSNs here.
| Constructor and Description |
|---|
LocalCBVLSNTracker(RepNode repNode,
GlobalCBVLSN globalCBVLSN) |
| Modifier and Type | Method and Description |
|---|---|
VLSN |
getBroadcastCBVLSN() |
VLSN |
getLastSyncableVLSN() |
void |
registerMatchpoint(VLSN matchpoint)
If the GlobalVLSN is not defunct, initialize the local CBVLSN with the
syncup matchpoint, so that the heartbeat responses sent before the node
has replayed any log entries are still valid for saving a place in the
replication stream.
|
void |
setAllowUpdate(boolean allowUpdate) |
void |
track(VLSN newVLSN,
long lsn)
If GlobalCBVLSN is defunct, does nothing.
|
public LocalCBVLSNTracker(RepNode repNode, GlobalCBVLSN globalCBVLSN)
public void setAllowUpdate(boolean allowUpdate)
public void track(VLSN newVLSN, long lsn)
If GlobalCBVLSN is defunct, tracks barrier VLSNs, updating the local CBVLSN if the associated log file has changed. When tracking is done on a replica, the currentLocalCBVLSN value is ultimately sent via heartbeat response to the master, which updates the RepGroupDb. When tracking is done on a master, the update is done on this node.
The update is only done once per file in order to decrease the cost of tracking. Since we want the local cbvlsn to be durable, we use the last vlsn in the penultimate log file as the local cbvlsn value. We know the penultimate log file has been fsynced, and therefore the last vlsn within that file has also been fsynced.
Tracking can be called quite often, and should be lightweight.
newVLSN - lsn - public void registerMatchpoint(VLSN matchpoint)
matchpoint - public VLSN getBroadcastCBVLSN()
public VLSN getLastSyncableVLSN()
track(com.sleepycat.je.utilint.VLSN, long).Copyright © 2024. All rights reserved.