go-ora icon indicating copy to clipboard operation
go-ora copied to clipboard

No data or expired data that is different from result in Dbeaver with same SQL returned

Open cloorc opened this issue 1 year ago • 3 comments

Oracle db:

Oracle Oracle Database 19c Enterprise Edition
Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

We are using gorm-oracle, which will import go-ora finally, to interact with Oracle database.

go-ora version in go.mod: github.com/sijms/go-ora/v2 v2.8.11.

For following SQL:

SELECT * FROM "t_key" WHERE "tenant_id" = :1 AND "app_id" = :2 AND "dispatching_key" = :3 AND "delete_flag" = :4 ORDER BY "t_key"."id"  FETCH NEXT :5 ROWS ONLY

We occasionally got nothing returned or wrong status in gorm.DB#First(). However, in Dbeaver we could see data as expected with the exactly same SQL.

We tried:

  1. Disable connection pool(set database/sql.DB#maxIdleConnection to 0), the issue can still be reproduced;
  2. Limit the connection pool to 1, the issue can still be reproduced;

We thought cursor may be leaked and we checked database/sql.Rows#Close() and make sure it will be closed finally. We'd also doubt the session state but has very little knowledge about this.

cloorc avatar Nov 14 '24 12:11 cloorc

Oracle db:

Oracle Oracle Database 19c Enterprise Edition
Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

We are using gorm-oracle, which will import go-ora finally, to interact with Oracle database.

go-ora version in go.mod: github.com/sijms/go-ora/v2 v2.8.11.

For following SQL:

SELECT * FROM "t_key" WHERE "tenant_id" = :1 AND "app_id" = :2 AND "dispatching_key" = :3 AND "delete_flag" = :4 ORDER BY "t_key"."id"  FETCH NEXT :5 ROWS ONLY

We occasionally got nothing returned or wrong status in gorm.DB#First(). However, in Dbeaver we could see data as expected with the exactly same SQL.

We tried:

  1. Disable connection pool(set database/sql.DB#maxIdleConnection to 0), the issue can still be reproduced;
  2. Limit the connection pool to 1, the issue can still be reproduced;

We thought cursor may be leaked and we checked database/sql.Rows#Close() and make sure it will be closed finally. We'd also doubt the session state but has very little knowledge about this.

Update: we've enabled CDC on our database(a pdb).

cloorc avatar Nov 15 '24 00:11 cloorc

Have you inserted but not yet committed the data in Dbeaver (or any other connection)?

cjbj avatar Nov 15 '24 01:11 cjbj

Have you inserted but not yet committed the data in Dbeaver (or any other connection)?

I'm sure we'd never inserted, updated or deleted any data at the same time from Dbeaver.

And we disabled supplemental log for CDC and the issue is still.

Thanks a lot!

cloorc avatar Nov 15 '24 01:11 cloorc