Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(crdb): remove support for cockroach db from code base #4462

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ There is a special profile for the WildFly Application Servers:

# Testing a Given Database

Camunda supports all database technologies listed on [Supported Database Products](https://docs.camunda.org/manual/latest/introduction/supported-environments/#supported-database-products), and in all environments, they are operating in as specified. Support means we guarantee the Camunda Platform integrates well with the database technology’s JDBC behavior (there are some [documented](https://docs.camunda.org/manual/latest/user-guide/process-engine/database/) limitations, e.g., isolation level `READ_COMMITTED` is required for all databases except CockroachDB, which in turns requires `SERIALIZABLE`). We test a database technology with a specific database, i.e., we test it in one environment, not all possible environments that you can imagine (e.g., we test Postgres on local Docker containers, but not as hosted databases on AWS or Azure).
Camunda supports all database technologies listed on [Supported Database Products](https://docs.camunda.org/manual/latest/introduction/supported-environments/#supported-database-products), and in all environments, they are operating in as specified. Support means we guarantee the Camunda Platform integrates well with the database technology’s JDBC behavior (there are some [documented](https://docs.camunda.org/manual/latest/user-guide/process-engine/database/) limitations, e.g., isolation level `READ_COMMITTED` is required for all databases). We test a database technology with a specific database, i.e., we test it in one environment, not all possible environments that you can imagine (e.g., we test Postgres on local Docker containers, but not as hosted databases on AWS or Azure).

# No Maven? No problem!

Expand Down Expand Up @@ -137,7 +137,6 @@ sure that the database image is configured according to [this guide](https://doc
* PostgreSQL
* MariaDB
* MySQL
* CockroachDB
* MS-SQL 2017/2019 ([MSSQL-specific configuraion guide](https://docs.camunda.org/manual/latest/user-guide/process-engine/database/mssql-configuration/))

To execute the process engine test suite with a certain database (e.g. PostgreSQL), you should call Maven in the
Expand Down
42 changes: 0 additions & 42 deletions database/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
<version.postgresql>42.5.5</version.postgresql>
<version.liquibase>4.8.0</version.liquibase>

<!-- CockroachDB is compatible with PostgreSQL 9.5,
so a different version of the JDBC driver needs to be used -->
<version.cockroachdb>42.2.9</version.cockroachdb>

<!-- needed for sql script and backward compatibility checks -->
<camunda.version.old>7.21.0</camunda.version.old>

Expand Down Expand Up @@ -383,44 +379,6 @@
<was.liberty.datasource.filename>postgresql-xa-config.xml</was.liberty.datasource.filename>
</properties>
</profile>
<profile>
<id>cockroachdb</id>
<properties>
<database.type>cockroachdb</database.type>
<database.driver>org.postgresql.Driver</database.driver>
<database.datasource.class>org.postgresql.ds.PGSimpleDataSource</database.datasource.class>
<jboss.datasource.filename>postgresql-ds.xml</jboss.datasource.filename>
<hibernate.dialect>org.hibernate.dialect.PostgreSQLDialect</hibernate.dialect>
<database.tc.url>camcockroachdb:20.1.3</database.tc.url>
</properties>

<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${version.cockroachdb}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${version.cockroachdb}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>

<profile>
<id>sqlserver</id>
<properties>
Expand Down
17 changes: 0 additions & 17 deletions distro/sql-script/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,6 @@
<filelist dir="target/camunda-engine-${project.version}/org/camunda/bpm/engine/db/create" files="activiti.postgres.create.engine.sql activiti.postgres.create.case.engine.sql activiti.postgres.create.decision.engine.sql activiti.postgres.create.history.sql activiti.postgres.create.case.history.sql activiti.postgres.create.decision.history.sql" />
</concat>

<concat destfile="target/sql/create/cockroachdb_engine_${project.version}.sql" fixlastline="yes">
<filelist dir="target/camunda-engine-${project.version}/org/camunda/bpm/engine/db/create" files="activiti.cockroachdb.create.engine.sql activiti.cockroachdb.create.case.engine.sql activiti.cockroachdb.create.decision.engine.sql activiti.cockroachdb.create.history.sql activiti.cockroachdb.create.case.history.sql activiti.cockroachdb.create.decision.history.sql" />
</concat>

<!-- add identity create files -->
<copy todir="target/sql/create" flatten="false">
<fileset dir="target/camunda-engine-${project.version}/org/camunda/bpm/engine/db/create" />
Expand Down Expand Up @@ -250,10 +246,6 @@
<filelist dir="target/camunda-engine-${project.version}/org/camunda/bpm/engine/db/drop" files="activiti.postgres.drop.decision.engine.sql activiti.postgres.drop.case.engine.sql activiti.postgres.drop.engine.sql activiti.postgres.drop.decision.history.sql activiti.postgres.drop.case.history.sql activiti.postgres.drop.history.sql" />
</concat>

<concat destfile="target/sql/drop/cockroachdb_engine_${project.version}.sql" fixlastline="yes">
<filelist dir="target/camunda-engine-${project.version}/org/camunda/bpm/engine/db/drop" files="activiti.cockroachdb.drop.decision.engine.sql activiti.cockroachdb.drop.case.engine.sql activiti.cockroachdb.drop.engine.sql activiti.cockroachdb.drop.decision.history.sql activiti.cockroachdb.drop.case.history.sql activiti.cockroachdb.drop.history.sql" />
</concat>

<!-- add identity drop files -->
<copy todir="target/sql/drop" flatten="false">
<fileset dir="target/camunda-engine-${project.version}/org/camunda/bpm/engine/db/drop" />
Expand Down Expand Up @@ -355,15 +347,6 @@
<fileset dir="target/camunda-engine-${project.version}/org/camunda/bpm/engine/db/upgrade" includes="postgres_engine_${camunda.old.majorVersion}.${camunda.old.minorVersion}_patch*.sql" />
</concat>

<!-- cockroachdb patches -->
<concat destfile="target/upgrade-test/sql/upgrade/cockroachdb_engine_${camunda.current.majorVersion}.${camunda.current.minorVersion}_patch.sql" fixlastline="yes">
<fileset dir="target/camunda-engine-${project.version}/org/camunda/bpm/engine/db/upgrade" includes="cockroachdb_engine_${camunda.current.majorVersion}.${camunda.current.minorVersion}_patch*.sql" />
</concat>

<concat destfile="target/upgrade-test/sql/upgrade/cockroachdb_engine_${camunda.old.majorVersion}.${camunda.old.minorVersion}_patch.sql" fixlastline="yes">
<fileset dir="target/camunda-engine-${project.version}/org/camunda/bpm/engine/db/upgrade" includes="cockroachdb_engine_${camunda.old.majorVersion}.${camunda.old.minorVersion}_patch*.sql" />
</concat>

<copy todir="target/upgrade-test/sql/upgrade">
<fileset dir="target/camunda-engine-${project.version}/org/camunda/bpm/engine/db/upgrade">
<include name="*.sql" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,11 @@
*/
package org.camunda.bpm.engine.spring;

import java.sql.SQLException;
import java.util.logging.Logger;

import org.camunda.bpm.engine.impl.ProcessEngineLogger;
import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.camunda.bpm.engine.impl.db.sql.DbSqlSession;
import org.camunda.bpm.engine.impl.interceptor.Command;
import org.camunda.bpm.engine.impl.interceptor.CommandInterceptor;
import org.camunda.bpm.engine.impl.util.ExceptionUtil;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.TransactionSystemException;
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;
Expand All @@ -42,13 +36,9 @@ public class SpringTransactionInterceptor extends CommandInterceptor {
protected ProcessEngineConfigurationImpl processEngineConfiguration;

/**
* This constructor doesn't pass an instance of the {@link ProcessEngineConfigurationImpl} class.
* As a result, if it is used with CockroachDB, concurrency conflicts that occur on transaction
* commit will not be handled by the process engine.
*
* @deprecated use the {@link #SpringTransactionInterceptor(PlatformTransactionManager, int, ProcessEngineConfigurationImpl)}
* constructor to ensure that when used with CockroachDB, concurrency conflicts that occur
* on transaction commit are detected and handled.
* constructor to ensure that concurrency conflicts that occur on
* transaction commit are detected and handled in all cases
*/
@Deprecated
public SpringTransactionInterceptor(PlatformTransactionManager transactionManager, int transactionPropagation) {
Expand All @@ -71,18 +61,7 @@ public <T> T execute(final Command<T> command) {
// don't use lambdas here => CAM-12810
return (T) transactionTemplate.execute((TransactionCallback) status -> next.execute(command));
} catch (TransactionSystemException ex) {
// When CockroachDB is used, a CRDB concurrency error may occur on transaction commit.
// To ensure that these errors are still detected as OLEs, we must catch them and wrap
// them in a CrdbTransactionRetryException
Throwable cause = ex.getCause();
if (cause instanceof SQLException && processEngineConfiguration != null
&& DbSqlSession.isCrdbConcurrencyConflictOnCommit((SQLException) cause, processEngineConfiguration)) {
throw ProcessEngineLogger.PERSISTENCE_LOGGER.crdbTransactionRetryExceptionOnCommit(cause);

} else {
throw ExceptionUtil.wrapPersistenceException(ex);

}
throw ExceptionUtil.wrapPersistenceException(ex);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.camunda.bpm.engine.RepositoryService;
import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration;
import org.camunda.bpm.engine.impl.db.sql.DbSqlSessionFactory;
import org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor;
import org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor;
import org.camunda.bpm.engine.impl.interceptor.CommandInterceptor;
Expand Down Expand Up @@ -74,11 +73,6 @@ public ProcessEngine buildProcessEngine() {
}

List<CommandInterceptor> defaultCommandInterceptorsTxRequired = new ArrayList<CommandInterceptor>();
// CRDB interceptor is added before the SpringTransactionInterceptor,
// so that a Spring TX may be rolled back before retrying.
if (DbSqlSessionFactory.CRDB.equals(databaseType)) {
defaultCommandInterceptorsTxRequired.add(getCrdbRetryInterceptor());
}
if (!isDisableExceptionCode()) {
defaultCommandInterceptorsTxRequired.add(getExceptionCodeInterceptor());
}
Expand All @@ -93,11 +87,6 @@ public ProcessEngine buildProcessEngine() {

protected Collection< ? extends CommandInterceptor> getDefaultCommandInterceptorsTxRequiresNew() {
List<CommandInterceptor> defaultCommandInterceptorsTxRequiresNew = new ArrayList<CommandInterceptor>();
// CRDB interceptor is added before the SpringTransactionInterceptor,
// so that a Spring TX may be rolled back before retrying.
if (DbSqlSessionFactory.CRDB.equals(databaseType)) {
defaultCommandInterceptorsTxRequiresNew.add(getCrdbRetryInterceptor());
}
if (!isDisableExceptionCode()) {
defaultCommandInterceptorsTxRequiresNew.add(getExceptionCodeInterceptor());
}
Expand Down

This file was deleted.

This file was deleted.

Loading