Skip to content

[DBCP-522] Invalidate auto-commit cache before driver calls - #549

Open
hutiefang76 wants to merge 2 commits into
apache:masterfrom
hutiefang76:frank/dbcp-autocommit-error-20261023
Open

hutiefang76 wants to merge 2 commits into
apache:masterfrom
hutiefang76:frank/dbcp-autocommit-error-20261023

Conversation

@hutiefang76

Copy link
Copy Markdown

Fixes DBCP-522.

If a driver changes auto-commit and then a setter or follow-up getter throws an Error, the wrapper can keep reporting its previous cached value. Invalidate that value before delegating. The original exception handler and the successful-path read of the actual driver state remain unchanged.

Five tests use real H2 memory connections with controlled failures. They cover errors after the state change and from the follow-up getter, plus normal, SQLException, and cache-disabled controls. These simulate the failure boundary; they do not reproduce a real driver out-of-memory failure.

  • Before the fix: 43 focused tests, two regression failures, no errors or skips.
  • Java 17: the required default mvn build passes, including 1610 tests (nine existing disabled cases), license, compatibility, style, static analysis, coverage and Javadoc checks.
  • Real Java 8: clean compile and all 43 focused tests pass.

AI-generated description. Codex and DeepSeek assisted the investigation, implementation, tests and review; the actual diff and executed results were checked before submission.

A driver can change auto-commit before a setter or follow-up getter
throws an Error. Clear the previous cached state before delegation so
a later read does not return a stale value. Preserve the SQLException
handler and the successful-path read of the actual delegate state.

Add controlled-error regressions over real H2 memory connections and
normal, SQLException and cache-disabled controls.

Generated-by: DeepSeek
Generated-by: Codex
@hutiefang76

Copy link
Copy Markdown
Author

The upstream Java CI, Dependency Review and CodeQL runs are at action_required; none has started any jobs. Could a maintainer approve these runs? The required default Maven build and real Java 8 focused regressions pass locally, as recorded above.

AI-generated reply.

@garydgregory

garydgregory commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

CI resources are limited. I'll approve the job when I come around to looking at this component again. In the meantime, follow the PR template to validate your changes locally.

@garydgregory garydgregory left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See my comment.

Comment thread src/changes/changes.xml Outdated
<body>
<release version="2.14.1" date="YYYY-MM-DD" description="This is a minor release, including bug fixes and enhancements.">
<!-- FIX -->
<action type="fix" issue="DBCP-522">Invalidate the cached auto-commit state before delegating setAutoCommit to the underlying connection, so a failed state update does not leave a stale cached value.</action>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@hutiefang76 don't edit this file.

@hutiefang76 hutiefang76 Oct 23, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Removed my changelog entry in 0fb5efe5.

AI-generated reply.

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.

2 participants