Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

fwy_187020 avatar image
fwy_187020 asked Erick Ramirez edited

Does the Java driver have support for waiting for schema agreement?

[FOLLOW UP QUESTION TO #11943]

I have a follow up question. Currently, we throttle the amount of concurrent Cassandra activity by limiting the number of background threads that are dropping-creating tables. However, within these threads our application issues the DDL commands through the Java driver in sequence. To be safe, it sounds like we should be waiting for a pause in this activity before issuing the next command. Does the Java driver have support for either waiting (synchronous) or event listeners (asynchronous) that could signal our application when a previously issued schema change has been completely processed? Given the latency of processing schema changes across a Cassandra cluster, it seems that a feature like this would be important in order to avoid schema corruption.

schema
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered Erick Ramirez edited

There are APIs available in all the drivers that allow you to check for schema agreement.

When you execute a DDL statement with the Java driver, you can run isSchemaInAgreement() to check for success or failure. You can also run checks on demand with checkSchemaAgreement() or the equivalent asynchronous checkSchemaAgreementAsync(). See the Schema metadata page of the Java driver docs for details.

There are additional recommendations in the Performance section of the docs you should be aware of when making schema changes programatically including sending all DDL changes to the same coordinator, disabling the metadata on all other clients/app instances and only initiating changes from one app instance. Cheers!

1 comment Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

That sounds perfect, I will review these APIs -- thanks.

[Post converted to a comment since it's not an "answer"]

0 Likes 0 ·