Skip to content

feat(bqjdbc): Add custom logger to handle ResultSet logs#13034

Open
Neenu1995 wants to merge 3 commits intomainfrom
ns/refactor-log
Open

feat(bqjdbc): Add custom logger to handle ResultSet logs#13034
Neenu1995 wants to merge 3 commits intomainfrom
ns/refactor-log

Conversation

@Neenu1995
Copy link
Copy Markdown
Contributor

@Neenu1995 Neenu1995 commented May 7, 2026

b/510827966

Optimized JDBC driver performance by implementing a custom logger for ResultSet classes, designed for low impact when logging is off and efficient handling when on.

  • Lazy Logging Overloads: Added Java 8 Supplier overloads to custom loggers, eliminating dynamic string allocations and GC pressure when logging is disabled.

  • Explicit Trace Logging: Introduced Supplier-based trace overloads (like finestTrace) with explicit method parameters, bypassing CPU-intensive stack-walking.

  • ResultSet-Wide Refactoring: Refactored 11 ResultSet-related classes to use these lazy trace overloads, removing hot-path logging overhead at the bytecode level.

  • Per-Connection Log Routing: Enhanced PerConnectionFileHandler to extract connection IDs directly from log parameters, preventing log leakage into the global log.

@Neenu1995 Neenu1995 requested review from a team as code owners May 7, 2026 18:48
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces BigQueryJdbcResultSetLogger, a specialized high-performance logger designed for ResultSet and related classes to avoid expensive stack trace walking on hot paths. It updates various JDBC classes to use this new logger and its finestTrace method. Feedback highlights a potential memory leak in the logger's static cache when using connection IDs, a bug where the log method override destructively overwrites existing log parameters, and an opportunity to further optimize performance by overriding the fine logging methods.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant