How Db2 protects data consistency in data sharing

Applications can access data from any member of a data sharing group, and many members can potentially read and write the same data. Db2 for z/OS® uses special data sharing locking and caching mechanisms to ensure data consistency across the applications.

When multiple members of a data sharing group open the same table space, index space, or partition, and at least one of them opens it for writing, the data is said to be of inter-Db2 read/write interest to the members. (Sometimes called inter-Db2 interest.) To control access to data that is of inter-Db2 interest, whenever the data is changed, Db2 caches it in a storage area that is called a group buffer pool.

When there is inter-Db2 read/write interest in a particular table space, index, or partition, it is dependent on the group buffer pool, or GBP-dependent (group buffer pool-dependent).

You define group buffer pools by using coupling facility resource management (CFRM) policies. For more information, see Defining coupling facility structures.

As shown in the following figure, a mapping exists between a group buffer pool and the buffer pools of the group members. For example, each member has a buffer pool named BP0. For data sharing, you must define a group buffer pool (GBP0) in the coupling facility that maps to each member's buffer pool BP0. GBP0 is used for caching the Db2 catalog and directory table spaces and indexes, and any other table spaces, indexes, or partitions that use buffer pool 0.

Although a single group buffer pool cannot reside in more than one coupling facility (unless it is duplexed), you can put group buffer pools in more than one coupling facility.

Figure 1. Relationship of member buffer pools to the group buffer pool. One group buffer pool supports all member buffer pools of the same name.
Begin figure description. Members DB2A and DB2B both have buffer pools 0, 1, and n that map to the group buffer pools 0, 1, and n, respectively. End figure description.

When you change a particular page of data, Db2 caches that page in the group buffer pool. The coupling facility invalidates any image of the page in the buffer pools associated with each member. Then, when a request for that same data is subsequently made by another member, that member looks for the data in the group buffer pool.

Performance options to fit your application's needs: By default, Db2 caches updated data, but you also have the options of caching all or none of your data. There is even an option especially for large object (LOB) data.