Skip to content

Commit 15cc7c7

Browse files
committed
Parallelize CockroachDB testing
1 parent 8f37346 commit 15cc7c7

File tree

5 files changed

+31
-3
lines changed

5 files changed

+31
-3
lines changed

docker_db.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,7 @@ ALTER DATABASE system CONFIGURE ZONE USING "gc.ttlseconds" = 300;
11781178
quit
11791179
EOF
11801180
"
1181+
cockroachdb_setup
11811182
echo "Cockroachdb successfully started"
11821183
}
11831184

@@ -1215,6 +1216,7 @@ ALTER DATABASE system CONFIGURE ZONE USING "gc.ttlseconds" = 300;
12151216
quit
12161217
EOF
12171218
"
1219+
cockroachdb_setup
12181220
echo "Cockroachdb successfully started"
12191221
}
12201222

@@ -1256,10 +1258,29 @@ ALTER DATABASE system CONFIGURE ZONE USING "gc.ttlseconds" = 300;
12561258
quit
12571259
EOF
12581260
"
1261+
cockroachdb_setup
12591262
echo "Cockroachdb successfully started"
12601263

12611264
}
12621265

1266+
cockroachdb_setup() {
1267+
databases=()
1268+
for n in $(seq 1 $DB_COUNT)
1269+
do
1270+
databases+=("hibernate_orm_test_${n}")
1271+
done
1272+
create_cmd=
1273+
for i in "${!databases[@]}";do
1274+
create_cmd+="create database ${databases[i]};"
1275+
done
1276+
$CONTAINER_CLI exec cockroach bash -c "cat <<EOF | ./cockroach sql --insecure
1277+
$create_cmd
1278+
1279+
quit
1280+
EOF
1281+
"
1282+
}
1283+
12631284
tidb() {
12641285
tidb_5_4
12651286
}

hibernate-core/hibernate-core.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ tasks.withType( Test.class ).each { test ->
270270
// see GradleParallelTestingResolver for how the test worker id is resolved in JDBC configs
271271
if ( project.db == "h2" || project.db == "hsqldb" || project.db == "pgsql_ci" || project.db == "edb_ci"
272272
|| project.db == "oracle_ci" || project.db == "oracle_xe_ci" || project.db == "mysql_ci" || project.db == "mariadb_ci"
273-
|| project.db == "db2_ci" || project.db == "mssql_ci" ) {
273+
|| project.db == "db2_ci" || project.db == "mssql_ci" || project.db == "cockroachdb" ) {
274274
// Most systems have multi-threading and maxing out a core on both threads will hurt performance
275275
// Also, as soon as we hit 16+ threads, the returns are diminishing, so divide by 4
276276
def threadCount = Runtime.runtime.availableProcessors()

hibernate-core/src/test/java/org/hibernate/orm/test/bulkid/OracleInlineMutationStrategyIdTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@
44
*/
55
package org.hibernate.orm.test.bulkid;
66

7+
import org.hibernate.dialect.CockroachDialect;
8+
import org.hibernate.testing.orm.junit.SkipForDialect;
9+
710
/**
811
* Special test that tries to update 1100 rows. Oracle only supports up to 1000 parameters per in-predicate,
912
* so we want to test if this scenario works.
1013
*
1114
* @author Vlad Mihalcea
1215
*/
16+
@SkipForDialect(
17+
dialectClass = CockroachDialect.class,
18+
reason = "Amount of rows lengthens the transaction time, leading to retry errors on CockroachDB: https://www.cockroachlabs.com/docs/v24.3/transaction-retry-error-reference.html#retry_commit_deadline_exceeded"
19+
)
1320
public class OracleInlineMutationStrategyIdTest extends InlineMutationStrategyIdTest {
1421

1522
@Override

hibernate-envers/hibernate-envers.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ tasks.withType( Test.class ).each { test ->
6262
// see GradleParallelTestingResolver for how the test worker id is resolved in JDBC configs
6363
if ( project.db == "h2" || project.db == "hsqldb" || project.db == "pgsql_ci" || project.db == "edb_ci"
6464
|| project.db == "oracle_ci" || project.db == "oracle_xe_ci" || project.db == "mysql_ci" || project.db == "mariadb_ci"
65-
|| project.db == "db2_ci" || project.db == "mssql_ci" ) {
65+
|| project.db == "db2_ci" || project.db == "mssql_ci" || project.db == "cockroachdb" ) {
6666
// Most systems have multi-threading and maxing out a core on both threads will hurt performance
6767
// Also, as soon as we hit 16+ threads, the returns are diminishing, so divide by 4
6868
def threadCount = Runtime.runtime.availableProcessors()

local-build-plugins/src/main/groovy/local.databases.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ ext {
378378
'jdbc.user' : 'root',
379379
'jdbc.pass' : '',
380380
// Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com
381-
'jdbc.url' : 'jdbc:postgresql://' + dbHost + ':26257/defaultdb?sslmode=disable&preparedStatementCacheQueries=0&escapeSyntaxCallMode=callIfNoReturn',
381+
'jdbc.url' : 'jdbc:postgresql://' + dbHost + ':26257/hibernate_orm_test_$worker?sslmode=disable&preparedStatementCacheQueries=0&escapeSyntaxCallMode=callIfNoReturn',
382382
'jdbc.datasource' : 'org.postgresql.Driver',
383383
// 'jdbc.datasource' : 'org.postgresql.ds.PGSimpleDataSource',
384384
// Configure the for-update clause to use proper locks: https://github.com/cockroachdb/cockroach/issues/88995

0 commit comments

Comments
 (0)