thelastpickle/cassandra-reaper

Cassandra 5x: removal of deprecated dateof function causes startup failure in cassandra-migration library

Opened this issue · 2 comments

Project board link

Running reaper against a 5.0.0-alpha2 cluster fails performing Database migration due to the removal of "dateof".

2023-11-09 14:50:59,509 [ERROR] [main] i.c.ReaperApplication - Storage is not ready yet, trying again to connect shortly... com.datastax.driver.core.exceptions.InvalidQueryException: Unknown function dateof called at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:50) at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:35) at com.datastax.driver.core.AbstractSession.prepare(AbstractSession.java:86) at org.cognitor.cassandra.migration.Database.<init>(Database.java:142) at org.cognitor.cassandra.migration.Database.<init>(Database.java:127) at org.cognitor.cassandra.migration.Database.<init>(Database.java:123) at io.cassandrareaper.storage.cassandra.MigrationManager.initializeCassandraSchema(MigrationManager.java:75) at io.cassandrareaper.storage.cassandra.MigrationManager.initializeAndUpgradeSchema(MigrationManager.java:59) at io.cassandrareaper.storage.cassandra.CassandraStorageFacade.<init>(CassandraStorageFacade.java:144) at io.cassandrareaper.storage.InitializeStorage.initializeStorageBackend(InitializeStorage.java:66) at io.cassandrareaper.ReaperApplication.tryInitializeStorage(ReaperApplication.java:438) at io.cassandrareaper.ReaperApplication.run(ReaperApplication.java:177) at io.cassandrareaper.ReaperApplication.run(ReaperApplication.java:87) at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:59) at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:98) at io.dropwizard.cli.Cli.run(Cli.java:78) at io.dropwizard.Application.run(Application.java:94) at io.cassandrareaper.ReaperApplication.main(ReaperApplication.java:99) Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: Unknown function dateof called at com.datastax.driver.core.Responses$Error.asException(Responses.java:181) at com.datastax.driver.core.SessionManager$4.apply(SessionManager.java:249) at com.datastax.driver.core.SessionManager$4.apply(SessionManager.java:218) at com.google.common.util.concurrent.AbstractTransformFuture$AsyncTransformFuture.doTransform(AbstractTransformFuture.java:211) at com.google.common.util.concurrent.AbstractTransformFuture$AsyncTransformFuture.doTransform(AbstractTransformFuture.java:200) at com.google.common.util.concurrent.AbstractTransformFuture.run(AbstractTransformFuture.java:111) at com.google.common.util.concurrent.MoreExecutors$5$1.run(MoreExecutors.java:992) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:748)

This is an issue in a dependent library:
https://github.com/patka/cassandra-migration/blob/v2.4.0/cassandra-migration/src/main/java/org/cognitor/cassandra/migration/Database.java#L71

Once cassandra-migration is updated, this issue can be resolved with a change to the reaper pom.xml

It seems that the fix is available only for driver version 4+, ie the cassandra driver would need to be upgraded to use it, which would require refactoring and upgrading of the entire reaper project.

In addition to migrating everything to use the new driver version, there are few libraries that do not have a direct upgrade path to driver version 4+, for example https://github.com/composable-systems/dropwizard-cassandra, which has been deprecated in 2018