Skip to content

[To dev/1.3] Fix SessionPool result-set cleanup and shutdown handling (#19288) - #19292

Merged
Caideyipi merged 1 commit into
dev/1.3from
cp-19288-dev13-session-cleanup
Nov 16, 2026
Merged

Caideyipi merged 1 commit into
dev/1.3from
cp-19288-dev13-session-cleanup

Conversation

@Caideyipi

Copy link
Copy Markdown
Collaborator

Backports the shared tree-model SessionPool fixes from #19288 (8b7cf27) to dev/1.3.

For example, exhausting result set A returns its session to the pool. If query B reuses that session, calling A.close() again previously removed B's occupied entry and returned its connection while B was still using it. The wrapper now detaches its session before reuse, so repeated or concurrent closes release it only once.

Failed result-set cleanup now closes the broken physical session before creating a replacement. Operations returning after pool shutdown close their connections, and failures after shutdown do not create replacements.

Compatibility adaptations:

  • The table-session wrapper and its lifecycle changes do not apply because this branch has no table-model sessions.
  • The existing close-and-replace calls are inlined because 1.3 lacks the one-argument cleanup helper.
  • The existing session factory is package-private to support the branch's Mockito 2 tests; its construction logic is unchanged. putBack remains private.
  • Shared result-set regression cases are preserved, and shutdown cases use tree-model operations with 1.3's existing exception wrapping.

Validation:

  • Spotless passed for iotdb-client/session.
  • Built the matching TsFile 1.1.5-SNAPSHOT dependency from source.
  • On the original 1.3 implementation, all 7 new regression cases failed (6 assertion failures and 1 error).
  • Clean reactor mvn clean test -pl iotdb-client/session -am -Dtest=SessionPoolCloseTest,SessionPoolTest,SessionPoolExceptionTest -Dsurefire.failIfNoSpecifiedTests=false: 110 tests passed, 0 failures, 0 errors, 0 skipped on JDK 17.
  • Verified the tested Java files match the committed backport exactly.

Target base: 14d9c0c.

* Fix pooled session and result-set cleanup

* Serialize table session lifecycle operations

* Make close concurrency test deterministic

(cherry picked from commit 8b7cf27)
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@codecov

codecov Bot commented Nov 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 47.51%. Comparing base (14d9c0c) to head (650eaf2).

Files with missing lines Patch % Lines
...ava/org/apache/iotdb/session/pool/SessionPool.java 95.83% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev/1.3   #19292      +/-   ##
=============================================
- Coverage      47.52%   47.51%   -0.02%     
- Complexity       221      223       +2     
=============================================
  Files           3678     3678              
  Lines         252282   252300      +18     
  Branches       31394    31398       +4     
=============================================
- Hits          119906   119877      -29     
- Misses        132376   132423      +47     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Caideyipi
Caideyipi merged commit f448204 into dev/1.3 Nov 16, 2026
17 of 19 checks passed
@Caideyipi
Caideyipi deleted the cp-19288-dev13-session-cleanup branch November 16, 2026 10:07
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