mrhhsg opened a new pull request, #71369:
URL: https://github.com/apache/doris/pull/71369

   ### What problem does this PR solve?
   
   Issue Number: None
   
   Related PR: #71084
   
   PR Type: Bugfix
   
   Partially failed JDBC initialization and exceptions during cleanup can leave 
later resources unclosed or hide cleanup errors. Closing a shared zero-minimum 
Hikari pool from one executor can also disrupt other borrowers. Local-file 
writers can skip closing the underlying handle when an explicit flush fails.
   
   ### Changes
   
   Backport #71084 to the existing `branch-4.1` executor hierarchy, without 
introducing the newer scanner/writer/type-handler framework:
   
   - Attempt output-table, result-set, statement, prepared-statement and 
connection cleanup independently, retaining the primary exception and 
suppressing subsequent failures. Clean up failed initialization, read setup and 
transaction setup, and release connection-test borrows before returning.
   - Track actual EOF and whether a driver-specific physical abort occurred. 
Retire unusable or zero-minimum borrows without shutting down the shared pool. 
Do not close/reset a Hikari proxy again after successful eviction detaches its 
pool entry.
   - Publish cached pools atomically, closing only unpublished competing 
candidates. Close a newly created statement if fetch-size configuration fails 
before ownership transfer.
   - Preserve cause/suppressed diagnostics while redacting configured secrets, 
JDBC URLs and credential properties at the JNI output boundary. Keep ordinary 
exception formatting unchanged.
   - Let `BufferedWriter.close()` flush and close the underlying file handle, 
and clear the writer reference in `finally`.
   
   The branch's explicit native transaction control and MySQL streaming 
behavior are retained. No native production code, JNI signatures or wire 
formats are changed.
   
   ### Testing
   
   All results below are local; output-directory-only properties are omitted 
from the commands.
   
   - **96 Java tests passed, no failures/errors/skips** (92 JDBC, 4 local 
writer):
     ```sh
     mvn -f fe/pom.xml -pl 
be-java-extensions/jdbc-scanner,be-java-extensions/java-writer -am test 
-Dtest='JdbcResourceCleanupTest,JdbcPoolOwnershipTest,JdbcExceptionUtilsTest,LocalFileResourceCleanupTest,BaseJdbcExecutorTest,OracleSessionTimeZoneTest,JdbcTimestamp*Test'
 -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false 
-Dcheckstyle.skip=true
     ```
   - **ASAN native UT build and 12 tests passed**:
     ```sh
     ./run-be-ut.sh --run --filter='JniReaderTest.*:JniTableReaderTest.*' -j 48
     ```
   - **Affected Java plugins built and packaged**:
     ```sh
     DISABLE_BE_JAVA_EXTENSIONS=OFF FE_MAVEN_THREADS=4 ./build.sh 
--be-java-extensions --be-extension-ignore 
iceberg-metadata-scanner,hadoop-hudi-scanner,java-udf,paimon-connector,trino-connector-scanner,max-compute-connector,avro-scanner,preload-extensions,hadoop-deps
     ```
   - **Checkstyle: 0 violations**:
     ```sh
     (cd fe && mvn -pl 
be-java-extensions/java-common,be-java-extensions/jdbc-scanner,be-java-extensions/java-writer
 -am validate)
     ```
   - **clang-format 16.0.6 and whitespace checks passed**:
     ```sh
     clang-format --dry-run --Werror be/test/format/jni/jni_reader_test.cpp
     git diff 84fbeb39a636684b5741d01705738fffcfa85da3 HEAD --check
     ```
   
   Validation limits:
   - An additional `JniScannerTest` run failed with a JVM SIGSEGV in the 
unchanged `OffHeap.getBoolean` / `VectorColumn.createReadableColumn` path. Its 
root cause was not established; it is not included in the passing matrix above.
   - Database-backed SQL regression, real Oracle/SQL Server integration, full 
test suites, multi-BE and mixed-version testing were not run. Real-Hikari tests 
use physical-connection proxies, not external database servers.
   
   ### Release note
   
   JDBC JNI operations attempt remaining resource cleanup after initialization 
or close failures, preserve sanitized error details, and no longer close shared 
pools per operation. Local-file writers attempt underlying handle closure even 
when flushing fails.
   
   ### Check List (For Author)
   
   - [x] Unit Test
   - Behavior changed: Yes, resource cleanup and error propagation as described 
above.
   - Does this need documentation: No.
   
   ### AI Disclosure
   
   - Tool: Codex
   - Generated: Code, tests and this description.
   - Human review: Not performed yet.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to