patka / cassandra-migration

Schema migration library for Cassandra
MIT License
152 stars 47 forks source link

dateOf() is removed from Cassandra 5.0 #83

Closed vals-productions closed 9 months ago

vals-productions commented 10 months ago

Previously dateOf was deprecated.

WARN The function 'dateof' is deprecated. Use the function 'toTimestamp' instead.

Appears it was removed from 5.0 per changelog:

I realized cassandra migration fails with the exception while playing with cassandra 5.0:

com.datastax.driver.core.exceptions.InvalidQueryException: Unknown function dateof called at com.datastax.driver.core.Responses$Error.asException(Responses.java:181) ~[cassandra-driver-core-3.7.2.jar:na] at com.datastax.driver.core.SessionManager$4.apply(SessionManager.java:250) ~[cassandra-driver-core-3.7.2.jar:na] at com.datastax.driver.core.SessionManager$4.apply(SessionManager.java:219) ~[cassandra-driver-core-3.7.2.jar:na] at com.google.common.util.concurrent.Futures$AsyncChainingFuture.doTransform(Futures.java:1442) ~[guava-19.0.jar:na] at com.google.common.util.concurrent.Futures$AsyncChainingFuture.doTransform(Futures.java:1433) ~[guava-19.0.jar:na] at com.google.common.util.concurrent.Futures$AbstractChainingFuture.run(Futures.java:1408) ~[guava-19.0.jar:na] at com.google.common.util.concurrent.Futures$2$1.run(Futures.java:1177) ~[guava-19.0.jar:na] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na] at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.0.56.Final.jar:4.0.56.Final] at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

Makes sense to tweak the code to use toTimestamp as suggested in above warning. Per my observation the function is used for migration table timestamp columns.

patka commented 10 months ago

Thanks for the callout. I will see that I take care of it in the next couple of weeks. I need to do some testing as well to make sure it works correctly with existing data.

denniskline commented 9 months ago

Hi @patka , do you mind if I submit a PR to switch dateOf to toTimestamp? We have begun extensive testing of Cassandra 5x and would really like to be able to use cassandra-reaper. Thank you

patka commented 9 months ago

Hi @denniskline, not at all. That would certainly speed things up a bit. Thanks already!

denniskline commented 9 months ago

Thank you @patka, happy to help!

denniskline commented 9 months ago

Hi @patka, PR opened: https://github.com/patka/cassandra-migration/pull/84 Please let me know if you'd like it adjusted. Thanks!

patka commented 9 months ago

Awesome, thanks a lot! I will have a look latest on the weekend as I have some calls in the evening hours with teams in other time zones this week. Probably won't have time before the weekend.

Thanks again for your effort!

patka commented 9 months ago

PR is merged and a new release (v2.6.1_v4) is created. It takes some time to be distributed in the network but should be available within the next couple of hours.