@earth-app/collegedb
    Preparing search index...

    Function pruneEpochs

    • Drops the placement epochs no row depends on.

      An epoch is removed only when a complete ownership census proves it. The fence goes up on every shard first, so a writer on an older topology generation can no longer create a row that only a discarded epoch would find. Then every named table on every shard is read in keyset pages, and each row is attributed to the newest epoch whose owner is the shard it sits on. A row pinned by a placement exception that has a mapping to its shard depends on no epoch. The census runs twice, and the pruned manifest is published with a compare-and-swap only when both passes agree. The newest epoch is never removed. A zero-move rebalance is not proof and is not accepted in its place.

      The fence covers builder writes (insertInto, upsert and the helpers on them). Raw SQL issued outside CollegeDB, and raw run() statements, bypass it; stop those writers before pruning.

      Parameters

      • options: PruneOptions

        Tables to scan, key columns, dryRun, pageSize and concurrency

      Returns Promise<PruneReport>

      The epochs removed and retained, the rows depending on each, and the rows read

      JOURNAL_NOT_CONFIGURED without journalShard; PRUNE_REFUSED when the proof is incomplete

      1.4.0

      const preview = await pruneEpochs({ tables: ['users', 'posts'], dryRun: true });
      if (preview.dependents[1] === 0) {
      await pruneEpochs({ tables: ['users', 'posts'] });
      }