You can split each replication thread into multiple split threads regardless of whether it serves replication of a single table or group of tables. You can split a single thread into a maximum of ten split threads. When you split a thread into n number of parts, it provides n-1 split threads. For example, if you split the thread 5 (replBatch5.bat) into four parts, it provides three split threads 51, 52, and 53 along with the original thread 5. This means, the four parts are threads 5, 51, 52, and 53. The following topics are covered in split replication threads:
  • Generate new trigger code for splitting threads.
  • Run split threads.
  • Enable and disable queue compression.
  • Generate trigger code in lower case.

You can split each replication thread into multiple split threads regardless of whether it serves replication of a single table or group of tables. You can split a single thread into a maximum of 10 split threads.

When you split a thread into n number of parts, it provides n-1 split threads. For example, if you split the thread 5 (replBatch5.bat) into four parts, it provides three split threads 51, 52, and 53 along with the original thread 5. This means, the four parts are threads 5, 51, 52, and 53. Pro2 determines the number of a split thread dynamically based on the RECID of the source record, and groups together all the split threads that belong to the same record or RECID. This allows you to run multiple processes without adding queue compression and prevents out-of-sequence processing of more changes to the same ROWID or RECID.

Generate new trigger code for splitting threads

Generate and install a new replication trigger code to implement splitting of threads. Replace the old triggers for tables or threads that you want to use for splitting. It is recommended to replace all the existing trigger code with the new code generated using a split trigger template. The following split trigger templates are available in the replication template folder Pro2\bprepl\repl_tmpl:
  • tplt_repltrig_split_without_compression.p—Splits threads but does not apply queue compression.
  • tplt_repltrig_split_with_compression.p—Splits threads and supports queue compression.

To generate new trigger code:

  1. In the Pro2 web user interface, navigate to the Properties tab.
  2. Search for DEL_TRIG_TEMPLATE and click Edit. The Edit Property window appears. Specify the Value as tplt_repltrig_split_with_compression.p or tplt_repltrig_split_without_compression.p. Click Save.
  3. Search for WRI_TRIG_TEMPLATE and click Edit. The Edit Property window appears. Specify the Value as tplt_repltrig_split_with_compression.p or tplt_repltrig_split_without_compression.p. Click Save.
  4. In the Pro2 web user interface, click the Properties tab and modify the property values of the templates DEL_TRIG_TEMPLATE and WRI_TRIG_TEMPLATE to point to one of the split trigger templates.
  5. Click Manage Replication , select the database instance, The Edit Replication window appears. Click Next.
  6. Navigate to Generate Code tab and select the Replication Triggers checkbox to regenerate the trigger code.
    Note: Check if the jobrunner.bat file is running. If not, navigate to \bprepl\Scripts from Windows Explorer and double click the jobrunner.bat file. The Proenv window appears if the file is running successfully.
  7. You can check if new codes are generated by navigating to the \bprepl\repl_d folder. The date and time of the files in that folder will be recent if updated successfully.
  8. Copy the repl_d and repl_w folders from \bprepl and paste them in \db\bprepl folder.

Run split threads

To run the split threads, consider the example of splitting the a replication thread say, the fifth thread into four parts and perform the following steps:
Note: You must run splitting of threads only after generating the new trigger code.
  1. Create new .bat files:
    • Create three copies of the replBatch5.bat file located in the Pro2\bprepl\Scripts folder and rename them as replBatch51.bat, replBatch52.bat, and replBatch53.bat respectively.
    • Edit the replBatch51.bat file, locate and modify Thread-5 to Thread-51 and Thread=5 to Thread=51, and save your modifications. Repeat this step replBatch52.bat and replBatch53.bat files.
  2. Create new thread positions:
    • To create new thread positions within Pro2, click the Advanced Configuration tab in the Pro2 web user interface.
    • For thread 51, type 51 in the field next to the Create New Thread button, and then click Create New Thread. Repeat this step for threads 52 and 53.
  3. Create a new property:
    • In the Pro2 web user interface, click the Properties tab and then click Add.
    • In the Property Name field, specify the name of the property as SPLIT_THREAD5.
    • In the Value field, specify the number of threads as 4.
      Note: You can add upto n-1 value where 'n' is the number of thread.
    Note: The maximum value allowed per thread is 10. However, if you specify a value (characters or negative numbers) other than the numbers 1 to 10, the trigger uses only the actual thread number.
Note:
  • Even after generating the trigger code and creating new property for split threads, if you do not create the .bat files and do not schedule the task entries, the data remains in the queue until the new thread jobs are started.
  • It is recommended that you do not change the split number if there are existing records in the queue. Changing the split number might push the changes of the same record and row to a differently calculated queue.

Assign a table to the split thread

Once you have split the replication thread, assign a table to the thread. Perform the following steps to assign a table to the thread:
  • Click Manage Replication , select the database instance (sports), The Edit Replication window appears. Click Next.
  • Select Advanced Configuration and assign a table (for example, Customer table) to Thread 5 from the Thread# column.
  • You can now run a replication job to assign replication queue to the split thread. For example, run the following query in Procedure Editor:
    DEFINE VARIABLE i AS INTEGER NO-UNDO
    REPEAT i = 1 TO 1000:
    CREATE customer
    ASSIGN cust-num = NEXT-VALUE(next-cust-num)
           NAME = "test_" + STRING(i)
           country = "India".
    END. 
  • In the Pro2 web user interface, Click the Total Threads watch-box. The threads will be distributed among the split threads #5, #51, #52 and #53.
  • Run the replbatch5.bat, replbatch51.bat, replbatch52.bat and replbatch53.bat to execute the replication records. Once the replication is complete, the status of replication threads will appear as running the the Replication Process area of the Dashboard.

Enable or disable queue compression for splitting threads

Note: This is an optional property and is specific to Pro2 WAN setup only.

You can enable or disable queue compression by means of the APPSRV_QUEUE_COMPRESSION property. You can add this property by manual intervention from the web UI.

Click Properties tab and Select Add, Enter the Property Name and Value. Click Save. If this property exists, and the value is 'YES', queue compression is enabled. Else, queue compression is disabled by default.

Generate trigger code in lower case

Note: This is an optional property.

You can generate the trigger names in lower case by setting TRIGGER_FORCE_LOWERCASE = YES. You can add this property by manual intervention from the web UI. Click Properties tab and Select Add, Enter the Property Name and Value. Click Save.