Skip to content

Export snapshots through disk-manager-admin#6567

Open
BarkovBG wants to merge 5 commits into
ydb-platform:mainfrom
BarkovBG:users/barkovbg/exporter-reuse-snapshot-source
Open

Export snapshots through disk-manager-admin#6567
BarkovBG wants to merge 5 commits into
ydb-platform:mainfrom
BarkovBG:users/barkovbg/exporter-reuse-snapshot-source

Conversation

@BarkovBG

@BarkovBG BarkovBG commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Adds raw snapshot export to disk-manager-admin snapshots export (also
available as snapshot export). The command streams raw snapshot bytes to
stdout, writes logs to stderr; parallelism of chunk reads is controlled by
--read-workers.

disk-manager-admin \
    --server-config /etc/disk-manager/server-config.txt \
    snapshots export --id <snapshot-or-image-id> > image.raw

Structure

  • [Disk Manager] Add disk-manager-export-snapshot tool — the original
    standalone export tool.
  • Export snapshots through disk-manager-admin (authored by @EvgeniyKozev) —
    the export feature squashed from the codex/export-snapshot-stdout branch.
  • Share chunk size constant through dataplane/common — the dataplane package
    and the exporter kept two copies of the 4 MiB chunk size that had to stay
    equal; ChunkSize now lives next to the Chunk type.
  • Add Chunk.String to keep chunk formatting cheap — formatting a chunk with
    fmt reflects over the whole 4 MiB Data slice; test mock argument diffs
    format chunk arguments on every mocked ReadChunk call, which made
    timing-sensitive exporter tests flaky and slow.
  • Rework snapshot exporter on top of snapshotSource — chunk map streaming,
    entry caching and zero chunk detection are delegated to
    snapshot.NewSnapshotSource, the same source implementation that dataplane
    transfer tasks use. The exporter is an ordered pipeline: the scheduler emits
    chunks in stream order (filling chunk map gaps with zero chunks), a bounded
    set of readers fills data chunks concurrently, and the writer streams
    everything strictly in order. Read-ahead is enforced by the source inflight
    queue, so the chunk map does not have to reside in memory. Single-process
    export is sufficient, so partitioned export is removed.

Testing

  • Exporter unit tests: raw stream layout (data, explicit zero, chunk map
    holes, partial last chunk), concurrency (parallel reads, ordered output,
    bounded read-ahead), error paths and chunk map validation.
  • dataplane/common unit tests pass; disk-manager-admin and disk-manager
    build.
  • End-to-end snapshot_export_test (YDB and S3, checksum verification of the
    exported stream) runs as a LARGE test.

BarkovBG and others added 2 commits July 21, 2026 18:10
Reads all chunks of a ready snapshot (or image) directly from the
dataplane storage (chunk map in YDB, chunk data in S3 or YDB), verifies
checksums and assembles them into a local raw image file. Zero chunks
are skipped, so the output is sparse where possible; incremental
snapshots need no special handling since their chunk map is complete.
@BarkovBG
BarkovBG force-pushed the users/barkovbg/exporter-reuse-snapshot-source branch from 2675f1a to 4d2419e Compare July 21, 2026 15:26
@BarkovBG BarkovBG changed the title Reuse snapshotSource for chunk map reading in snapshot exporter Export snapshots through disk-manager-admin Jul 21, 2026
@BarkovBG
BarkovBG changed the base branch from codex/export-snapshot-stdout to main July 21, 2026 15:26
BarkovBG added 3 commits July 21, 2026 19:15
The dataplane package and the snapshot exporter kept two copies of the
4 MiB chunk size that had to stay equal. ChunkSize now lives next to the
Chunk type in dataplane/common; the dataplane package aliases it and the
exporter uses it directly.
Formatting a chunk with fmt reflects over the whole multi-megabyte Data
slice. Test mock argument diffs format chunk arguments on every mocked
ReadChunk call, which makes timing-sensitive exporter tests flaky.
Chunk map streaming, entry caching and zero chunk detection are delegated
to snapshot.NewSnapshotSource — the same source implementation that
dataplane transfer tasks use. The exporter itself is an ordered pipeline:
the scheduler emits chunks in stream order, filling chunk map gaps with
zero chunks, a bounded set of readers fills data chunks concurrently, and
the writer streams everything to the destination strictly in order.
Read-ahead is enforced by the source inflight queue, so the chunk map does
not have to reside in memory.

Single-process export is sufficient, so the --partition and
--partition-count flags are removed and the command exports the whole
snapshot. The encryption warning now matches the command help: exported
data of an encrypted disk is the stored ciphertext.
@BarkovBG
BarkovBG force-pushed the users/barkovbg/exporter-reuse-snapshot-source branch from 5a78278 to 88224e5 Compare July 21, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants