Skip to content

DynamicCollection does not free the pages of old indexes on DropIndex and VacuumAsync(RebuildIndexes) #211

Open

Description

@mrdevrobot

Version: main (efacaf4).

What happens

Typed collections free an index's pages when it is dropped or replaced (CollectionIndexManager.DropIndex, ReplaceIndex). DynamicCollection doesn't, for any index kind:

  • DropIndex (DynamicCollection.cs:1737-1742) removes the index from the dictionary and calls PersistIndexMetadata(), but never frees the tree.
  • VacuumAsync(RebuildIndexes = true) (:1511, persisted at :1615) builds fresh indexes and overwrites the entries, leaving every old tree unreachable.

Each drop and each rebuild therefore leaks a full tree. It also skips documents that ReadDocumentAt can't read without reporting them, unlike the typed rebuild since #170.

Expected

Same behaviour as typed collections: collect the old tree's pages (B-Tree, vector, spatial once #205 lands) and free them after the swap is persisted; on a failed rebuild, collect the copy's pages through the transaction before rolling back, as RebuildIndexFromScratchAsync does.

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

    area/indexingB-Tree and secondary indexes, index lifecyclebugSomething isn't workingpackage/coreAffects BLite.Corepriority/P2Should be in the next minor release if time allowsseverity/mediumSpace leak, inconsistency or failure in a narrow scenario

    Type

    No type

    Projects

    • Status
      Todo

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions