Why an inverse edge can be left hanging

video locked
Enroll to watch

8 mins

Chapters
About
Discussion0
Notes
Be the first to start a conversation!

A hanging edge is an inverse edge that exists without its original edge.

Objects are sharded by object ID, and edges by their source ID. Gaurav and every like he has made sit in one shard, so a query for his likes goes to one place. This is data locality. The number of logical shards is much larger than the number of databases, which keeps their load almost uniform.

A like is two associations, and the problem starts there:

  1. User U1 likes post P1. The like goes to the shard that the hash of U1 gives.
  2. The inverse, liked by, has P1 as its source, so it goes to a different shard.
  3. The source cache calls the remote destination cache, which hits its database and responds. Only then does the source cache write to its database.
  4. A failure in between leaves liked by without the like.

A two-phase commit is slow, and a quorum has to wait. TAO repairs these edges with a job that runs periodically, so the system is mostly consistent.