Previous Topic

Next Topic

Replicator Components

This section provides an overview of how Ingres Replicator components work together to process a replication from one database to another. This description is intended to provide the background necessary to maintain and troubleshoot Ingres Replicator. It discusses full peer to full peer or full peer to protected read-only configurations, and assumes that there are no collisions.

Ingres Replicator consists of three distinct components that participate in the actual replication of data:

In addition, Ingres Replicator includes a management component—either Visual DBA or the Replicator Manager, plus additional utilities that provide operational support.

Previous Topic

Next Topic

Change Recorder

The Change Recorder is responsible for recording all changes made to base tables registered for replication. The recording process is accomplished internally in the DBMS, which automatically performs work on behalf of the user. The DBMS manipulates support tables to maintain a history of replicated transactions and a queue of transactions that need to be distributed by the distribution threads. This queue is known as the input queue. The data contained in the support tables is also used for collision resolution.

Previous Topic

Next Topic

How the Change Recorder Works

When a user makes a change in a table that has been registered for replication, the Change Recorder function is activated and the following process begins:

  1. A replicated transaction key for that row is generated internally.
  2. The Change Recorder inserts a new row into the shadow table with the replicated transaction key and the key columns of the base table.

    If the change is an insert, the shadow record for this new replicated transaction key contains zeros for the previous replicated transaction key. If the change is an update or delete, the shadow record for this new replicated transaction key contains the replicated transaction key for the previous replication transaction for this row.

  3. In full peer situations, if the change is an update or delete, the Change Recorder inserts the previous replicated transaction key and an image of the row associated with this ID into a new row in the archive table. An indicator is set to reflect that the data for the old replication is now in the archive table instead of the base table.

    In this way the shadow and archive tables provide the sequential history of every replicated row.

  4. The Change Recorder inserts the replicated transaction key into the input queue.

    The input queue contains the information necessary to complete the replication, except the destinations.

The following figure illustrates the tasks of the Change Recorder:

Previous Topic

Next Topic

Distribution Threads

The distribution threads put the destination address on the replication that needs to be propagated. The distribution threads work in parallel to clear the input queue.

The distribution threads work within the DBMS Server to take the information from the input queue and expand it to fully specify what data needs to be replicated to which targets. The expanded information is stored in the distribution queue. The distribution threads do not perform any replication; they merely prepare data for replication by the Replicator Server. However, no data is expanded to the distribution queue if the threads are not configured. There can be a number of threads in each DBMS Server.

Previous Topic

Next Topic

How the Distribution Thread Works

The distribution thread performs the following tasks:

  1. Reads a record from the input queue to obtain the replication information.
  2. Obtains destination information from the propagation paths table.
  3. Inserts a row into the distribution queue for every destination of the replication.

    The number of rows a distribution thread inserts into the distribution queue per replication is equal to the number of targets that you have defined for that replication's Consistent Distributed Data Set (CDDS). Each row contains the information from the input queue plus the destination information.

  4. Deletes the replication's rows from the input queue.
  5. Alerts the Replicator Server associated with the replication's CDDS.

The following figure illustrates the tasks of the distribution thread:

Previous Topic

Next Topic

Replicator Server

The Replicator Server is a stand-alone process that sends changes prepared by the distribution threads to their respective targets. Once the transaction has been transmitted, the replications are secured on the target database and are removed from the distribution queue. The Replicator Server also detects and resolves collisions.

Previous Topic

Next Topic

How the Replicator Server Process Works

After the distribution threads alert it, the Replicator Server completes the following tasks:

  1. The Replicator Server reads the distribution queue.
  2. The Replicator Server propagates each replicated row to the target database using direct SQL or database procedures over Ingres Net.
  3. After propagating a set of rows in an original user transaction by CDDS, the server deletes the corresponding rows from the distribution queue.
  4. The Replicator Server uses two-phase commit to update two databases. For more information, see Two-Phase Commit.

The Replicator Server also performs tasks such as checking the status of its Ingres Net connections. The following figure illustrates the tasks of the Replicator Server:

Previous Topic

Next Topic

How Replication of Data Occurs

Replication of data is carried out by the sequence of tasks performed by the Change Recorder, Distribution Threads, and Replicator Server.

Whenever a database table registered for replication is manipulated, the replication of that table is executed as shown in the following diagram, starting with #1:

The steps in the previous diagram are as follows:

  1. A user updates the local database through the local DBMS Server.
  2. The Change Recorder updates the shadow table.
  3. The Change Recorder updates the archive table.
  4. The Change Recorder adds a row to the input queue.
  5. After a commit, the distribution threads read the input queue and the propagation paths table to determine whether and to where the replication needs distributing.
  6. The distribution threads update the distribution queue with the replication and its destination information.
  7. The distribution threads delete the replication from the input queue.
  8. The distribution threads alert an active Replicator Server.
  9. Replicator Server reads the distribution queue.
  10. Replicator Server updates the remote database using remote SQL or database procedures.
  11. If the remote database is a full peer or protected read-only target, the Replicator Server updates the corresponding shadow table.
  12. If the remote database is a full peer target, the Replicator Server updates the corresponding archive table.
  13. If the remote database is a full per target, a row is added to the remote input queue.
  14. The appropriate row is deleted from the local database's distribution queue.

    The Replicator Server deletes the corresponding rows from the local distribution queue.

  15. The changes at the remote and local databases are secured using two-phase commit.

Previous Topic

Next Topic

How Two-Phase Commit Works

Ingres Replicator uses a two-phase commit protocol to ensure the integrity of the distributed, replicated data. The term two-phase commit refers to the two phases required to commit a distributed transaction where two databases are updated. Unlike Ingres Ingres Star, Ingres Replicator updates only two databases at a time.

Two-phase commit occurs during the last step in the diagram in How Replication of Data Occurs.

Note: The two-phase commit protocols are not used on the target connection; therefore, the transaction is not left in its installation log file.

Two-phase commit during replication involves the following steps:

  1. The Replicator Server sends the replication to a target DBMS server.
  2. The Replicator Server prepares to commit the transaction between the local and the target databases.
  3. If Step 2 is successful, the Replicator Server completes committing the transaction at the target and local databases.

If an interruption occurs during the two-phase commit (for example, a machine or database shutdown), it is possible that a willing-to-commit transaction can be left on the Transaction Log File of the source database. To clear the willing-to-commit transaction, you can restart the Replicator Servers. If this fails to remove the willing-to-commit transaction from the Transaction Log File, you need to use the lartool utility. For more information, see the Command Reference Guide.

Note: Two-phase commit is not available for installations running the Ingres Cluster Solution. For more information, see the appendix "Cluster Support."

Previous Topic

Next Topic

Replicator Management and Monitoring Tools

Management and configuration tasks for Ingres Replicator can be performed using either Visual DBA or the Replicator Manager.

Monitoring tasks for Ingres Replicator can be performed using either Visual DBA or Visual Performance Monitor. As the smaller and simpler tool, Visual Performance Monitor is preferred.

Windows and UNIX:


© 2007 Ingres Corporation. All rights reserved.