Skip to content

DictNovelty overflow special case keyed on 0xFFFF never fires #1843

Open

Description

@bplatz

fluree-db-core/src/dict_novelty.rs and fluree-db-core/src/ns_vec_bi_dict.rs each define a private NS_OVERFLOW: u16 = 0xFFFF, but the overflow namespace is fluree_vocab::namespaces::OVERFLOW = 0xFFFE (0xFFFF is the Sid::max() sentinel). The dedicated overflow handling keyed on 0xFFFF never runs:

  • NsVecBiDict has scalar watermark/next-id fields and a separate entry vector so that overflow subjects do not resize the per-namespace vectors to 65,536 entries. Real overflow subjects (0xFFFE) take the ordinary per-namespace path, so a ledger with any overflow subject in novelty grows those vectors to 65,535 entries.
  • DictNovelty::with_watermarks / retire_seen_through split off an overflow watermark at index 0xFFFF. The index root serializes the watermark count as a u16, so that index can never exist.

This is not a correctness bug today. The indexer also treats 0xFFFE as an ordinary watermark slot (incremental_resolve.rs), so novelty and the index agree on local-id allocation.

Options:

  1. Point the constants at namespaces::OVERFLOW so overflow subjects use the dedicated path. The persisted watermark vector already carries index 0xFFFE, so with_watermarks would extract it correctly. This still changes allocation, retirement, and layer_above behaviour for overflow subjects and needs tests covering commit → index → retire with overflow subjects.
  2. Delete the dead overflow special case and document that overflow is an ordinary slot.

The comments were corrected to describe current behaviour in #1829; the code was left unchanged.

Activity

  1. added
    P3
    area:storage
    performance
    on Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3area:storageperformance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions