JanusGraph / JanusGraph/janusgraph
Support IDBlock's update in CAS mode when use HBase backend
- Dominant language
- Java
- Stars
- 5.8k
- Forks
- 1.2k
- Avg merge
- 13h 53m
- Merged PRs (30d)
- 6
Description
**ConsistentKeyIDAuthority#getIDBlock** are not so efficient, it works like this(Suppose we use HBase backend)
1. make a Get request to obtain all the Cells of the target rowkey(value is partitionKey)
2. Iterator the returned Cells to determine the _nextStart_ ID, and compute the _nextEnd_ ID (_nextEnd_ = _nextStart_ + blockSize)
3. make a Mutate request to write a target Cell, it’s column name start with _nextEnd_ (ConsistentKeyIDAuthority#getBlockApplication)
4. make a Get request to obtain all the Cells which column name prefix with _nextEnd_, If our claim is the lexicographically first one, we own this id block. Else we should delete the Cell and try again.
After a time, there can be lots of Cells with the target partitionKey, and the query efficiency will be very low.
So how about do this in CAS model, since hbase already have **Table#checkAndPut** to support this. And just one Cell with each partitionKey is enough.
Contributor guide
Research direction
Start by tracing ConsistentKeyIDAuthority#getIDBlock and getBlockApplication to understand the current HBase reads, mutations, and claim checks. Review HBase Table#checkAndPut and determine how the CAS flow would preserve ID-block ownership with one Cell per partitionKey; done means the proposed update works correctly in CAS mode without accumulating competing Cells.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100