Repository navigation
fix(bigquery-jdbc): add 1 GiB log file rotation and truncation fallback - #15165
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces diagnostic logging configuration and bounded log file rotation (using .log and .1.log backup files) configured via environment variables, JDBC URL properties, or JVM system properties. It also introduces ConnectionLogContext to carry per-connection logging identity and threshold safely across threads. The review feedback identifies two potential resource leaks in PerConnectionFileHandler.java where newly opened or recovered channels could be leaked if channel.size() throws an IOException during the rotation recovery or reopening phases.
|
/gcbrun |
keshavdandeva
left a comment
There was a problem hiding this comment.
The typed ConnectionLogContext is clean, and rotation keeps contiguous history at 0600 on the normal path. One change is needed in rotate(), plus a few small items. The two bot comments at L551 / L572 can be resolved: the writer already owns the channel when size() is called.
8e67b02 to
e7799af
Compare
e7799af to
c43e958
Compare
c43e958 to
97e53aa
Compare
cfe82a4 to
0d3546b
Compare
Auto-merge was disabled for another pull request in the stack
0d3546b to
d56bab7
Compare
d56bab7 to
a7c105f
Compare
Stack: PR 3 of 6 (base:
fix/bq-jdbc-log-lock-and-interrupt)Bug: b/584840147
Summary
Adds bounded 1 GiB log file size rotation onto a single
.1.log(0600) backup file with in-place truncation fallback inPerConnectionFileHandler.Environment Variables & System Properties
-Dcom.google.cloud.bigquery.jdbc.maxLogFileBytes=<bytes>(default:1073741824/ 1 GiB). Documented indocs/USER_GUIDE.md.Design Decisions
.1.log(0600) backup rotation: Validates.1.logwithNOFOLLOW_LINKS(deleting any symlink without following it), atomically rotates active logs to.1.log, and opens a fresh0600active channel while preserving global sentinel locks.channel.truncate(0)when backup rotation is blocked.