Skip to content

feat(bqjdbc): Add BigQueryJdbcMdc context to entry level methods - part 3#12954

Open
Neenu1995 wants to merge 11 commits intomainfrom
integ-per-conn-logs
Open

feat(bqjdbc): Add BigQueryJdbcMdc context to entry level methods - part 3#12954
Neenu1995 wants to merge 11 commits intomainfrom
integ-per-conn-logs

Conversation

@Neenu1995
Copy link
Copy Markdown
Contributor

@Neenu1995 Neenu1995 commented Apr 29, 2026

b/501081433

  • MDC Context registration:

    • BigQueryConnection
    • BigQueryStatement
    • BigQueryDatabseMetaData
    • BigQueryResultSetMetaData
  • MDC Nesting Support: Updated BigQueryJdbcMdc.java to use a save-and-restore pattern, supporting safe nesting of contexts across different connections.

  • Metadata Refactor: Split methods longer than 10 lines in BigQueryDatabaseMetaData and BigQueryResultSetMetadata to separate MDC setup from execution logic.

  • Logging Enhancements:

    • Added LOG.finest("++enter++") to almost all methods in core JDBC classes.
    • Added LOG.info to methods performing significant operations (like transactions and query processing).
  • Cleanup: Made LOG static in metadata and statement classes to support static contexts and cleaned up method signatures by removing passed logger instances.

@Neenu1995 Neenu1995 requested review from a team as code owners April 29, 2026 18:16
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 implements comprehensive MDC (Mapped Diagnostic Context) tracking and entry-level logging across the BigQuery JDBC driver. Key changes include refactoring public methods in BigQueryArrowResultSet, BigQueryJsonResultSet, BigQueryPreparedStatement, and BigQueryDatabaseMetaData to wrap operations in MDC context blocks, while moving core logic to internal implementation methods. Additionally, BigQueryJdbcMdc was updated to support nested context registration. The review feedback focuses on ensuring the close() method in BigQueryJsonResultSet is idempotent, replacing unsafe class casts with the standard JDBC unwrap pattern in BigQueryResultSetMetadata, and optimizing performance by eliminating redundant MDC registrations during internal method calls.

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