Try OpenEdge Now
skip to main content
New Information
OpenEdge Replication : Transition End Trigger
 

Transition End Trigger

OpenEdge Replication supports a post-transition trigger. The transition end trigger is a user-created script that is configured to run at the end of transition. Executing a transition end trigger gives the database administrator the opportunity to insert additional instructions at a controlled point in the transition, such as directing applications to re-connect to a new source database. The trigger is supported by fail-over transition, when a source and target switch roles, and recovery transition, when a source fails and a target transitions to be the source for the other target.

Configuring transition trigger

The transition end trigger is configurable. You can add the transition end trigger property to the properties file of the source, target(s), or both. Indicate that you want the transition end trigger to execute by adding the following line to the [transition] section of your properties file:
transition-end-trigger=1
If not specified, the transition-end-trigger value is 0, indicating that no trigger is to execute. If set to a value other than 0 or 1, or not properly inserted in the [transition] section of the properties file, an error is written to the dbname.repl.agent.lg file.
If the transition-end-trigger is enabled on more than one database involved in the transition process, then the trigger may be executed multiple times, once for each participating database where it is enabled. Depending on your configuration, the transition end trigger may involve one database (a source or a target), two databases (one source plus a target), or three databases (one source plus two targets).
The trigger file is not validated prior to transition.

Transition trigger

The transition trigger is a script with very specific requirements. The file must be:
*Named transProc on Unix or transProc.bat in Windows.
*Located in the target database directory, the directory containing the dbname.db file
*Set as "executable" by your operating system
Caution: An OpenEdge server calling an external script is a potential security risk. Restricted access to the script is advised.
The trigger file has five input parameters, in the following order:
1. Current database name (the database the trigger is called from after transition)
2. Transition status (success/failure)
3. Database name (new source database name)
4. Host name (host for new source database)
5. Port (port name or number for database broker)
Note: All five input parameters are not always available. If the transition has failed, only the first two parameters (current database and status) are valid. In instances such as an offline transition, the host name and port number parameters of the new source, may not be available.
Once configured to execute, the transition end trigger executes regardless of the success or failure of the replication transition, by spawning a new process at the end of transition. Within the trigger code, you can use the transition status to determine execution paths based on the success or failure of transition.
The trigger file is not validated prior to transition. If the transProc file does not exist in the expected directory, or cannot be executed, an error message is written to the dbname.lg file.
If the trigger script is not found, the following error message is written:
(293) ** db_directory/transProc was not found.
If the trigger script is not executable, or you do not have permission, the following error message is written:
(294) ** You do not have permission to access file db_directory/transProc.
If the trigger script successfully executes, the following messages are written:
RPLU 6: (-----) Transition operation: Executing transition end trigger.
RPLU 6: (-----) Executing transProc with args[0]: /db_directory/transProc
RPLU 6: (-----) Executing transProc with args[1]: db1
RPLU 6: (-----) Executing transProc with args[2]: 0
RPLU 6: (-----) Executing transProc with args[3]: /db_directory/db2
RPLU 6: (-----) Executing transProc with args[4]: localhost
RPLU 6: (-----) Executing transProc with args[5]: 2625
RPLU 6: (13551) The transition of this database has completed normally.

Replication Monitor

You can verify the setting of transition-end-trigger property in the Replication Monitor.
For the server, select S for the Replication server status screen. The lower portion of the screen, with an enabled trigger, is shown below:
AI structure file: addai.st
Backup method: Mark
Transition end trigger: 1

Configured agents: agent1, agent2
Repl keep alive: 300
Schema lock action: Wait
Agent shutdown action: Recovery
For an agent, select A for the Replication agent status screen. The lower portion of the screen, with an enabled trigger, is shown below:

Additional transition information:
Replication set: 1
Database role: Reverse
Transition to agents: agent1,agent2
Restart after transition: 1
Automatically begin AI: 1
Automatically add AI areas: 1
AI structure file: addai.st
Backup method: Full-offline
Transition end trigger: 1