For each primary database managed by a Replication Server, there is a distributor (DIST) thread, which in turn uses SQT to read from the inbound queue and SQM threads to write transactions to the outbound queue. Thus, for example, if there are three primary databases, then there are three inbound queues, three DIST threads, and three SQT threads.
If the only destination for transactions is a standby database, disable the DIST thread, which also disables the SQT thread. The SQM thread is present and responsible for writing to the queue.
In determining the destination of each transaction row, the DIST thread makes calls to the following modules: Subscription Resolution Engine (SRE), Transaction Delivery, and Message Delivery. All DIST threads share these modules. These modules, and the role they play in the replication system, are described in the following sections.
The Subscription Resolution Engine (SRE) matches transaction rows with subscriptions. When it finds a match, it attaches a destination-database ID to each row. It marks only rows required for subscriptions, thereby minimizing network traffic. If no subscriptions match, the DIST thread discards the row data.
For each row, the SRE determines whether subscription migration occurs.
A row migrates into a subscription when its column values change so that the row matches the subscription and must be added to the replicate table.
A row migrates out of a subscription when its column values change so that it no longer matches the subscription and must be deleted from the replicate table.
When the SRE detects subscription migration, it determines which operation to replicate (insert, delete, or update) to maintain consistency between the replicate and primary tables.
The Transaction Delivery (TD) module is called by the DIST thread to package transaction rows for distribution to data servers and other Replication Servers.
The Message Delivery (MD) module is called by the DIST thread to optimize routing of transactions to data servers or other Replication Servers. The DIST thread passes the transaction row and the destination ID to the MD module. Using this information and routing information in the RSSD, the module determines where to send the transaction:
To a data server via a DSI thread, or
To a Replication Server via an RSI thread.
After determining how to send the transaction, the MD module places the transaction into the appropriate outbound queue.