Search code examples
ibm-mqmq

Concern on the concept of syncpoint from WMQ


I'm kind of confused about the syncpoint from WebSphere MQ. According to the reference from the WMQ Infocenter, the syncpoint is defined as below:

The decision to commit or back out the changes is taken, in the simplest case, at the end of a task. However, it can be more useful for an application to synchronize data changes at other logical points within a task. These logical points are called sync points (or synchronization points) and the period of processing a set of updates between two sync points is called a unit of work.

Therefore, a unit of work is named as processing between two sync points. From my understanding, that unit of work is a transaction actually. So I draw the picture here reflecting the relationship between them:

enter image description here

  1. Am I understanding it correctly?
  2. Another question here is as for the syncpoint, it's said to synchronize data for application, where is the data synced from and where to?

Thanks


Solution

  • Answer 1: Yes, you are understanding it correctly. Transactions are atomic units of work that succeed or fail in their entirety. Syncpoints are the boundaries between the transactions. The subtle difference between a transaction and a syncpoint is that the work done under a transaction can be in-doubt for a period of time whereas the sync point is the state during which the transaction is not in doubt. In the event of failure, the queues are restored to the state which existed at the last syncpoint and then any pending transactions rolled back or, in the case of XA, possibly committed by the resource manager.

    The Infocenter page Transaction management and support may explain it better than the page linked in the post.

    Answer 2: The data is synchronized by the resource manager(s). For local units of work where messages are the only participants in the transaction, the synchronization occurs only in the queue, and the queue manager acts as both the resource manager and the transaction manager. For global units of work involving messages and database updates in the same transaction, the synchronization occurs in the QMgr and the database which act as resource managers. The transaction manager will either be MQ or an application server and it orchestrates the synchronization between the resource managers.

    Regardless of whether the transaction is local or global (sometimes also referred to as single-phase commit or 2-phase commit) the relationship between transactions and syncpoints is the same. The syncpoint is the most recent point in time at which a known state is preserved and to which an in-doubt transaction might be rolled back.