Skip to content

The versions code is a varint stored per block in stats revision 2 (SPEC V737, spec section 5.9). It lets a reader know whether a block holds at most one version of each user key. Revision 1 frames have no versions code, see Stats revision 1.

  • 0 means unknown.
  • Otherwise the code is 1 + 2 x dups + cont.
Term Meaning
dups Entries whose user key equals the previous entry’s in the block. dups is less than max(entries, 1).
cont 1 if the first entry’s user key equals the previous block’s last user key, else 0

To decode a non-zero code, subtract 1: the low bit is cont and the rest, shifted right by one, is dups.

A block holds single versions if and only if dups = 0 and cont = false and deletes = 0. Here deletes is the field of the same name in the block’s stats record. The multi-version keys are described on MVCC keys.