Life of a Datastore Write
Posted on 2013-11-07 03:02:45 +0900 in Technology
An Insert
When we call put or makePersistent, several things happen behind the scenes before the call returns and sets the entity’s key:
- The my_todo object is converted into a protocol buffer.
- The appserver makes an RPC call to the datastore server, sending the entity data in a protocol buffer.
-
If a key name is not provided, a unique ID is determined for this entity’s key. The entity key is composed of app ID ancestor keys kind name key name or ID - The datastore server processes the request in two phases that are executed in order: commit, then apply. In each phase, the datastore server identifies the Bigtable tablet servers that should receive the data.
The Commit Phase
The datastore performs two actions in the commit phase:
- It writes the data for the entities to the entity group’s log.
- It marks the new log entry as committed.
The Apply Phase
In the apply phase, the entity’s data and the index rows are written to disk in parallel.
The Return Value
Using HRD, the Datastore returns after the commit and does the apply asynchronously.
Hide Comments
comments powered by Disqus