tsgrpc_kvstore driver - how to signal `generation_if_equal` mismatch on write?

Open
#251 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
28/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp, grpc
Domain
api, backend

Research direction

Start with the WriteRequest and WriteResponse proto comments and the linked PerformWriteback code in transaction.cc. Trace how generation_if_equal, an unknown generation, and GenerationAndTimestamp are handled, then document the expected mismatch response, retry behavior, and timestamp meaning; verify the explanation against the reported write sequence.

Written by the indexing model from the issue text.

Description

Hi,

I'm trying to implement a gRPC service for the tsgrpc_kvstore driver, and trying to understand how to correctly support the generation_if_equal option for WriteRequest. In particular, how to handle the case where the generation does not match - the comment in the proto says "the write is aborted" on a mismatch, what exactly does this mean?

Both returning an error from the RPC and returning an error in the WriteResponse.status field leads to the TensorStore write to fail immediately, which leads me to believe this is not what I should do?

Looking at PerformWriteback I see that the transaction is re-tried if the returned generation is "unknown" (== empty). However if I try this, TensorStore just sends writes with generation_if_equal=StorageGeneration::NoValue() in a loop, instead of what I would expect:

  1. Attempt a write with an old generation, receive StorageGeneration::Unknown
  2. Issue a read to obtain the current value of the file
  3. Issue a new write, with the update generation and value

thank you!

PS: I'm also a bit unclear what I should use for the timestamp value of GenerationAndTimestamp - is this intended to be the current time of the gRPC server? The last modified time of the file?

Dominant language
C++
Stars
1.6k
Forks
151
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from google/tensorstore

All issues in google/tensorstore

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.