Subdomain 1.2: Designing for reliability and fidelity
1.A retail company uses Cloud Bigtable to store user profile data. The application experiences high throughput reads and writes. You need to ensure row-level atomicity for updates that modify multiple columns within a single row. The updates must succeed or fail as a unit. Which approach should you take?
- A.Perform read-modify-write operations on the client side using the Bigtable client library.
- B.Use Bigtable Mutations to group the modifications into a single row mutation request.
- C.Enable multi-row transactions in the Bigtable instance configuration.
- D.Use Cloud Functions to orchestrate the updates to ensure they happen sequentially.
Show answer & explanation
Correct answer: B — Use Bigtable Mutations to group the modifications into a single row mutation request.
- A. Performing read-modify-write operations on the client side (a manual read followed by a write) introduces race conditions and is not atomic. While Bigtable offers a specific ReadModifyWriteRow API for atomic appends and increments, standard multi-column updates should be bundled in a single mutation request to guarantee atomicity without network-trip overhead or consistency risks.
- B. Cloud Bigtable guarantees that all modifications within a single 'MutateRow' request (which can contain multiple column updates, deletions, or 'SetCell' operations) are applied atomically. This ensures that the update for the single row either succeeds completely or fails completely, meeting the requirement for row-level atomicity.
- C. Cloud Bigtable does not support multi-row transactions, and there is no configuration setting to enable them. Atomicity in Bigtable is strictly scoped to the single row level.
- D. Orchestrating updates sequentially using Cloud Functions does not provide atomicity. If a failure occurs midway through the sequence, the data remains in an inconsistent, partially updated state. True atomicity is handled at the storage layer via single-row mutations.