com.sleepycat.je.rep.impl.node
Class LocalCBVLSNUpdater

java.lang.Object
  extended by com.sleepycat.je.rep.impl.node.LocalCBVLSNUpdater

public class LocalCBVLSNUpdater
extends Object

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 the 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. Any invariants, such as the rule that the cleaner throttle cannot regress, are applied when doing the global calculation.


Constructor Summary
LocalCBVLSNUpdater(NameIdPair nameIdPair, RepNode repNode)
           
 
Method Summary
(package private)  void doUpdate(VLSN vlsn, String source)
           
(package private) static boolean getSuppressGroupDBUpdates()
           
static void setSuppressGroupDBUpdates(boolean suppressGroupDBUpdates)
          Used during testing to suppress CBVLSN updates at this node.
 void update()
          Update the database, with the local CBVLSN associated with the node ID if required.
(package private)  void updateForMaster(LocalCBVLSNTracker tracker)
          As a master, update the database with the local CBVLSN for this node.
 void updateForReplica(Protocol.HeartbeatResponse heartbeat)
          Sets the current CBVLSN for this node.
 void updateForReplica(VLSN syncableVLSN)
          Exercise caution when using this method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalCBVLSNUpdater

LocalCBVLSNUpdater(NameIdPair nameIdPair,
                   RepNode repNode)
Method Detail

updateForReplica

public void updateForReplica(VLSN syncableVLSN)
Exercise caution when using this method. The normal mode of updating the CBVLSN is via the heartbeat. So, if the CBVLSN is updated through the method, ensure that it supplies an increasing CBCLSN and that its CBVLSN is coordinated with the one supplied by updateForReplica(com.sleepycat.je.rep.stream.Protocol.HeartbeatResponse) . The two methods together, must maintain the invariant that the local CBVLSN value must always be ascending.

Parameters:
syncableVLSN - the new local CBVLSN

updateForReplica

public void updateForReplica(Protocol.HeartbeatResponse heartbeat)
Sets the current CBVLSN for this node. Can only be used by the master. The new cbvlsn value comes from an incoming heartbeat response message.

Parameters:
heartbeat - The incoming heartbeat response message from the replica containing its newest local cbvlsn.

updateForMaster

void updateForMaster(LocalCBVLSNTracker tracker)
As a master, update the database with the local CBVLSN for this node. This call is needed because the master's local CBVLSN will not be broadcast via a heartbeat, so it needs to get to the updater another way.


doUpdate

void doUpdate(VLSN vlsn,
              String source)

update

public void update()
Update the database, with the local CBVLSN associated with the node ID if required. Note that updates can only be invoked on the master


setSuppressGroupDBUpdates

public static void setSuppressGroupDBUpdates(boolean suppressGroupDBUpdates)
Used during testing to suppress CBVLSN updates at this node. Note that the cleaner must also typically be turned off (first) in conjunction with the suppression. If multiple nodes are running in the VM all nodes will have the CBVLSN updates turned off.

Parameters:
suppressGroupDBUpdates - If true, the group DB and the group CBVLSN won't be updated at the master.

getSuppressGroupDBUpdates

static boolean getSuppressGroupDBUpdates()


Copyright (c) 2004-2012 Oracle. All rights reserved.