apple / apple/foundationdb

Cannot add read conflict range to meta-data version key without system key access

Open
#1,493 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
16.7k
Forks
1.6k
Avg merge
1d 20h
Merged PRs (30d)
126

Description

The meta-data version key (i.e., `\xff/metadataVersion`) can be read without system key access. However, if one adds a read conflict range to it using `Transaction::addReadConflictKey`, then one gets a "Key outside legal range (2004)" error (which is the same error one would get without any other key in the `\xff` range). If one turns on the read system keys or access system keys options, then the error goes away, but given that this key can be read by the user, it seems like it would make sense for them to be able to add a read conflict range, too.

Something like this reproduces:

```python
tr = db.create_transaction()
tr.add_read_conflict_key(b'\xff/metadataVersion')
tr.commit().wait()
```

~(It's also a little weird that it's the commit that fails rather than the invocation of the `add_read_conflict_key` function. In Java, it's adding the conflict range itself that fails.)~

Contributor guide

Open the contributing guide

Research direction

Start with the Python reproduction using Transaction::addReadConflictKey on b'\xff/metadataVersion' and compare its behavior with the Java API, where the issue says adding the conflict range fails earlier. Trace the system-key access checks and existing tests for metadataVersion or read conflict ranges. Done means the conflict range can be added and committed without enabling system-key access, with matching behavior covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, java, python
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.