New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PgResultSetMetaData caches invalid database metadata #551

Closed
PetroSemeniuk opened this Issue May 8, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@PetroSemeniuk

PetroSemeniuk commented May 8, 2016

It's a regression in version REL9_3_1102 which was introduced with addition of org.postgresql.jdbc.CacheMetadata.

It uses static instance of java.util.Map to capture information whenever metadata was perviously queried or not and if it was then cached results are returned.

The issue is that in our case we are using Active Objects which are doing ddl/dml and relying on up to date metadata for schema migration.

I believe that Hibernate ORM framework also would be affected since it supports automatic schema migration.

Although cache is at class loader level, for 99% of applications it will be global cache since driver most likely will come from system class loader.

For simple fix, I suggest reducing caching to instance level to restore REL9_3_1101 behaviour.

@PetroSemeniuk

This comment has been minimized.

PetroSemeniuk commented May 8, 2016

I created sample pull request at #552.

With that version of postgres driver our ddl tests are 100% green.

@davecramer

This comment has been minimized.

Member

davecramer commented May 8, 2016

So why are you still using REL9_3_1102 ? Is there a specific reason ? There are considerable performance enhancements in the latest driver ?

@PetroSemeniuk

This comment has been minimized.

PetroSemeniuk commented May 9, 2016

@davecramer we are not using REL9_3_1102, it's a tag name from pgjdbc where issue is reproducible so I quoted it here.

We were thinking to upgrade to 9.4.1208-jdbc42 and of course we would love to use latest version!

vlsi added a commit that referenced this issue May 14, 2016

fix: use per-connection cache for field metadata (table name, column …
…name, etc)

Global cache might lead to wrong results and concurrency issues, thus
switched per-connection one.

closes #551
closes #552

vlsi added a commit that referenced this issue May 14, 2016

fix: use per-connection cache for field metadata (table name, column …
…name, etc)

Global cache might lead to wrong results and concurrency issues, thus
switched per-connection one.

closes #551
closes #552

@vlsi vlsi closed this in 94549ff May 14, 2016

vlsi added a commit that referenced this issue May 14, 2016

fix: use per-connection cache for field metadata (table name, column …
…name, etc)

Global cache might lead to wrong results and concurrency issues, thus
switched per-connection one.

closes #551
closes #552
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment