Forcing DB2 client side connections to hang on one of the members.
Posted by peeterjoot on June 23, 2011
For test purposes I wanted to force an inter-member LOCK dependency. This turns out to be pretty easy. First I created a table with a couple of dummy rows
db2 create table x '(x int)' db2 insert into x 'values(1)' db2 insert into x 'values(2)' db2 insert into x 'values(3)' db2 commit
Then setup an uncommitted update to these rows
# member 1 db2 connect to testdb2 db2 +c update x set x = x + 1
Doing the same thing on another member hangs as expected:
# member 2 db2 connect to testdb2 db2 +c update x set x = x + 1
commit on the first member resolves the hang. Interestingly one can do a ‘select * from x’ without any trouble, since we allow concurrent read and update, but one gets the pre-commit values of the rows in the table.