This is the interface for the replication master controller service. The master controller service is booted when this instance of Derby will have the replication master role for this database.
The replication master service is responsible for managing all replication related functionality on the master side of replication. This includes connecting to the slave, setting up a log buffer to temporarily store log records from the LogFactory, and to ship these log records to the slave.
The master controller currently only supports asynchronous
replication. This means that there are no guarantees that
transactions that have committed here (the master side) are also
reflected on the slave side. However, the slave version of the
database IS guaranteed to be transaction consistent. This implies
that:
| Modifier and Type | Field and Description |
|---|---|
| public static final String | ASYNCHRONOUS_MODE
Property value used to indicate that the service should be booted in asynchronous replication mode. |
| public static final String | MODULE
The name of the Master Factory, used to boot the service. |
| public static final String | REPLICATION_MODE
Property key to specify replication mode |
| Modifier and Type | Method and Description |
|---|---|
| public void | appendLog(long
the instant of the log record that was
added last to this chunk of log greatestInstant, byte[] the chunk of log records log, int offset in log to start copy from logOffset, int number of bytes to copy, starting
from logOffset logLength)Append a chunk of log records to the log buffer. |
| public void | flushedTo(long
The highest log instant that has been flushed to
disk instant)Used by the LogFactory to notify the replication master controller that the log records up to this instant have been flushed to disk. |
| public void | |
| public void | startMaster(RawStoreFactory
The RawStoreFactory for the database rawStore, DataFactory The DataFactory for this database dataFac, LogFactory The LogFactory ensuring recoverability for this database logFac, String The hostname for the slave slavehost, int The port the slave is listening on slaveport, String The master database that is being replicated. dbname)Will perform all the work that is needed to set up replication |
| public void | |
| public void |
| ASYNCHRONOUS_MODE | back to summary |
|---|---|
| public static final String ASYNCHRONOUS_MODE Property value used to indicate that the service should be booted in asynchronous replication mode. | |
| MODULE | back to summary |
|---|---|
| public static final String MODULE The name of the Master Factory, used to boot the service. | |
| REPLICATION_MODE | back to summary |
|---|---|
| public static final String REPLICATION_MODE Property key to specify replication mode | |
| appendLog | back to summary |
|---|---|
| public void appendLog(long greatestInstant, byte[] log, int logOffset, int logLength) Append a chunk of log records to the log buffer.
| |
| flushedTo | back to summary |
|---|---|
| public void flushedTo(long instant) Used by the LogFactory to notify the replication master controller that the log records up to this instant have been flushed to disk. The master controller takes action according to the current replication strategy when this method is called. When the asynchronous replication strategy is used, the method does not force log shipping to the slave; the log records may be shipped now or later at the MasterFactory's discretion. However, if another strategy like 2-safe replication is implemented in the future, a call to this method may force log shipment before returning control to the caller. Currently, only asynchronous replication is supported.
| |
| startFailover | back to summary |
|---|---|
| public void startFailover() throws StandardException Will perform all work needed to failover
| |
| startMaster | back to summary |
|---|---|
| public void startMaster(RawStoreFactory rawStore, DataFactory dataFac, LogFactory logFac, String slavehost, int slaveport, String dbname) throws StandardException Will perform all the work that is needed to set up replication
| |
| stopMaster | back to summary |
|---|---|
| public void stopMaster() throws StandardException Will perform all work that is needed to shut down replication.
| |
| workToDo | back to summary |
|---|---|
| public void workToDo() Used to notify the log shipper that a log buffer element is full. | |