Understanding the Cassandra journal table design. why timestamp in the primary key?

Hi,

Looking at the doc, I have a question about the akka.messages table. Why is timestamp included in the primary key?

If I understand the doc correctly, it is needed by the events by tag query, not by the persistent actors.
It seems that it shouldn’t be part of the primary key.
One problem I see is that when two writers (serializers) are persisting two events for the same entity ID and sequence number but with different timestamp (since its value is generated by the serializer, which is my understanding after checking the source code.), the conflict won’t be detected by any writer. The problem will show up when the actor recovers from events.
If timestamp were not in the primary key, at least one of the two writers would fail.

1 Like

here, I have assumed using INSERT with IF NOT EXISTS when writing to the event journal.