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

Fix #289: Add alternative execution for counting queries in lock service #292

Merged
merged 2 commits into from May 9, 2024

Conversation

maximevw
Copy link
Contributor

@maximevw maximevw commented May 4, 2024

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.

Copy link
Contributor

@filipelautert filipelautert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @maximevw !

@@ -62,19 +64,6 @@ public boolean acquireLock() throws LockException {
// another node was faster
return false;
}
if ((rowsUpdated == -1) && (database instanceof MSSQLDatabase)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for removing the trash here.

}
try {
return executor.queryForInt(new RawSqlStatement(query));
} catch (DatabaseException e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice workaround!

@filipelautert filipelautert self-assigned this May 6, 2024
As explained in the issue liquibase#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.
Copy link

sonarcloud bot commented May 6, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@filipelautert filipelautert merged commit 07e6265 into liquibase:main May 9, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants