From 4f6b295e140ee093a3b01430e26d6ebcfa812d92 Mon Sep 17 00:00:00 2001 From: Carl Mastrangelo Date: Mon, 23 Sep 2024 10:15:31 -0700 Subject: [PATCH] Make Savepoint rollbacks mark the connection dirty (#2149) Addresses https://github.com/brettwooldridge/HikariCP/issues/2142 --- src/main/java/com/zaxxer/hikari/pool/ProxyConnection.java | 2 +- src/test/java/com/zaxxer/hikari/pool/ConnectionStateTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/zaxxer/hikari/pool/ProxyConnection.java b/src/main/java/com/zaxxer/hikari/pool/ProxyConnection.java index 2eab3637..93508904 100644 --- a/src/main/java/com/zaxxer/hikari/pool/ProxyConnection.java +++ b/src/main/java/com/zaxxer/hikari/pool/ProxyConnection.java @@ -392,7 +392,7 @@ public abstract class ProxyConnection implements Connection public void rollback(Savepoint savepoint) throws SQLException { delegate.rollback(savepoint); - isCommitStateDirty = false; + isCommitStateDirty = true; } /** {@inheritDoc} */ diff --git a/src/test/java/com/zaxxer/hikari/pool/ConnectionStateTest.java b/src/test/java/com/zaxxer/hikari/pool/ConnectionStateTest.java index 35b36fb2..5599bee4 100644 --- a/src/test/java/com/zaxxer/hikari/pool/ConnectionStateTest.java +++ b/src/test/java/com/zaxxer/hikari/pool/ConnectionStateTest.java @@ -160,7 +160,7 @@ public class ConnectionStateTest assertTrue(TestElf.getConnectionCommitDirtyState(connection)); connection.rollback(null); - assertFalse(TestElf.getConnectionCommitDirtyState(connection)); + assertTrue(TestElf.getConnectionCommitDirtyState(connection)); resultSet.updateRow(); assertTrue(TestElf.getConnectionCommitDirtyState(connection));