Bug #42528 SELECT fails when executed in sequence after lock & flush table with ibmdb2i
Submitted: 2 Feb 2009 5:19 Modified: 13 May 2009 6:54
Reporter: Nirbhay Choubey Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DB2SE for IBM i Severity:S3 (Non-critical)
Version:5.1.30 OS:Other (IBMi 5.4)
Assigned to: Nirbhay Choubey CPU Architecture:Any

[2 Feb 2009 5:19] Nirbhay Choubey
Description:
SELECT * from t1; throws the following error when executed after LOCK table and FLUSH table with 'ibmdb2i' storage engine:

ibmdb2i error 2021: See message MCH3402 in joblog for job 259078/QUSER/QSQSRVR.
ERROR 1030 (HY000): Got error 2021 from storage engine

Server job log :
Job 259078/QUSER/QSQSRVR started on 01/11/09 at 18:26:03 in subsystem
QSYSWRK in QSYS. Job entered system on 01/11/09 at 18:26:03.
ACGDTA for 259078/QUSER/QSQSRVR not journaled; reason 1.
Printer device PRT01 not found.          Errors on CHGJOB command
for job 259078/QUSER/QSQSRVR.
Printer device PRT01 not found.
Job changed successfully; however errors occurred.
ACGDTA for 259078/QUSER/QSQSRVR not journaled; reason 1.
User Profile = QAUSER  
SERVER MODE CONNECTING JOB IS 259380/QSECOFR/QP0ZSPWP.
Unable to retrieve query options file.
Constraint was removed.              1 constraint(s) removed from file "t1".
Open of member "t1" was changed to SEQONLY(*NO).

How to repeat:
drop table t1;
create table t1 (a int not null auto_increment primary key);
insert into t1 values (0);
lock table t1 read;
select * from t1;
+---+
| a |
+---+
| 1 |
+---+
flush table t1;
select * from t1;
[13 May 2009 6:54] Nirbhay Choubey
Fixed by adding a workaround in the IBMDB2i code.
Verified with mysql-5.1.34 on IBMi 5.4 and 6.1