Details
Description
The following script , before the fix, causes online compress to attempt to latch the same page twice in a nested user transaction causing a self deadlock of the form:
ij> CALL SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE('APP', 'T1', 1, 1, 1);
ERROR 40001: A lock could not be obtained due to a deadlock, cycle of locks and
waiters is:
Lock : LATCH, T1, Page(35,Container(0, 1728))
Waiting XID :
, APP, CALL S
YSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE('APP', 'T1', 1, 1, 1)
Granted XID :
. The selected victim is XID : 385920.
script that reproduces it:
drop table t1;
create table t1 (i integer primary key, j integer, c char(200));
insert into t1 values (1, 1, 'a');
insert into t1 (select t1.i + 2, t1.j + 2, t1.c from t1);
insert into t1 (select t1.i + 4, t1.j + 4, t1.c from t1);
insert into t1 (select t1.i + 8, t1.j + 8, t1.c from t1);
insert into t1 (select t1.i + 16, t1.j + 16, t1.c from t1);
insert into t1 (select t1.i + 32, t1.j + 32, t1.c from t1);
insert into t1 (select t1.i + 64, t1.j + 64, t1.c from t1);
insert into t1 (select t1.i + 128, t1.j + 128, t1.c from t1);
insert into t1 (select t1.i + 256, t1.j + 256, t1.c from t1);
insert into t1 (select t1.i + 512, t1.j + 512, t1.c from t1);
insert into t1 (select t1.i + 1024, t1.j + 1024, t1.c from t1);
delete from t1 where j=1;
CALL SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE('APP', 'T1', 1, 1, 1);
delete from t1 where j=2;
CALL SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE('APP', 'T1', 1, 1, 1);
delete from t1 where i > 1024;
CALL SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE('APP', 'T1', 1, 1, 1);
delete from t1 where i < 512;
CALL SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE('APP', 'T1', 1, 1, 1);