Before you implement a no-subscription request function:
Read this appendix to fully understand how to use the no-subscription request function replication with versions earlier than 15.1 to meet your application needs.
Set up a RepAgent for the replicate database from which replicated functions are delivered. See Chapter 4, “Managing a Replication System”and the Replication Server Configuration Guide for details.
Set up the route from a replicate Replication Server to the primary Replication Server. See Chapter 6, “Managing Routes” in the Replication Server Administration Guide Volume 1.
These restrictions apply:
Only the function replication definition created with create function replication definition command can be used as the no-subscription request function replication with versions earlier than 15.1.
If you create a new applied or request function replication definition with create applied function replication definition or create request function replication definition command for a primary function, the no-subscription request function replication for the same primary function will be disabled.
The names of all replication definitions, including function replication definitions, must be unique in the replication system. The function replication definition, created for no-subscription request function must have the same name as the primary function.
To replicate a version of a request stored procedure earlier than 15.1 with a non-unique name, invoke it with a stored procedure that has a unique name and is executed in the replicate database.
For example, the non-unique stored procedure upd_sales may invoke the unique stored procedure upd_salesA or vice versa. Mark upd_salesA for replication using the sp_setrepproc system procedure, and leave upd_sales, the stored procedure that invokes it, unmarked.
Alternatively, you can declare the first parameter of the stored procedure with a non-unique name as @rs_repdef and pass the unique name of the replication definition in this parameter when you run the stored procedure. Do not include the @rs_repdef parameter in the create function replication definition command. This method works only with the RepAgent for Adaptive Server.
Replication Server does not support nested transactions—those containing begin or commit statements—within replicated stored procedures. If the stored procedures with nested stored procedures are marked for replication:
The RepAgent forwards only the outer stored procedure call to the Replication Server.
The RepAgent shuts down.
An error message appears in the Adaptive Server error log.
If the replicated stored procedure contains nested transaction commands, the Replication Server replicates several transactions together, as one group, using only the first begin transaction and the last commit transaction of all the grouped transactions. For more information, see dsi_max_xacts_in_group, in “Connection parameters that affect performance”.
If the replicated stored procedure contains commands like begin transaction, commit transaction, or rollback transaction, errors may result when you run the procedure. For example, a rollback transaction command may roll back to the start of the transaction group, rather than to the nested begin transaction command that was the intended rollback point.
Replicated functions, like Adaptive Server stored procedures, cannot contain parameters with text and image datatypes. See the Adaptive Server Enterprise Reference Manual.
Adaptive Server logs a replicated stored procedure invocation in the database in which the enclosing transaction was started:
If you do not begin a transaction explicitly, Adaptive Server begins one in the user’s current database before the stored procedure is invoked.
If you do not begin the transaction in one database and then run a replicated stored procedure in another database, the execution is still logged in the database where the transaction began.
If a single transaction invokes one or more request functions and executes applied functions or contains data modification language, or a mixed-mode transaction, Replication Server processes the request functions after all the other operations have completed, together in a separate transaction. This can occur if a single Replication Server manages both the primary and replicate data.
Replication Server does not perform translations on parameter values for request functions. However, during function-string mapping, the delimiters defined for the parameter values of their declared datatype are used to generate the SQL statements.
Do not put a commit statement inside a replicated function as this can cause a duplicate key and make Replication Server recovery fail.