apache / apache/bookkeeper

Clarification on usage of kv_rpc.proto PutRequest expected_version

Open
#2,318 0 comments 0 reactions 1 assignee Claimed by @sijie View on GitHub
triage/week-17 type/question
Dominant language
Java
Stars
2k
Forks
976
Avg merge
6d 15h
Merged PRs (30d)
7

Description

**QUESTION**

The kv_rpc.proto has a field [`expected_version`](https://github.com/apache/bookkeeper/blob/release-4.10.0/stream/proto/src/main/proto/kv_rpc.proto#L175) which I assume is for ensuring that the current version of a key is at the specified version prior to performing a change.

However there are still several open questions about how to properly use this functionality:
1. Is the version check functionality enabled whenever a value is provided here? Thus no value, no version checking?
2. If the above is indeed the case, how do you handle the version check when `version=0`? In protobuf, zero is the equivalent of a field being not provided. So there's no way to differentiate between checking for `version==0` and version checking disabled.
3. How do you do a check to ensure that the given key does *not* exist prior to a write? Can't use `version=0` as per the above 2 questions.

If we could get this added to the documentation on this field, it would be appreciated.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.