pub fn compute_vnode_from_row_id(id: RowId, vnode_count: usize) -> VirtualNode
Expand description
Compute vnode from the given row id.
ยงvnode_count
The given vnode_count
determines the valid range of the returned vnode. It does not have to
be the same as the vnode count used when the row id was generated with RowIdGenerator
.
However, only if they are the same, the vnode retrieved here is guaranteed to be the same as when it was generated. Otherwise, the vnode can be different and skewed, but the row ids generated under the same vnode will still yield the same result.
This is okay because we rely on the reversibility only if the serial type (row id) is generated and persisted in the same fragment, where the vnode count is the same. In other cases, the serial type is more like a normal integer type, and the algorithm to hash or compute vnode from it does not matter.