com.sleepycat.je.rep.impl.node
Class Replica.ConsistencyTracker

java.lang.Object
  extended by com.sleepycat.je.rep.impl.node.Replica.ConsistencyTracker
Enclosing class:
Replica

public class Replica.ConsistencyTracker
extends Object

Tracks the consistency of this replica wrt the Master. It provides the mechanisms that will cause a beginTransaction() or a joinGroup() to wait until the specified consistency policy is satisfied.


Constructor Summary
Replica.ConsistencyTracker()
           
 
Method Summary
 void anyVLSNAwait(long vlsn, ReplicaConsistencyPolicy consistencyPolicy)
          Wait until the log record identified by VLSN has gone by.
(package private)  void close()
           
 void commitVLSNAwait(long vlsn, ReplicaConsistencyPolicy consistencyPolicy)
          Wait until the commit log record identified by VLSN has gone by.
(package private)  void forceTripLatches(DatabaseException exception)
          Frees all the threads that are waiting on latches.
 long getMasterCommitVLSN()
           
 void lagAwait(TimeConsistencyPolicy consistencyPolicy)
           
(package private)  void logStats()
           
(package private)  void reinit(long matchedTxnVLSN, long matchedCommitTime)
          Invoked each time after a replica syncup so that the Replica can re-establish it's consistency vis a vis the master and what part of the replication stream it considers as having been replayed.
 void shutdown()
          Shutdown the consistency tracker.
(package private)  void trackCommit()
           
(package private)  void trackHeartbeat(Protocol.Heartbeat heartbeat)
           
(package private)  void trackVLSN()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Replica.ConsistencyTracker

public Replica.ConsistencyTracker()
Method Detail

reinit

void reinit(long matchedTxnVLSN,
            long matchedCommitTime)
Invoked each time after a replica syncup so that the Replica can re-establish it's consistency vis a vis the master and what part of the replication stream it considers as having been replayed.

Parameters:
matchedTxnVLSN - the replica state corresponds to this txn
matchedCommitTime - the time at which this txn was committed on the master

getMasterCommitVLSN

public long getMasterCommitVLSN()

close

void close()

logStats

void logStats()

forceTripLatches

void forceTripLatches(DatabaseException exception)
Frees all the threads that are waiting on latches.

Parameters:
exception - the exception to be thrown to explain the reason behind the latches being forced.

trackCommit

void trackCommit()

trackVLSN

void trackVLSN()

trackHeartbeat

void trackHeartbeat(Protocol.Heartbeat heartbeat)

lagAwait

public void lagAwait(TimeConsistencyPolicy consistencyPolicy)
              throws InterruptedException,
                     ReplicaConsistencyException,
                     DatabaseException
Throws:
InterruptedException
ReplicaConsistencyException
DatabaseException

commitVLSNAwait

public void commitVLSNAwait(long vlsn,
                            ReplicaConsistencyPolicy consistencyPolicy)
                     throws InterruptedException,
                            ReplicaConsistencyException,
                            DatabaseException
Wait until the commit log record identified by VLSN has gone by.

Throws:
InterruptedException
ReplicaConsistencyException
DatabaseException

anyVLSNAwait

public void anyVLSNAwait(long vlsn,
                         ReplicaConsistencyPolicy consistencyPolicy)
                  throws InterruptedException,
                         ReplicaConsistencyException,
                         DatabaseException
Wait until the log record identified by VLSN has gone by.

Throws:
InterruptedException
ReplicaConsistencyException
DatabaseException

shutdown

public void shutdown()
Shutdown the consistency tracker. This is typically done as part of the shutdown of a replication node. It counts down all open latches, so the threads waiting on them can make progress. It's the responsibility of the waiting threads to check whether the latch countdown was due to a shutdown, and take appropriate action.



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