org.apache.derby.iapi.store.replication.slave
Interface SlaveFactory

All Known Implementing Classes:
SlaveController

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.


Field Summary
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.
 
Method Summary
 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.
 

Field Detail

MODULE

static final java.lang.String MODULE
The name of the Slave Factory, used to boot the service.

See Also:
Constant Field Values

SLAVE_DB

static final java.lang.String SLAVE_DB
Property key to specify the name of the database

See Also:
Constant Field Values

REPLICATION_MODE

static final java.lang.String REPLICATION_MODE
Property key to specify replication mode

See Also:
Constant Field Values

SLAVE_MODE

static final java.lang.String SLAVE_MODE
Property value used to indicate that the service should be booted in asynchronous replication mode.

See Also:
Constant Field Values

SLAVE_PRE_MODE

static final java.lang.String SLAVE_PRE_MODE
Property value used to indicate that the service should be booted in slave replication pre mode. The reason for having a slave pre mode is that when slave replication is started, we need to boot the database twice: Once to check authentication and authorization, and a second time to put the database in slave mode. It is imperative that the disk image of log files remain unmodified by the first boot since the master and slave log files have to be identical when slave mode starts. Booting in SLAVE_PRE_MODE ensures that the log files remain unmodified.

See Also:
Constant Field Values
Method Detail

startSlave

void startSlave(RawStoreFactory rawStore,
                LogFactory logFac)
                throws StandardException
Start slave replication. This method establishes a network connection with the associated replication master and starts a daemon that applies operations received from the master (in the form of log records) to the local slave database.

Parameters:
rawStore - The RawStoreFactory for the database
logFac - The LogFactory ensuring recoverability for this database
Throws:
StandardException - Thrown if the slave could not be started.

stopSlave

void stopSlave(boolean forcedStop)
               throws StandardException
Stop replication slave mode. Causes the database to abort the boot process, and should only be used when shutting down this database. If forcedStop is false, the method will fail with an exception if connected with the master. If forcedStop is true, the slave will be shut down even if connected to the master. A forcedStop value of true should only be used by system shutdown.

Parameters:
forcedStop - Determines whether or not an exception should be thrown when this method is called while the network connection to the master is up.
Throws:
StandardException - Thrown if slave is connected with master and forcedStop is false.

failover

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.

Throws:
StandardException - Thrown if slave is connected with master
See Also:
MasterFactory, MasterController.flushedTo(long)

isStarted

boolean isStarted()
Check whether or not slave replication mode has been successfully started.

Returns:
true if slave replication mode has started successfully, false if slave mode startup is not yet confirmed

Built on Thu 2012-03-29 21:53:33+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.