patka / cassandra-migration

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

Spring Actuator support #69

Open rbleuse opened 2 years ago

rbleuse commented 2 years ago

Hi Patrick,

I'd like to implement an actuator endpoint to check migration status, similar to https://github.com/patka/cassandra-migration/pull/39 This PR targets the v3 branch, and things changed quite a bit with the v4 driver so we can't just port this solution to the v4 branch.

Furthermore, since the session is closed after migrations, we definitely can't just create a Database bean as we can't reuse it after migrations.

The solution could be to manually re-create a Database with a custom cqlsession but that's not ideal, as it'd require to potentially create 2 identical manual sessions (one for migrations and one for actuator). Fortunately for spring-data-cassandra users with same migration keyspace as the spring-data one, we can reuse the latter one. But then, the Database class logic is to check the keyspace status and create it/create tables, which in the case of an actuator feature is useless and delay our Spring app startup as this process has already been handled by the migration (considering migrations are done before initializing the actuator bean).

Do you have an idea ?

patka commented 1 year ago

Hey Rémi

sorry for the way too long delay. Let me look into this and get back to you.