From where Cassandra takes time for WRITETIME when it is writing data in the database?

Viewed 132

When Cassandra is writing data to the database it is writing it with the WRITETIME. My question is will that time be from the servers where Cassandra is running or from the servers where the application that is writing data to Cassandra is running?

The background is that we have a problem with writetime some data was written with WRITETIME in the future (07-02-2036) which implies that something is wrong with NTP maybe, but it is not clear which machines are causing the problem Cassandra servers or application servers.

1 Answers

It depends on the version of driver that is used in your applications. For a long time, writetime was the server time, but at some point the switch happened and the write time started to be sent by drivers (it was introduced in version 3 of Cassandra native protocol). As result of that, you need to have NTP running on both Cassandra & application nodes.

For Java driver it's by default starting with version 3.0, for other drivers it should be similar, around the same time (~2016th). From java driver docs:

Client-side generation: This is enabled by default if you’re using the driver 3.0+ and a version of Cassandra that supports native protocol v3 or above.

But writetime could be also set explicitly, so you may also check if your applications are doing that.

Related