Skip to content

feat: Add Cassandra Wide-Column Backend With Query-First Keys - #9

Open
ThomasHartDev wants to merge 1 commit into
mainfrom
thomas/feat/cassandra
Open

feat: Add Cassandra Wide-Column Backend With Query-First Keys#9
ThomasHartDev wants to merge 1 commit into
mainfrom
thomas/feat/cassandra

Conversation

@ThomasHartDev

Copy link
Copy Markdown
Owner

Cassandra is the wide-column backend of the activity feed. Each query owns a table: users_by_id, users_by_handle, following_by_user, followers_by_user, posts_by_author, posts_by_id. The partition key colocates the rows for that query, and posts_by_author clusters on (created_at DESC, post_id DESC) so a timeline partition is already newest-first.

There is no join and no cross-partition transaction. Handle uniqueness is INSERT IF NOT EXISTS on users_by_handle; if that LWT loses, the store deletes the users_by_id row. The home feed is one posts_by_author read per followee plus a merge, so unfollow stays live. MemoryCassandra is an in-process engine with the same rules: missing partition key or a non-key restriction throws. Contract tests plus partition, clustering, and LWT cases are green locally.

One table per access path, partition keys that colocate a query, and
clustering order so a timeline partition is already newest-first.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant