Search code examples
google-cloud-platformbigtablegoogle-cloud-bigtable

BigTable checkAndMutate atomicity


What is the behaviour of the checkAndMutate function? Let's say I need to get row content before applying checkAndMutate. Is there a chance to retrieve stale data from BigTable? If there is no chance to retrieve stale data, is my thinking good:

  1. Fetch row content by key,
  2. Modify row content in application,
  3. Apply checkAndMutate function on row.

Solution

  • CheckAndMutate is atomic. Here is the API definition. There is a chance that there was a change between step #1 and #3. Your checkAndMutate should ensure that the timestamp for the cells you care about are the same values as #3 to ensure that you're updating the same data that you read.