Skip to content

Commit 46758ca

Browse files
committed
Fix for non deterministic results in some StatementRegressionTest tests.
Change-Id: I0dcd3583c11ae1981427c1f52db10220e312d6e1
1 parent a281379 commit 46758ca

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

src/test/java/testsuite/regression/StatementRegressionTest.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9850,10 +9850,6 @@ public void testBug80615() throws Exception {
98509850
final String testCase = String.format("Case: [Close STMTs: %s, Use cache: %s, Poolable: %s ]", closeStmt ? "Y" : "N", useCache ? "Y" : "N",
98519851
poolable ? "Y" : "N");
98529852

9853-
System.out.println();
9854-
System.out.println(testCase);
9855-
System.out.println("********************************************************************************");
9856-
98579853
createTable("testBug80615", "(id INT)");
98589854

98599855
props.setProperty(PropertyKey.rewriteBatchedStatements.getKeyName(), "true");
@@ -12088,15 +12084,14 @@ public void testBug85223() throws Exception {
1208812084
*/
1208912085
@Test
1209012086
public void testBug96900() throws Exception {
12087+
assumeTrue("ON".equalsIgnoreCase(getMysqlVariable("performance_schema")), "PERFORMANCE_SCHEMA must be enabled to run this this.");
1209112088
assumeTrue(versionMeetsMinimum(5, 7), "MySQL 5.7+ is required to run this test.");
1209212089

1209312090
Supplier<Integer> sessionCount = () -> {
1209412091
try {
12095-
this.stmt.execute("FLUSH STATUS");
12096-
TimeUnit.SECONDS.sleep(1); // Status values don't update immediately.
12097-
this.rs = this.stmt.executeQuery("SHOW GLOBAL STATUS LIKE 'threads_connected'");
12092+
this.rs = this.stmt.executeQuery("SELECT COUNT(*) FROM performance_schema.threads WHERE TYPE='FOREGROUND' AND CONNECTION_TYPE='TCP/IP'");
1209812093
this.rs.next();
12099-
return this.rs.getInt(2);
12094+
return this.rs.getInt(1);
1210012095
} catch (Exception e) {
1210112096
throw new RuntimeException(e.getMessage(), e);
1210212097
}
@@ -12106,7 +12101,6 @@ public void testBug96900() throws Exception {
1210612101

1210712102
Properties props = new Properties();
1210812103
props.setProperty(PropertyKey.sslMode.getKeyName(), SslMode.DISABLED.name());
12109-
props.setProperty(PropertyKey.allowPublicKeyRetrieval.getKeyName(), "true");
1211012104

1211112105
Connection testConn = getConnectionWithProps(props);
1211212106
Statement testStmt = testConn.createStatement();
@@ -12137,15 +12131,14 @@ public void testBug96900() throws Exception {
1213712131
*/
1213812132
@Test
1213912133
public void testBug99260() throws Exception {
12134+
assumeTrue("ON".equalsIgnoreCase(getMysqlVariable("performance_schema")), "PERFORMANCE_SCHEMA must be enabled to run this this.");
1214012135
assumeTrue(versionMeetsMinimum(5, 7), "MySQL 5.7+ is required to run this test.");
1214112136

1214212137
Supplier<Integer> sessionCount = () -> {
1214312138
try {
12144-
this.stmt.execute("FLUSH STATUS");
12145-
TimeUnit.SECONDS.sleep(1); // Status values don't update immediately.
12146-
this.rs = this.stmt.executeQuery("SHOW GLOBAL STATUS LIKE 'threads_connected'");
12139+
this.rs = this.stmt.executeQuery("SELECT COUNT(*) FROM performance_schema.threads WHERE TYPE='FOREGROUND' AND CONNECTION_TYPE='TCP/IP'");
1214712140
this.rs.next();
12148-
return this.rs.getInt(2);
12141+
return this.rs.getInt(1);
1214912142
} catch (Exception e) {
1215012143
throw new RuntimeException(e.getMessage(), e);
1215112144
}

0 commit comments

Comments
 (0)