public interface SlaveFactory
This is the interface for the replication slave controller service. The slave controller service is booted when this instance of Derby will have the replication slave role for this database.
The replication slave service is responsible for managing all replication related functionality on the slave side of replication. This includes connecting to the master and apply log records received from the master.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MODULE
The name of the Slave Factory, used to boot the service.
|
static java.lang.String |
REPLICATION_MODE
Property key to specify replication mode
|
static java.lang.String |
SLAVE_DB
Property key to specify the name of the database
|
static java.lang.String |
SLAVE_MODE
Property value used to indicate that the service should be
booted in asynchronous replication mode.
|
static java.lang.String |
SLAVE_PRE_MODE
Property value used to indicate that the service should be
booted in slave replication pre mode.
|
Modifier and Type | Method and Description |
---|---|
void |
failover()
Used to turn this slave instance of the database into a normal
instance that clients can connect to, assuming that the
connection with the master is down.
|
boolean |
isStarted()
Check whether or not slave replication mode has been
successfully started.
|
void |
startSlave(RawStoreFactory rawStore,
LogFactory logFac)
Start slave replication.
|
void |
stopSlave(boolean forcedStop)
Stop replication slave mode.
|
static final java.lang.String MODULE
static final java.lang.String SLAVE_DB
static final java.lang.String REPLICATION_MODE
static final java.lang.String SLAVE_MODE
static final java.lang.String SLAVE_PRE_MODE
void startSlave(RawStoreFactory rawStore, LogFactory logFac) throws StandardException
rawStore
- The RawStoreFactory for the databaselogFac
- The LogFactory ensuring recoverability for this databaseStandardException
- Thrown if the slave could not be
started.void stopSlave(boolean forcedStop) throws StandardException
forcedStop
- Determines whether or not an exception should
be thrown when this method is called while the network
connection to the master is up.StandardException
- Thrown if slave is connected with
master and forcedStop is false.void failover() throws StandardException
Used to turn this slave instance of the database into a normal instance that clients can connect to, assuming that the connection with the master is down. This is typically done in cases where a fatal error has happened on the master instance of the database, or when the master database is unreachable due to network problems.
By calling failover, this slave instance of the database will be recovered so that all committed operations that have been received from the master are reflected here. On the other hand, operations from transactions where the commit log record has not been received from the master will not be reflected.
Note that even though an operation has been executed (and even committed) on the master, it is not neccessarily reflected in the slave instance of the database. This depends on the replication strategy used by the MasterFactory.
StandardException
- Thrown if slave is connected with
masterMasterFactory
,
MasterController.flushedTo(long)
boolean isStarted()
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.