feat: Add Cassandra Wide-Column Backend With Query-First Keys - #9
Open
ThomasHartDev wants to merge 1 commit into
Open
feat: Add Cassandra Wide-Column Backend With Query-First Keys#9ThomasHartDev wants to merge 1 commit into
ThomasHartDev wants to merge 1 commit into
Conversation
One table per access path, partition keys that colocate a query, and clustering order so a timeline partition is already newest-first.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.