On 2010-03-19 19:16, Gary wrote: > I am a newbie to bigtable like model and have a question as follows. > Take Digg as an example, I want to find a list users who dug a URL and > also want to find a list of URLs a user dug. How should the data model > look like for the queries to be efficient? If I use the username and the > URL for two rows, when a user digs a URL, I will have to update two rows > so I need a transaction to keep data consistent.
Yes, you need to insert two items into Cassandra. There are a few solutions to the consistency issue: (1) Live with it. For a site like Digg, immediate consistency just isn't that important. (2) Treat one direction as the canonical source. When reading from the other direction, verify that each item exists in the other direction. (3) Add locking above Cassandra, using a system like ZooKeeper. (4) Don't use Cassandra. -- David Strauss | da...@fourkitchens.com Four Kitchens | http://fourkitchens.com | +1 512 454 6659 [office] | +1 512 870 8453 [direct]
signature.asc
Description: OpenPGP digital signature