Primary maintenance via request functions

A replicated stored procedure executed in a replicate database is called a request function. It is called a request function because it requests a change in the primary database. You can use request functions to modify primary data without connecting to the primary data server through the WAN.

When you execute a user stored procedure in a replicate database, Replication Server sends the procedure to the primary database where you created the function replication definition.

When you execute the stored procedure, Adaptive Server records the procedure execution in the transaction log so that RepAgent can pass the request to the replication system. A request function is not required to perform any work in the local database, although it may. The real work is done when the primary Replication Server receives the procedure and executes it in the primary database.

In Figure 2-6, the gray arrows show the flow of the request function delivery. The black arrows show the flow of replicated data from the primary database to the replicate database.

Figure 2-6: Modifying primary data with request function delivery

Figure 2-6 illustrates primary data maintenance via request function delivery. Clients at the primary site update primary data directly. Clients at remote sites use request functions to update primary data asynchronously. Replication Server distributes primary updates made by local clients and by request functions initiated at remote sites.

The Replication Server at the replicate site stores request functions in a queue and delivers them to the primary Replication Server as soon as possible. If the primary is not available, the remote Replication Server stores the procedure until the problem is corrected.