Skip to content

Commit

Permalink
Fix/issue 289 (complement) (#296)
Browse files Browse the repository at this point in the history
* Add alternative execution for counting queries in lock service

As explained in the issue #289, the aggregate functions are not supported by AWS Keyspaces.
This fix tries to execute counting queries and if it fails, the same query without the COUNT
function is executed and the returned rows are counted programmatically.

Also removes code specific to `MSSQLDatabase` in `LockServiceCassandra` obviously not related
with Liquibase implementation for Cassandra.

* Remove build folder and update .gitignore

* Fix issue #289: override isDatabaseChangeLogLockTableInitialized with parameter forceRecheck
  • Loading branch information
maximevw committed May 17, 2024
1 parent 07e6265 commit c44544d
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import liquibase.Scope;
import liquibase.database.Database;
import liquibase.database.ObjectQuotingStrategy;
import liquibase.database.core.MSSQLDatabase;
import liquibase.exception.DatabaseException;
import liquibase.exception.LiquibaseException;
import liquibase.exception.LockException;
Expand All @@ -12,8 +11,6 @@
import liquibase.executor.ExecutorService;
import liquibase.ext.cassandra.database.CassandraDatabase;
import liquibase.lockservice.StandardLockService;
import liquibase.sql.Sql;
import liquibase.sqlgenerator.SqlGeneratorFactory;
import liquibase.statement.core.LockDatabaseChangeLogStatement;
import liquibase.statement.core.RawSqlStatement;
import liquibase.statement.core.UnlockDatabaseChangeLogStatement;
Expand Down Expand Up @@ -147,8 +144,8 @@ public boolean isDatabaseChangeLogLockTableCreated() {
}

@Override
public boolean isDatabaseChangeLogLockTableInitialized(final boolean tableJustCreated) {
if (!isDatabaseChangeLogLockTableInitialized) {
public boolean isDatabaseChangeLogLockTableInitialized(final boolean tableJustCreated, final boolean forceRecheck) {
if (!isDatabaseChangeLogLockTableInitialized || forceRecheck) {
Executor executor = Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", database);

try {
Expand Down

0 comments on commit c44544d

Please sign in to comment.