Cassandra 4: “Clustering key columns must exactly match columns in CLUSTERING ORDER BY directive” at startup

(Jorge Andres Ardila Cardona) #1

Hello everyone,

I was doing a test of new Lagom 1.5.1 version using a simple service with cassandra and postgres (readside) persistence.

For the test I’m using cassandra 4 (I compiled it locally from cassandra’s git repository) and Java 11 (amazon-corretto-

The startup looked good and tables were created in postgress, unfortunately during cassandra’s keyspace initialization the following error arose:

java.util.concurrent.ExecutionException: com.datastax.driver.core.exceptions.InvalidQueryException: Clustering key columns must exactly match columns in CLUSTERING ORDER BY directive

And some of the tables weren’t created in cassandra’s keyspace.

Thank you.


(Sergey Morgunov) #2

Do you talk about runAll command? Do you run service on Dev-mode?
If yes, that Lagom until not support Java 11 on Dev-mode

(Jorge Andres Ardila Cardona) #3

Hi Sergey,

Thanks for your reply, I’m sorry I didn’t detailed that.

I’m running the application on dev-mode but using an external Cassandra 4 installation (that I compiled from current’s Cassandra’s source code).

Also I guess is important to point out that the same application and same Java 11 version works fine with an external Cassandra 3 installation.


(Sergey Morgunov) #4

I think that we have the next situation:

  1. For work with Cassandra 4.X need Cassandra Java Driver 4.x
  2. Akka Persistence Cassandra until not support Cassandra Java Driver 4.x (issue#446). Need waiting release akka-persistence-cassandra#1.0.0.
  3. Lagom use akka-persistence-cassandra#0.61. It has pr#1512 for upgrade, but I think that akka-persistence-cassandra will upgrade to 1.0.0 only in Lagom#1.6.0 (issue#1927)

Summary (IMHO): Before the release Lagom#1.6.0, he will not be able to support Cassandra 4.X.

Maybe somebody of maintainers (@ignasi35, @renato) can share a roadmap of release 1.6.0 or just confirm my assumption.


(Tim Moore) #5

It is possible to update to newer releases of Akka Persistence Cassandra in current versions of Lagom, by overriding a few configuration settings (the same ones that are applied to reference.conf and reference-overrides.conf in

That said, the update to version 4.x of the driver has not yet been done in Akka Persistence Cassandra, and Lightbend has not done any testing so far of either Lagom or Akka Persistence Cassandra with Cassandra 4.0 pre-releases. I wouldn’t expect it to work smoothly at this point. We would be happy to work with community members who want to try Cassandra 4.0. @ja2c86, if you are interested in sending pull requests for 4.0 compatibility, we would welcome and appreciate that (assuming they remain backward compatible with Cassandra 3.x).

If you need some pointers, I think the first step would be to work out which table is triggering the error. If it isn’t indicated in the logs, perhaps you could do try manually running the schema creation statements one at a time to see which one is causing the problem.

(Jorge Andres Ardila Cardona) #6

Hi @TimMoore,

Thanks for your reply, I’ll be happy to help.

I’ll check running manually the schema creation on Cassandra 4.


1 Like