Replication of opaque user-defined data types

Opaque data types can be replicated, but have certain restrictions.

You must install and register UDTs and their associated support routines on all database servers that participate in Enterprise Replication before starting replication. If you combine Enterprise Replication with high-availability clusters, you must install UDTs on both the primary and secondary database servers, but only register them on the primary database server.

UDT support functions

If you plan to replicate opaque UDTs, the UDT designer must provide the following types of support functions:

  • The streamwrite() and streamread() functions

    The purpose of these functions is similar to the existing send() and receive() functions provided for client/server transmissions. For information about writing these support functions, see the section on Enterprise Replication stream support functions in the IBM® Informix® DataBlade API Programmer's Guide.

    When a row that includes any UDT columns to queue to the target system is prepared for replication, Enterprise Replication calls the streamwrite() function on each UDT column. The function converts the UDT column data from the in-server representation to a representation that can be sent over the network. Enterprise Replication replicates the column without understanding the internal representation of the UDT.

    On the target server, Enterprise Replication calls the streamread() function for each UDT column that it transmitted by the streamwrite() function.

  • The compare() function and its supporting greaterthan(), lessthan(), and equal() functions

    Enterprise Replication uses comparison functions to determine whether a replicated column is altered. For example, the comparison functions are used when the replicate definition specifies to replicate only changed columns instead of full rows.

    When you define a compare() function, you must also define the greaterthan(), lessthan(), equal(), or other functions that use the compare() function.

    For more information about writing these support functions, see the IBM Informix User-Defined Routines and Data Types Developer's Guide.

Requirements during replication

The following requirements apply to replicating opaque data types:
  • The WHERE clause of the SELECT statement of the participant modifier can reference an opaque UDT if the UDT is always stored in row.
  • Any UDRs in a WHERE clause can use only parameters whose values can be extracted fully from the logged row images, plus any optional constants.
  • All of the columns in the SELECT statement of each participant definition must be actual columns in that table. Enterprise Replication does not support virtual columns (results of UDRs on table columns).
  • You cannot use SPL routines for conflict resolution if the replicate includes any UDTs in the SELECT statement or if the replicate is defined to replicate only changed columns.
  • You can define replicates on tables that contain one or more UDT columns as the replication key.

Copyright© 2018 HCL Technologies Limited