Skip to content
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

Introduce optional global TypeInfoCache #3200

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions pgjdbc/src/main/java/org/postgresql/PGProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@ public enum PGProperty {
+ "the statements reaches the same connection that is being initialized."
),

GLOBAL_TYPE_INFO_CACHE(
"globalTypeInfoCache",
"false",
"Use a type info cache that is global to the driver and not to each connection. "
+ "This can improve overall performance over time by limiting queries to the database "
+ "to get type metadata."
),

GSS_ENC_MODE(
"gssEncMode",
"allow",
Expand Down
4 changes: 3 additions & 1 deletion pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,10 @@

// Initialize object handling
@SuppressWarnings("argument")
TypeInfo typeCache = createTypeInfo(this, unknownLength);
TypeInfo typeCache = PGProperty.GLOBAL_TYPE_INFO_CACHE.getBoolean(info)
? new TypeInfoCache(this, unknownLength, TypeInfoCacheStorage.GLOBAL_INSTANCE)
: createTypeInfo(this, unknownLength);
this.typeCache = typeCache;

Check failure on line 355 in pgjdbc/src/main/java/org/postgresql/jdbc/PgConnection.java

View workflow job for this annotation

GitHub Actions / CheckerFramework

[Task :postgresql:compileJava] [assignment] incompatible types in assignment. this.typeCache = typeCache; ^ found : @UnknownInitialization(org.postgresql.jdbc.TypeInfoCache.class) @nonnull TypeInfo
initObjectTypes(info);

if (PGProperty.LOG_UNCLOSED_CONNECTIONS.getBoolean(info)) {
Expand Down