Documentation of 'org.apache.derby.impl.store.replication.master.MasterController' Java class
MasterController
org.apache.derby.impl.store.replication.master

Class MasterController

  • All Implemented Interfaces:
    ModuleControl, ModuleSupportable, MasterFactory


    public class MasterController
    extends java.lang.Object
    implements MasterFactory, ModuleControl, ModuleSupportable

    This is an implementation of the replication master controller service. The service is booted when this instance of Derby will have the replication master role for this database.

    Note: The current version of the class is far from complete. Code to control the replication master behavior will be added as more parts of the replication functionality is added to Derby.

    See Also:
    MasterFactory
    • Constructor Summary

      Constructors 
      Constructor and Description
      MasterController()
      Empty constructor required by Monitor.bootServiceModule
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void appendLog(long greatestInstant, byte[] log, int logOffset, int logLength)
      Append a chunk of log records to the log buffer.
      void boot(boolean create, java.util.Properties properties)
      Used by Monitor.bootServiceModule to start the service.
      boolean canSupport(java.util.Properties startParams)
      Used by Monitor.bootServiceModule to check if this class is usable for replication.
      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.
      void startFailover()
      Will perform all work needed to failover
      void startMaster(RawStoreFactory rawStore, DataFactory dataFac, LogFactory logFac, java.lang.String slavehost, int slaveport, java.lang.String dbname)
      Will perform all the work that is needed to set up replication.
      void stop()
      Will stop the replication master service.
      void stopMaster()
      Will perform all work that is needed to shut down replication.
      void workToDo()
      Used to notify the log shipper that a log buffer element is full.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MasterController

        public MasterController()
        Empty constructor required by Monitor.bootServiceModule
    • Method Detail

      • boot

        public void boot(boolean create,
                         java.util.Properties properties)
                  throws StandardException
        Used by Monitor.bootServiceModule to start the service. Currently only used to set up the replication mode.
        Specified by:
        boot in interface ModuleControl
        Parameters:
        create - Currently ignored
        properties - Properties used to start the service in the correct mode. Currently initializes only the replicationMode property.
        Throws:
        StandardException - Standard Derby exception policy, thrown on error.
        See Also:
        Monitor, ModuleFactory
      • canSupport

        public boolean canSupport(java.util.Properties startParams)
        Used by Monitor.bootServiceModule to check if this class is usable for replication. To be usable, we require that asynchronous replication is specified in startParams by checking that a property with key MasterFactory.REPLICATION_MODE has the value MasterFactory.ASYNCHRONOUS_MODE.
        Specified by:
        canSupport in interface ModuleSupportable
        Parameters:
        startParams - The properties used to boot replication
        Returns:
        true if asynchronous replication is requested, meaning that this MasterController is a suitable implementation for the MasterFactory service. False otherwise
        See Also:
        ModuleSupportable.canSupport(java.util.Properties)
      • startMaster

        public void startMaster(RawStoreFactory rawStore,
                                DataFactory dataFac,
                                LogFactory logFac,
                                java.lang.String slavehost,
                                int slaveport,
                                java.lang.String dbname)
                         throws StandardException
        Will perform all the work that is needed to set up replication.
        Specified by:
        startMaster in interface MasterFactory
        Parameters:
        rawStore - The RawStoreFactory for the database
        dataFac - The DataFactory for this database
        logFac - The LogFactory ensuring recoverability for this database
        slavehost - The hostname of the slave
        slaveport - The port the slave is listening on
        dbname - The master database that is being replicated.
        Throws:
        StandardException - Standard Derby exception policy, 1) thrown on replication startup error 2) thrown if the master has already been booted. 3) thrown if the specified replication mode is not supported.
      • appendLog

        public void appendLog(long greatestInstant,
                              byte[] log,
                              int logOffset,
                              int logLength)
        Append a chunk of log records to the log buffer. The method is not threadsafe; only one thread should access this method at a time.
        Specified by:
        appendLog in interface MasterFactory
        Parameters:
        greatestInstant - the instant of the log record that was added last to this chunk of log
        log - the chunk of log records
        logOffset - offset in log to start copy from
        logLength - number of bytes to copy, starting from logOffset
      • flushedTo

        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 MasterController'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. Not implemented yet
        Specified by:
        flushedTo in interface MasterFactory
        Parameters:
        instant - The highest log instant that has been flushed to disk
        See Also:
        MasterFactory.flushedTo(long), LogFactory.flush(org.apache.derby.iapi.store.raw.log.LogInstant)
      • workToDo

        public void workToDo()
        Used to notify the log shipper that a log buffer element is full.
        Specified by:
        workToDo in interface MasterFactory

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.