Push data session survival

By default, if client gets disconnected from server, server deletes push-data event conditions for the session, and server no longer capture the event data. The following APIs allow server to capture the event data for the push-data client if client is temporarily disconnected from the server.

Detachable sessions can survive from server failure. Client can re-attach to detachable sessions after bouncing the server or after primary server failover operation in a cluster environment with secondary servers. After bouncing server, it is possible for the pushdata client to get duplicate records. Client need to save last received record txnid and op_num and discard the processed records. restart_logid and restart_logpos are added to INSER, UPDATE and DELETE records returned to the push data sessions. After server failover or upon restarting Informix server, client can re-attach to the detached session and reset Enterprise replication capture position back to restart_logid and restart_logpos using ‘pushdata reset_capture’ sysadmin task/admin API.

Sample record for Insert operation:
{"operation":"insert","table":"t1","owner":"informix","database":"testdb","txnid":133151498608,
"operation_owner_id":37188,"operation_session_id":67,"commit_time":1568823415,"op_num":4,"restart_logid":31,
"restart_logpos":24,"rowdata":{"c1":4001,"c2":4001 }}
  • To mark a session as a detachable session:
    execute function informix.task('pushdata setdetach') into :retvalstr;
    This API returns unique session id.
  • Optional command to recapture data from a previous log position after bouncing server or primary server failover operation:
    execute function admin("pushdata reset_capture", '{"logid":"%d", "logpos":"%d"}’);
  • This command API stops Enterprise Replication(ER) and restarts ER with the given log position set to replay position. This API impacts all pushdata sessions and existing replicate definitions in Enterprise Replication.

    Note: Care must be taken to set logical log unique id and position to the last known restart_logid and restart_logpos returned to push data session.
    restart_logid and restart_logpos are added to INSERT, UPDATE and DELETE records returned to the push data sessions. After server failover or upon restarting Informix server, user can attach back to the detached session and reset Enterprise replication capture position back to restart_logid and restart_logpos.
  • To re-join a detached session after reconnecting to server:
    execute function informix.task('pushdata join', "{session_id:"245"}) into :retvalstr;
    Returns smartblob file descriptor to read event data. Unique session id returned from 'pushdata setdetach' API is used as input to 'pushdata join' API. 'pushdata join' returns smartblob file descriptor -- same as 'pushdata open'.
    Note: 'pushdata open' and 'pushdata join' APIs should not be called in the same session.
    'pushdata open' is used to establish new push-data session, and 'pushdata join' API is used to join existing detached push-data session.
  • To delete "detachable" push-data session information from the server:
    • To delete currently attached push-data session:
      execute function informix.task('pushdata delete') into :retvalstr;
      This is only required if the push-data session is marked as a detachable session using API 'pushdata setdetach'.
    • To delete a specific unique session id currently not attached to any client application:
      execute function task('pushdata delete', '{session_id:"12"}') ;
    • To delete all push-data sessions that are not attached to any client applications:
      execute function task('pushdata delete', '{delete_all:"1"}');