documentation/sphinx/source/bulkdump.rst
############################## BulkDump (Dev) ##############################
| Author: Zhe Wang | Reviewer: Michael Stack, Jingyu Zhou | Audience: FDB developers, SREs and expert users.
In a FoundationDB (FDB) key-value cluster, every key-value pair is replicated across multiple storage servers. The BulkDump tool is developed to dump all key-value pairs within the input range to files. Note that when the input range is large, the range is split into smaller subranges. Each subrange of data is dumped to a file at a version. All data within a file is at the same version. However, versions can differ across files.
When a user wants to start a bulkdump job, the user provides the range to dump and the path root of where to dump the data.
The range can be any subrange within the user key space (i.e. "" ~ \\xff).
Dumping the data of the system key space and special key space (i.e. \\xff ~ \\xff\\xff\\xff) is not allowed.
The path root can be either a blobstore url <https://apple.github.io/foundationdb/backups.html#backup-urls>_ or a path on the file system.
Given the input range, if the range is large, the range is split into smaller subranges.
Each subrange is dumped at a version to a folder. In particular, the folder is organized as following:
{rootLocal}/{relativeFolder}/{dumpVersion}-manifest.txt (must have){rootLocal}/{relativeFolder}/{dumpVersion}-data.sst (omitted if the subrange is empty){rootLocal}/{relativeFolder}/{dumpVersion}-sample.sst (omitted if data size is too small to have a sample)The relativeFolder is defined as :file:{JobId}/{TaskId}/{BatchId}.
The dumpVersion is the version of the data stored in the :file:{dumpVersion}-data.sst file.
At any time, a FDB cluster can have at most one bulkdump job running.
A bulkdump job is partitioned into tasks per subrange and subranges never span a shard boundary.
When dumping the subrange of a task, the data is collected in batches. All key-value pairs of a batch are collected at the same version.
Above all, JobId is the unique ID of a job. TaskId is the unique ID of a task. BatchId is the unique ID of a batch.
All tasks's data files of the same job are located at the same Job folder named by the JobId.
A task can consist of multiple batches, where each batch has a distinct version. However, all the data within a single batch shares the same version.
Each relativeFolder corresponds to exactly one subrange with exactly one manifest file.
The manifest file includes all necessary information for loading the data from the folder to a FDB cluster.
The manifest file content includes the following information:
In the job folder, there is a global manifest file named :file:job-manifest.txt that lists all ranges and their corresponding manifest files.
When loading a cluster, users can use this global manifest to rebuild the data.
Currently, FDBCLI tools and low-level ManagementAPIs are provided to submit a job or clear a job. These operations are achieved by issuing transactions to update the bulkdump metadata. Submitting a job is achieved by writing the job metadata to the bulkdump metadata range of the job. When submitting a job, the API checks if there is any ongoing bulkdump job. If yes, it will reject the job. Otherwise, it accepts the job. Clearing a job is achieved by erasing the entire user range space of the bulkdump metadata range. When clearing a job, all metadata will be cleared and any ongoing task is stopped (with some latency).
FDBCLI provides following interfaces to do the operations:
For usage examples, see :doc:bulkload-user.
ManagementAPI provides following interfaces to do the operations:
\\xff/bulkDump/ prefix).SS_SERVE_BULKDUMP_PARALLELISM. With current implementation, this knob is set to 1. However, we leave the flexibility of setting bulkdump parallelism at a SS here).