From c44544d55e91d6ec01191c4a7f7241fafc53ee4d Mon Sep 17 00:00:00 2001 From: Maxime Wiewiora <48218208+maximevw@users.noreply.github.com> Date: Fri, 17 May 2024 12:50:21 +0200 Subject: [PATCH] Fix/issue 289 (complement) (#296) * 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 --- .../ext/cassandra/lockservice/LockServiceCassandra.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/liquibase/ext/cassandra/lockservice/LockServiceCassandra.java b/src/main/java/liquibase/ext/cassandra/lockservice/LockServiceCassandra.java index 25d5c44b..8910eb43 100644 --- a/src/main/java/liquibase/ext/cassandra/lockservice/LockServiceCassandra.java +++ b/src/main/java/liquibase/ext/cassandra/lockservice/LockServiceCassandra.java @@ -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; @@ -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; @@ -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 {