|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.je.rep.impl.RepGroupDB
public class RepGroupDB
This class is used to encapsulate all access to the rep group data that is present in every replicated JE environment. The rep group data exists primarily to support dynamic group membership. Both read and update access must be done through the APIs provided by this class. The database is simply a representation of the RepGroup. Each entry in the database represents a node in RepGroup; the key is the String node name, and the data is the serialized ReplicationNode. There is a special entry keyed by GROUP_KEY that holds the contents of the RepGroup (excluding the nodes) itself. The database may be modified concurrently by multiple transactions as a master processes requests to update it. It may also be accessed by multiple overlapping transactions as a Replica replays the rep stream. These updates need to be interleaved with operations like getGroup() that create copies of the RepGroup instance. To avoid deadlocks, entries in the database are accessed in order of ascending key. GROUP_KEY in particular is associated with the lowest key value so that it's locked first implicitly as part of any iteration and any other modifications to the database must first lock it before making changes to the group itself. An instance of this class is created as part of a replication node and is retained for the entire lifetime of that node.
Nested Class Summary | |
---|---|
static class |
RepGroupDB.GroupBinding
|
static class |
RepGroupDB.NodeBinding
Supports the serialization/deserialization of node info into and out of the database. |
Field Summary | |
---|---|
static int |
DB_ID
|
RepGroupImpl |
emptyGroup
|
static String |
GROUP_KEY
|
static DatabaseEntry |
groupKeyEntry
|
(package private) static TransactionConfig |
READ_ONLY
|
Constructor Summary | |
---|---|
RepGroupDB(RepImpl repImpl)
Create an instance. |
Method Summary | |
---|---|
void |
addFirstNode()
Ensures that information about this node, the current master is in the member database. |
void |
ensureMember(Protocol.NodeGroupInfo membershipInfo)
Ensures that the membership info for the replica is in the database. |
(package private) void |
ensureMember(RepNodeImpl ensureNode)
|
static RepGroupImpl |
getGroup(File envDir)
An internal API used to obtain group information by opening a stand alone environment handle and reading the RepGroupDB. |
static RepGroupImpl |
getGroup(RepImpl rImpl,
String groupName,
ReplicaConsistencyPolicy policy)
Returns all the members that are currently part of the replication group. |
RepGroupImpl |
getGroup(ReplicaConsistencyPolicy policy)
|
void |
reinitFirstNode(VLSN lastOldVLSN)
Deletes all the current members from the rep group database and creates a new group, with just the member supplied via the configuration. |
void |
removeMember(RepNodeImpl removeNode)
Deletes a node from the replication group by marking it as such in the rep group db. |
boolean |
updateLocalCBVLSN(NameIdPair nameIdPair,
VLSN newCBVLSN)
Updates the database entry associated with the node with the new local CBVLSN, if it can do so without encountering lock contention. |
void |
updateMember(RepNodeImpl node)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final RepGroupImpl emptyGroup
public static final String GROUP_KEY
public static final DatabaseEntry groupKeyEntry
public static final int DB_ID
static final TransactionConfig READ_ONLY
Constructor Detail |
---|
public RepGroupDB(RepImpl repImpl) throws DatabaseException, IOException
IOException
DatabaseException
Method Detail |
---|
public static RepGroupImpl getGroup(RepImpl rImpl, String groupName, ReplicaConsistencyPolicy policy) throws DatabaseException
policy
- determines how current the information must be if it's
invoked on a Replica.
DatabaseException
- if the object could not be obtainedpublic RepGroupImpl getGroup(ReplicaConsistencyPolicy policy) throws DatabaseException
DatabaseException
public void addFirstNode() throws DatabaseException
DatabaseException
public void ensureMember(Protocol.NodeGroupInfo membershipInfo) throws InsufficientReplicasException, InsufficientAcksException, DatabaseException
membershipInfo
- provided by the replica
InsufficientReplicasException
- upon failure of 2p member update
DatabaseException
- when the membership info could not be entered
into the membership database.
InsufficientAcksException
void ensureMember(RepNodeImpl ensureNode) throws DatabaseException
DatabaseException
public void removeMember(RepNodeImpl removeNode)
public void updateMember(RepNodeImpl node) throws InsufficientReplicasException, InsufficientAcksException, DatabaseException
InsufficientReplicasException
InsufficientAcksException
DatabaseException
public boolean updateLocalCBVLSN(NameIdPair nameIdPair, VLSN newCBVLSN) throws DatabaseException
nameIdPair
- identifies the node being updatednewCBVLSN
- the new local CBVLSN to be associated with the node.
DatabaseException
public static RepGroupImpl getGroup(File envDir)
envDir
- the directory containing the environment log files
public void reinitFirstNode(VLSN lastOldVLSN)
DbResetRepGroup
The changes proceed in three steps: 1) Determine the node id sequence number. This is to ensure that rep node ids are not reused. Old rep node ids are present in the logs as commit records. 2) A new group object, with the node id sequence number determined in step 1), is created and all existing nodes are deleted. 3) The first node is added to the rep group.
lastOldVLSN
- the VLSN used to associate the new barrier wrt this
node.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |