|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.je.dbi.EnvironmentImpl
com.sleepycat.je.rep.impl.RepImpl
public class RepImpl
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.sleepycat.je.dbi.EnvironmentImpl |
---|
EnvironmentImpl.MBeanRegistrar |
Field Summary |
---|
Fields inherited from class com.sleepycat.je.dbi.EnvironmentImpl |
---|
configManager, dbMapTree, envLogger, formatter, IS_DALVIK, needConvert, SAVED_EFE, USE_JAVA5_ADLER32 |
Constructor Summary | |
---|---|
RepImpl(File envHome,
EnvironmentConfig envConfig,
EnvironmentImpl sharedCacheEnv,
RepConfigProxy repConfigProxy)
|
Method Summary | |
---|---|
void |
abnormalClose()
Used by error handling to forcibly close an environment, and by tests to close an environment to simulate a crash. |
boolean |
addDbBackup(DbBackup backup)
For replicated environments only; just return true for a standalone environment. |
void |
addRepConfigObserver(RepEnvConfigObserver o)
|
VLSN |
bumpVLSN()
Generate the next VLSN. |
void |
checkRulesForExistingEnv(boolean dbTreeReplicatedBit)
Check whether this environment can be opened on an existing environment directory. |
ReplicationConfig |
cloneRepConfig()
|
ReplicationMutableConfig |
cloneRepMutableConfig()
|
DatabasePreemptedException |
createDatabasePreemptedException(String msg,
String dbName,
Database db)
For replicated environments only; only the overridden method should ever be called. |
DatabaseImpl |
createGroupDb()
Called when a node has identified itself as the master, which is when the RepNode.selfElect is called. |
LockPreemptedException |
createLockPreemptedException(Locker locker,
Throwable cause)
For replicated environments only; only the overridden method should ever be called. |
LogOverwriteException |
createLogOverwriteException(String msg)
For replicated environments only; only the overridden method should ever be called. |
Txn |
createReplayTxn(long txnId)
Create a ReplayTxn for recovery processing. |
ThreadLocker |
createRepThreadLocker()
Create an appropriate type of ThreadLocker. |
Txn |
createRepUserTxn(TransactionConfig config)
Create an appropriate type of Replicated transaction. |
void |
decrementVLSN()
If the log entry wasn't successfully logged, decrement the VLSN to reclaim the slot. |
void |
doCloseAfterInvalid()
This method must be called while synchronized on DbEnvPool. |
String |
dumpState()
Dump interesting aspects of the node's state. |
boolean |
getAllowConvert()
True if ReplicationConfig set allowConvert as true. |
StateChangeListener |
getChangeListener()
|
long |
getCleanerBarrierStartFile()
Returns the first protected file number. |
static int |
getClockSkewMs()
|
ReplicaConsistencyPolicy |
getDefaultConsistencyPolicy()
|
String |
getDiagnosticsClassName()
|
FeederTxns |
getFeederTxns()
|
DatabaseImpl |
getGroupDb()
Open the group db, which should exist already. |
DatabaseImpl |
getGroupDb(ReplicaConsistencyPolicy policy)
|
Set<InetSocketAddress> |
getHelperSockets()
Returns the set of sockets associated with helper nodes. |
String |
getHostName()
Returns the hostname associated with this node. |
String |
getMonitorClassName()
|
String |
getName()
Get an environment name, for tagging onto logging and debug message. |
NameIdPair |
getNameIdPair()
|
int |
getNodeId()
|
StatGroup |
getNodeStats()
|
int |
getPort()
Returns the port used by the replication node. |
Replay |
getReplay()
|
long |
getReplayTxnTimeout()
|
RepNode |
getRepNode()
|
InetSocketAddress |
getSocket()
|
ReplicatedEnvironment.State |
getState()
Returns the current state associated with this ReplicatedEnvironment |
StateChangeEvent |
getStateChangeEvent()
Returns the state change event that transitioned the ReplicatedEnviroment to its current state. |
ReplicatedEnvironmentStats |
getStats(StatsConfig config)
|
UUID |
getUUID()
|
VLSNIndex |
getVLSNIndex()
|
VLSNRecoveryProxy |
getVLSNProxy()
Used by environment recovery to get a tracker to collect VLSN-LSN mappings that are within the recovery part of the log. |
protected DbConfigManager |
initConfigManager(EnvironmentConfig envConfig,
RepConfigProxy repConfigProxy)
Create a config manager that holds the configuration properties that have been passed in. |
protected Formatter |
initFormatter()
|
void |
invalidateBackups(long fileNumber)
|
boolean |
isDesignatedPrimary()
Returns true, if the node has been designated a Primary. |
boolean |
isMaster()
|
boolean |
isReplicated()
Return true if this environment is part of a replication group. |
ReplicatedEnvironment.State |
joinGroup(ReplicaConsistencyPolicy consistency,
QuorumPolicy initialElectionPolicy)
Wait for this node to join a replication group and return whether it is a MASTER or REPLICA. |
ReplicatedEnvironment |
makeEnvironment()
|
protected void |
postCheckpointClose(boolean checkpointed)
Close any resources that need to be closed after the closing checkpoint. |
void |
postLogAbortHook(MasterTxn txn)
Removes any pending acknowledgments that were registered by the preLogCommitHook. |
void |
postLogCommitHook(MasterTxn txn)
It ensures that the feeder obtains the requisite number of acknowledgments required for a successful commit. |
protected void |
postRecoveryConversion()
Convert user defined databases to replicated after doing recovery. |
void |
preCheckpointEndFlush()
Flush any information that needs to go out at checkpoint. |
void |
preLogCommitHook(MasterTxn txn)
This hook is used primarily to perform the final checks before allowing the commit operation to proceed. |
void |
preRecoveryCheckpointInit(RecoveryInfo recoveryInfo)
The VLSNIndex must be created, merged and flushed before the recovery checkpoint. |
DatabaseImpl |
probeGroupDb()
Open the group db, which should exist already. |
void |
registerVLSN(LogItem logItem)
A replicated log entry has been written on this node. |
void |
removeDbBackup(DbBackup backup)
For replicated environments only; do nothing for a standalone environment. |
void |
repEnvConfigUpdate(RepConfigManager configMgr,
ReplicationMutableConfig newConfig)
Notifies the observer that one or more mutable rep properties have been changed. |
protected DbConfigManager |
resetConfigManager(EnvironmentConfig newConfig)
Make a new config manager that has all the properties needed. |
void |
setBackupProhibited(boolean backupProhibited)
|
void |
setChangeListener(StateChangeListener listener)
|
void |
setHardRecoveryInfo(RollbackException e)
If this node was started with a hard recovery, preserve that information. |
void |
setRepMutableConfig(ReplicationMutableConfig config)
|
static void |
setSkewMs(int skewMs)
Used during testing to introduce artificial clock skews. |
protected void |
setupClose(PrintWriter errors)
Release any resources from a subclass that need to be released before close is called on regular environment components. |
void |
shutdownGroupSetup(long timeoutMs)
Sets up the environment for group shutdown when the environment is closed. |
void |
txnBeginHook(MasterTxn txn)
Ensure that a sufficient number of feeders are available before proceeding with a master transaction begin. |
void |
vlsnHeadTruncate(VLSN lastVLSN,
long deleteFileNum)
Delete from the first VLSN in the range to lastVLSN, inclusive. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RepImpl(File envHome, EnvironmentConfig envConfig, EnvironmentImpl sharedCacheEnv, RepConfigProxy repConfigProxy) throws EnvironmentNotFoundException, EnvironmentLockedException
EnvironmentNotFoundException
EnvironmentLockedException
Method Detail |
---|
protected Formatter initFormatter()
initFormatter
in class EnvironmentImpl
public String getMonitorClassName()
getMonitorClassName
in class EnvironmentImpl
public String getDiagnosticsClassName()
getDiagnosticsClassName
in class EnvironmentImpl
protected DbConfigManager initConfigManager(EnvironmentConfig envConfig, RepConfigProxy repConfigProxy)
EnvironmentImpl
initConfigManager
in class EnvironmentImpl
envConfig
- is the environment configuration to usesuper#initConfigManager
public boolean getAllowConvert()
EnvironmentImpl
getAllowConvert
in class EnvironmentImpl
protected DbConfigManager resetConfigManager(EnvironmentConfig newConfig)
EnvironmentImpl
resetConfigManager
in class EnvironmentImpl
super#resetConfigManager
public ReplicationConfig cloneRepConfig()
public ReplicatedEnvironment makeEnvironment()
public ReplicationMutableConfig cloneRepMutableConfig()
public void setRepMutableConfig(ReplicationMutableConfig config) throws DatabaseException
DatabaseException
public void repEnvConfigUpdate(RepConfigManager configMgr, ReplicationMutableConfig newConfig) throws DatabaseException
RepEnvConfigObserver
repEnvConfigUpdate
in interface RepEnvConfigObserver
DatabaseException
public void addRepConfigObserver(RepEnvConfigObserver o)
public void preRecoveryCheckpointInit(RecoveryInfo recoveryInfo)
preRecoveryCheckpointInit
in class EnvironmentImpl
public ReplicatedEnvironment.State getState()
public StateChangeEvent getStateChangeEvent()
public ReplicatedEnvironment.State joinGroup(ReplicaConsistencyPolicy consistency, QuorumPolicy initialElectionPolicy) throws ReplicaConsistencyException, DatabaseException
ReplicaConsistencyException
DatabaseException
protected void setupClose(PrintWriter errors) throws DatabaseException
EnvironmentImpl
setupClose
in class EnvironmentImpl
DatabaseException
Release all replication resources that can be released before the
checkpoint. Note that any method that creates or clears the repNode
field must be called from a synchronized caller.
Note that the vlsnIndex is closed as a callback, from
postCheckpointPreEnvClose()
protected void postCheckpointClose(boolean checkpointed) throws DatabaseException
postCheckpointClose
in class EnvironmentImpl
checkpointed
- if true, a checkpoint as issued before the close
DatabaseException
protected void postRecoveryConversion() throws DatabaseException
EnvironmentImpl
postRecoveryConversion
in class EnvironmentImpl
DatabaseException
Note: this conversion process will iterator over all user created
databases in the environment, which could be potentially be a costly
affair. However, let's opt for simplicity and defer any optimizations
until we see whether this is an important use case.
public void doCloseAfterInvalid()
EnvironmentImpl
doCloseAfterInvalid
in class EnvironmentImpl
public void abnormalClose() throws DatabaseException
abnormalClose
in class EnvironmentImpl
DatabaseException
public void registerVLSN(LogItem logItem)
registerVLSN
in class EnvironmentImpl
DatabaseException
public VLSN bumpVLSN()
bumpVLSN
in class EnvironmentImpl
public void decrementVLSN()
decrementVLSN
in class EnvironmentImpl
public void preCheckpointEndFlush() throws DatabaseException
preCheckpointEndFlush
in class EnvironmentImpl
DatabaseException
public boolean isMaster()
isMaster
in class EnvironmentImpl
public void setChangeListener(StateChangeListener listener)
public StateChangeListener getChangeListener()
public VLSNIndex getVLSNIndex()
public FeederTxns getFeederTxns()
public ReplicatedEnvironmentStats getStats(StatsConfig config)
public Replay getReplay()
public RepNode getRepNode()
public ThreadLocker createRepThreadLocker()
createRepThreadLocker
in class EnvironmentImpl
public Txn createRepUserTxn(TransactionConfig config) throws DatabaseException
createRepUserTxn
in class EnvironmentImpl
config
- the transaction configuration
DatabaseException
public void txnBeginHook(MasterTxn txn) throws InterruptedException, DatabaseException
txn
- the master transaction being initiated.
InterruptedException
DatabaseException
- if there were insufficient Replicas after the
timeout period.public void preLogCommitHook(MasterTxn txn) throws InsufficientReplicasException, RestartRequiredException, UnknownMasterException, ReplicaWriteException, EnvironmentFailureException
txn
- the master transaction being committed
InsufficientReplicasException
- if the feeder is not in contact
with enough replicas.
RestartRequiredException
- if the environment is invalid.
UnknownMasterException
- if the current master is unknown.
ReplicaWriteException
- if the node transitioned to a Replica
after the transaction was initiated.
EnvironmentFailureException
public void postLogCommitHook(MasterTxn txn) throws InsufficientAcksException, InterruptedException, EnvironmentFailureException
txn
- The MasterTxn that was committed locally.
InterruptedException
- if the thread was interrupted while
waiting for acknowledgments.
InsufficientAcksException
- if the master received an insufficient
number of commit acknowledgments within the replica commit timeout
period.
EnvironmentFailureException
public void postLogAbortHook(MasterTxn txn)
public Txn createReplayTxn(long txnId) throws DatabaseException
createReplayTxn
in class EnvironmentImpl
DatabaseException
- from subclasses.public VLSNRecoveryProxy getVLSNProxy()
getVLSNProxy
in class EnvironmentImpl
public UUID getUUID()
public static void setSkewMs(int skewMs)
public static int getClockSkewMs()
public void vlsnHeadTruncate(VLSN lastVLSN, long deleteFileNum)
vlsnHeadTruncate
in class EnvironmentImpl
lastVLSN
- was cleaned by the cleanerdeleteFileNum
- was the file that was deleted by the cleaner.public int getNodeId()
public NameIdPair getNameIdPair()
public long getReplayTxnTimeout()
getReplayTxnTimeout
in class EnvironmentImpl
public ReplicaConsistencyPolicy getDefaultConsistencyPolicy()
public String getName()
EnvironmentImpl
getName
in class EnvironmentImpl
EnvironmentImpl.getName()
public boolean isReplicated()
isReplicated
in class EnvironmentImpl
public void checkRulesForExistingEnv(boolean dbTreeReplicatedBit) throws UnsupportedOperationException
checkRulesForExistingEnv
in class EnvironmentImpl
UnsupportedOperationException
- via Environment ctor.public String getHostName()
public int getPort()
public InetSocketAddress getSocket()
public Set<InetSocketAddress> getHelperSockets()
public DatabaseImpl createGroupDb() throws DatabaseException
DatabaseException
public long getCleanerBarrierStartFile()
EnvironmentImpl
getCleanerBarrierStartFile
in class EnvironmentImpl
EnvironmentImpl.getCleanerBarrierStartFile()
public DatabaseImpl getGroupDb() throws DatabaseNotFoundException, DatabaseException
DatabaseNotFoundException
DatabaseException
public DatabaseImpl getGroupDb(ReplicaConsistencyPolicy policy) throws DatabaseNotFoundException, DatabaseException
DatabaseNotFoundException
DatabaseException
public DatabaseImpl probeGroupDb() throws DatabaseException
DatabaseException
public boolean isDesignatedPrimary()
public boolean addDbBackup(DbBackup backup)
EnvironmentImpl
addDbBackup
in class EnvironmentImpl
public void removeDbBackup(DbBackup backup)
EnvironmentImpl
removeDbBackup
in class EnvironmentImpl
public void invalidateBackups(long fileNumber)
public void setBackupProhibited(boolean backupProhibited)
public LockPreemptedException createLockPreemptedException(Locker locker, Throwable cause)
EnvironmentImpl
createLockPreemptedException
in class EnvironmentImpl
public DatabasePreemptedException createDatabasePreemptedException(String msg, String dbName, Database db)
EnvironmentImpl
createDatabasePreemptedException
in class EnvironmentImpl
public LogOverwriteException createLogOverwriteException(String msg)
EnvironmentImpl
createLogOverwriteException
in class EnvironmentImpl
public void shutdownGroupSetup(long timeoutMs)
ReplicatedEnvironment.shutdownGroup(long, TimeUnit)
public String dumpState()
public void setHardRecoveryInfo(RollbackException e)
public StatGroup getNodeStats()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |