Skip to content

Record has_list_meta on bulk-import roots so the hydration skip applies to large ledgers #1685

Closed

Description

@bplatz

Raised in review of #1675.

Problem

#1675 added IndexRoot.has_list_meta: Option<bool>; when both it and Novelty.has_list_meta say "no list rows", filtered-DELETE staging skips list-meta hydration entirely.

Bulk import leaves the flag None (untracked) — see the comment at fluree-db-api/src/import.rs:6837. None is correct-but-conservative: the write path keeps hydrating until the first full rebuild records the flag exactly. The result is that the skip does not apply to bulk-imported ledgers, which are precisely the ones large enough for the cost to matter.

Correctness is unaffected either way. This is purely about the optimization reaching the ledgers that need it.

Why it is not a one-liner

write_record (fluree-db-transact/src/import_sink.rs:467) has the list index in hand, but it runs per chunk. A bool set there would have to ride both SpoolResult and BufferedSpoolResult and then be OR-folded across chunks at root assembly.

Suggested approach

Put the sticky bit on the shared SpoolConfig, alongside numbig_pool / vector_pool / ns_alloc, rather than threading it through the two result types:

  • saw_list_meta: Arc<AtomicBool> on SpoolConfig.
  • A plain bool on SpoolContext, OR'd in write_record only on the i != LIST_INDEX_NONE branch — no per-record atomic traffic.
  • One relaxed store at SpoolContext::finish / finish_buffered.
  • Read it at root assembly in import.rs and set has_list_meta: Some(saw_list_meta) instead of None.

This mirrors how has_annotations is derived at the same site, which reads a merged global structure (the predicate dict) rather than per-chunk state.

Testing note

The bulk-import path gets no coverage from #1675's tests. Whatever lands here needs its own: an import with no lists asserting the root records Some(false), and an import with a @list asserting Some(true) — the second matters most, since a wrongly-false root would skip hydration and silently drop list retractions.

Origin

Review of #1675.

Activity

  1. added
    enhancement
    on Aug 25, 2026
  2. added
    P2
    area:transact
    on Aug 25, 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

    P2area:transactenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions