Skip to content

performDatadirDump

performDatadirDump(pglite, compression, startPerf): Promise<{ checkpointMs: number; checkpointStartedAtMs: number; dumped: File | Blob; dumpMs: number; dumpStartedAtMs: number; }>

Defined in: packages/client/src/export-store.ts:216

The datadir dump both exports share (ADR-0035): a CHECKPOINT through the store’s normal query path, then dumpDataDir. The store backup keeps its bytes as the artefact; the diagnostic dump feeds them to a throwaway clone. Factored out so exactly one implementation of “flush + tar the live datadir” exists — performStoreExport and performDiagnosticExport cannot drift on the checkpoint ordering or the timing house style. Returns the raw dumpDataDir output plus the two phase walls, both offset from startPerf (the caller’s export-start monotonic anchor) so the timings compose into either report.

The CHECKPOINT is a utility statement — Drizzle has no builder for it, so a raw exec is the justified tier-③ form here. Running it via pglite.exec serialises it behind any in-flight engine work on PGlite’s single connection, flushing dirty buffers to the datadir the dump then reads — so the tarball reflects committed state, not a torn mid-write datadir.

Pick<ClientPGlite, "exec" | "dumpDataDir">

"none" | "gzip" | "auto"

number

Promise<{ checkpointMs: number; checkpointStartedAtMs: number; dumped: File | Blob; dumpMs: number; dumpStartedAtMs: number; }>