Skip to content

Commit 662fc7e

Browse files
committed
Update patch for 3.11.5.7
Fixes include adjustments for SessionLeakTest and SchemaChangesCCTest. First one is adjusted for shard aware cases which have different expected number of connections in contrast to Cassandra clusters. Second one has number of nodes increased. This solves the issue of queries quietly timing out due to cluster not having a quorum for raft.
1 parent 88d594e commit 662fc7e

File tree

1 file changed

+88
-0
lines changed
  • versions/scylla/3.11.5.7

1 file changed

+88
-0
lines changed

versions/scylla/3.11.5.7/patch

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,94 @@ index 168b86730..27bf7ac5a 100644
119119
public void should_create_tombstone_when_null_value_on_bound_statement() {
120120
PreparedStatement prepared =
121121
session().prepare("INSERT INTO " + SIMPLE_TABLE + " (k, i) VALUES (?, ?)");
122+
diff --git a/driver-core/src/test/java/com/datastax/driver/core/SchemaChangesCCTest.java b/driver-core/src/test/java/com/datastax/driver/core/SchemaChangesCCTest.java
123+
index 0538cf87e..d57301bb7 100644
124+
--- a/driver-core/src/test/java/com/datastax/driver/core/SchemaChangesCCTest.java
125+
+++ b/driver-core/src/test/java/com/datastax/driver/core/SchemaChangesCCTest.java
126+
@@ -33,7 +33,7 @@ import java.util.concurrent.TimeUnit;
127+
import org.mockito.ArgumentCaptor;
128+
import org.testng.annotations.Test;
129+
130+
-@CCMConfig(numberOfNodes = 2, dirtiesContext = true, createCluster = false)
131+
+@CCMConfig(numberOfNodes = 3, dirtiesContext = true, createCluster = false)
132+
public class SchemaChangesCCTest extends CCMTestsSupport {
133+
134+
private static final int NOTIF_TIMEOUT_MS = 5000;
135+
diff --git a/driver-core/src/test/java/com/datastax/driver/core/SessionLeakTest.java b/driver-core/src/test/java/com/datastax/driver/core/SessionLeakTest.java
136+
index aa0f57379..b7c0145a1 100644
137+
--- a/driver-core/src/test/java/com/datastax/driver/core/SessionLeakTest.java
138+
+++ b/driver-core/src/test/java/com/datastax/driver/core/SessionLeakTest.java
139+
@@ -23,6 +23,7 @@ import static org.assertj.core.api.Assertions.fail;
140+
141+
import com.datastax.driver.core.exceptions.InvalidQueryException;
142+
import com.datastax.driver.core.utils.SocketChannelMonitor;
143+
+import java.net.InetSocketAddress;
144+
import java.util.concurrent.TimeUnit;
145+
import org.testng.annotations.Test;
146+
147+
@@ -51,10 +52,15 @@ public class SessionLeakTest extends CCMTestsSupport {
148+
149+
// ensure sessions.size() returns with 1 control connection + core pool size.
150+
int corePoolSize = TestUtils.numberOfLocalCoreConnections(cluster);
151+
+ int shardedConns = TestUtils.numberOfLocalCoreConnectionsSharded(cluster);
152+
Session session = cluster.connect();
153+
154+
assertThat(cluster.manager.sessions.size()).isEqualTo(1);
155+
- assertOpenConnections(1 + corePoolSize, cluster);
156+
+ if (ccm().getScyllaVersion() != null) {
157+
+ assertOpenConnections(1 + shardedConns, cluster);
158+
+ } else {
159+
+ assertOpenConnections(1 + corePoolSize, cluster);
160+
+ }
161+
162+
// ensure sessions.size() returns to 0 with only 1 active connection (the control connection)
163+
session.close();
164+
@@ -74,7 +80,11 @@ public class SessionLeakTest extends CCMTestsSupport {
165+
// there should be corePoolSize more connections to accommodate for the new host.
166+
Session thisSession = cluster.connect();
167+
assertThat(cluster.manager.sessions.size()).isEqualTo(1);
168+
- assertOpenConnections(1 + (corePoolSize * 2), cluster);
169+
+ if (ccm().getScyllaVersion() != null) {
170+
+ assertOpenConnections(1 + (shardedConns * 2), cluster);
171+
+ } else {
172+
+ assertOpenConnections(1 + (corePoolSize * 2), cluster);
173+
+ }
174+
175+
// ensure bootstrapping a node does not create additional connections that won't get cleaned up
176+
thisSession.close();
177+
@@ -119,8 +129,30 @@ public class SessionLeakTest extends CCMTestsSupport {
178+
}
179+
180+
private void assertOpenConnections(int expected, Cluster cluster) {
181+
+ Integer shardAwareNonSSLPort = null;
182+
+ if (ccm().getScyllaVersion() != null) {
183+
+ ShardingInfo shardingInfo =
184+
+ cluster.getMetadata().allHosts().iterator().next().getShardingInfo();
185+
+ if (shardingInfo != null) {
186+
+ shardAwareNonSSLPort = shardingInfo.getShardAwarePort(false);
187+
+ }
188+
+ }
189+
assertThat(cluster.getMetrics().getOpenConnections().getValue()).isEqualTo(expected);
190+
- assertThat(channelMonitor.openChannels(ccm().addressOfNode(1), ccm().addressOfNode(2)).size())
191+
- .isEqualTo(expected);
192+
+ if (shardAwareNonSSLPort != null) {
193+
+ assertThat(
194+
+ channelMonitor
195+
+ .openChannels(
196+
+ ccm().addressOfNode(1),
197+
+ ccm().addressOfNode(2),
198+
+ new InetSocketAddress(
199+
+ ccm().addressOfNode(1).getAddress(), shardAwareNonSSLPort),
200+
+ new InetSocketAddress(
201+
+ ccm().addressOfNode(2).getAddress(), shardAwareNonSSLPort))
202+
+ .size())
203+
+ .isEqualTo(expected);
204+
+ } else {
205+
+ assertThat(channelMonitor.openChannels(ccm().addressOfNode(1), ccm().addressOfNode(2)).size())
206+
+ .isEqualTo(expected);
207+
+ }
208+
}
209+
}
122210
diff --git a/driver-core/src/test/java/com/datastax/driver/core/SessionStressTest.java b/driver-core/src/test/java/com/datastax/driver/core/SessionStressTest.java
123211
index ea75f8454..ea70e9081 100644
124212
--- a/driver-core/src/test/java/com/datastax/driver/core/SessionStressTest.java

0 commit comments

Comments
 (0)