Peeter Joot's (OLD) Blog.

Math, physics, perl, and programming obscurity.

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: