-
Notifications
You must be signed in to change notification settings - Fork 724
dumpling-overview: add Parquet export documentation #23933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |||||||||
|
|
||||||||||
| # Use Dumpling to Export Data | ||||||||||
|
|
||||||||||
| This document introduces the data export tool - [Dumpling](https://github.com/pingcap/tidb/tree/master/dumpling). Dumpling exports data stored in TiDB/MySQL as SQL or CSV data files and can be used to make a logical full backup or export. Dumpling also supports exporting data to Amazon S3. | ||||||||||
| This document introduces the data export tool - [Dumpling](https://github.com/pingcap/tidb/tree/master/dumpling). Dumpling exports data stored in TiDB/MySQL as SQL, CSV, or Parquet data files and can be used to make a logical full backup or export. Dumpling also supports exporting data to Amazon S3. | ||||||||||
|
|
||||||||||
| <CustomContent platform="tidb"> | ||||||||||
|
|
||||||||||
|
|
@@ -50,7 +50,7 @@ | |||||||||
|
|
||||||||||
| Dumpling has the following advantages: | ||||||||||
|
|
||||||||||
| - Support exporting data in multiple formats, including SQL and CSV. | ||||||||||
| - Support exporting data in multiple formats, including SQL, CSV, and Parquet. | ||||||||||
| - Support the [table-filter](https://github.com/pingcap/tidb-tools/blob/master/pkg/table-filter/README.md) feature, which makes it easier to filter data. | ||||||||||
| - Support exporting data to Amazon S3 cloud storage. | ||||||||||
| - More optimizations are made for TiDB: | ||||||||||
|
|
@@ -151,13 +151,32 @@ | |||||||||
| > | ||||||||||
| > *Strings* and *keywords* are not distinguished by Dumpling. If the imported data is the Boolean type, the value of `true` is converted to `1` and the value of `false` is converted to `0`. | ||||||||||
|
|
||||||||||
| ### Export to Parquet files | ||||||||||
|
|
||||||||||
| Starting from v9.0.0, you can export data to Parquet files by adding the `--filetype parquet` argument. | ||||||||||
|
|
||||||||||
| {{< copyable "shell-regular" >}} | ||||||||||
|
|
||||||||||
| ```shell | ||||||||||
| tiup dumpling -u root -P 4000 -h 127.0.0.1 -o /tmp/test --filetype parquet -t 8 -F 256MiB | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| In the command above: | ||||||||||
|
|
||||||||||
| - Dumpling exports table data as Parquet files, and still exports the table schema as SQL files. You can use the exported files as the data source of [TiDB Lightning](/tidb-lightning/tidb-lightning-overview.md). | ||||||||||
| - You can use the `--parquet-compress` option to specify the compression algorithm for Parquet files. It supports `no-compression`, `snappy`, `gzip`, and `zstd`. The default value is `snappy`. When compression is enabled, the algorithm is added to the file name. For example, with the `snappy` compression, the exported data file is named as `test.t1.000000000.snappy.parquet`. | ||||||||||
| - You can use the `--parquet-page-size` option to set the data page size of Parquet files. The default value is `1MiB`. | ||||||||||
| - You can use the `--parquet-row-group-size` option to set the row group memory limit of Parquet files. The default value is `120MiB`. Dumpling flushes buffered rows when the accounted in-memory usage of a row group reaches this limit. | ||||||||||
| - The `--compress` option is not supported for Parquet files. To compress Parquet files, use the `--parquet-compress` option instead. | ||||||||||
|
|
||||||||||
| ### Compress the exported data files | ||||||||||
|
|
||||||||||
| You can use the `--compress <format>` option to compress the CSV and SQL data and table structure files exported by Dumpling. This parameter supports the following compression algorithms: `gzip`, `snappy`, and `zstd`. The compression is disabled by default. | ||||||||||
|
|
||||||||||
| - This option only compresses individual data and table structure files. It cannot compress the entire folder and generate a single compressed package. | ||||||||||
| - This option can save disk space, but it also slows down the export speed and increases CPU consumption. Use this option with caution in scenarios where the export speed is critical. | ||||||||||
| - For TiDB Lightning v6.5.0 and later versions, you can use compressed files exported by Dumpling as the data source without additional configuration. | ||||||||||
| - This option does not apply to Parquet files. To compress Parquet files, use the [`--parquet-compress`](#option-list-of-dumpling) option instead. | ||||||||||
|
|
||||||||||
| > **Note:** | ||||||||||
| > | ||||||||||
|
|
@@ -207,7 +226,7 @@ | |||||||||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| - `{schema}.{table}.{0001}.{sql|csv}`: The date source file | ||||||||||
| - `{schema}.{table}.{0001}.{sql|csv|parquet}`: The data source file. For compressed Parquet files, the file name also contains the compression algorithm, for example, `test.t1.000000000.snappy.parquet`. | ||||||||||
|
|
||||||||||
| {{< copyable "shell-regular" >}} | ||||||||||
|
|
||||||||||
|
|
@@ -400,7 +419,7 @@ | |||||||||
| | `-m` or `--no-schemas` | Do not export the schema with only the data exported | | ||||||||||
| | `-s` or `--statement-size` | Control the size of the `INSERT` statements; the unit is bytes | | ||||||||||
| | `-F` or `--filesize` | The file size of the divided tables. The unit must be specified such as `128B`, `64KiB`, `32MiB`, and `1.5GiB`. | | ||||||||||
| | `--filetype` | Exported file type (csv/sql) | "sql" | | ||||||||||
| | `--filetype` | Exported file type (csv/sql/parquet) | "sql" | | ||||||||||
| | `-o` or `--output` | Specify the absolute local file path or [external storage URI](/external-storage-uri.md) for exporting the data. | "./export-${time}" | | ||||||||||
| | `-S` or `--sql` | Export data according to the specified SQL statement. This command does not support concurrent export. | | ||||||||||
| | `--consistency` | flush: use FTWRL before the dump <br/> snapshot: dump the TiDB data of a specific snapshot of a TSO <br/> lock: execute `lock tables read` on all tables to be dumped <br/> none: dump without adding locks, which cannot guarantee consistency <br/> auto: use --consistency flush for MySQL; use --consistency snapshot for TiDB | "auto" | | ||||||||||
|
|
@@ -423,7 +442,10 @@ | |||||||||
| | `--status-addr` | Dumpling's service address, including the address for Prometheus to pull metrics and pprof debugging | ":8281" | | ||||||||||
| | `--tidb-mem-quota-query` | The memory limit of exporting SQL statements by a single line of Dumpling command, and the unit is byte. For v4.0.10 or later versions, if you do not set this parameter, TiDB uses the value of the `mem-quota-query` configuration item as the memory limit value by default. For versions earlier than v4.0.10, the parameter value defaults to 32 GB. | 34359738368 | | ||||||||||
| | `--params` | Specifies the session variable for the connection of the database to be exported. The required format is `"character_set_client=latin1,character_set_connection=latin1"` | | ||||||||||
| | `-c` or `--compress` | Compresses the CSV and SQL data and table structure files exported by Dumpling. It supports the following compression algorithms: `gzip`, `snappy`, and `zstd`. | "" | | ||||||||||
| | `-c` or `--compress` | Compresses the CSV and SQL data and table structure files exported by Dumpling. It supports the following compression algorithms: `gzip`, `snappy`, and `zstd`. This option does not apply to Parquet files. | "" | | ||||||||||
| | `--parquet-compress` | The compression algorithm for Parquet files. It supports `no-compression`, `snappy`, `gzip`, and `zstd`. | "snappy" | | ||||||||||
| | `--parquet-page-size` | The data page size of Parquet files. The unit must be specified such as `128B`, `64KiB`, `32MiB`, and `1.5GiB`. | 1MiB | | ||||||||||
|
Check failure on line 447 in dumpling-overview.md
|
||||||||||
| | `--parquet-row-group-size` | The row group memory limit of Parquet files, which is the flush threshold by accounted in-memory bytes. The unit must be specified such as `128B`, `64KiB`, `32MiB`, and `1.5GiB`. | 120MiB | | ||||||||||
|
Check failure on line 448 in dumpling-overview.md
|
||||||||||
|
Comment on lines
+447
to
+448
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: rg -n --hidden -S 'PingCAP\.Units|Vale|vale|non.?breaking|Units' . --glob '!vendor/**' --glob '!node_modules/**'
sed -n '430,455p' dumpling-overview.mdRepository: pingcap/docs Length of output: 41016 🤖 get_repo_knowledge executed:
Length of output: 4452 🏁 Script executed: #!/bin/bash
set -u
printf '%s\n' '--- relevant tracked files ---'
git ls-files | rg '(^|/)(\.vale\.ini|vale|Vale|markdownlint|dumpling-overview\.md|ci\.yaml)$|styles/PingCAP/Units\.yml|scripts/' | head -120
printf '%s\n' '--- .vale.ini ---'
if [ -f .vale.ini ]; then cat -n .vale.ini; else printf '%s\n' 'missing'; fi
printf '%s\n' '--- Units rule ---'
if [ -f styles/PingCAP/Units.yml ]; then cat -n styles/PingCAP/Units.yml; else printf '%s\n' 'missing'; fi
printf '%s\n' '--- Vale references in scripts/workflow ---'
rg -n -S 'vale|Vale|PingCAP\.Units|stylesPath|BasedOnStyles|formats|glob|exclude' scripts .github .vale.ini styles 2>/dev/null | head -200
printf '%s\n' '--- target lines and nearby Markdown unit examples ---'
cat -n dumpling-overview.md | sed -n '420,455p'
printf '%s\n' '--- relevant Markdown guidance/config ---'
rg -n -S 'Markdown|Vale|nonbreaking|non-breaking|unit|nbsp' README.md CONTRIBUTING.md .github resources scripts 2>/dev/null | head -200Repository: pingcap/docs Length of output: 39267 🏁 Script executed: #!/bin/bash
set -u
printf '%s\n' '--- CI Vale job ---'
cat -n .github/workflows/ci.yaml | sed -n '55,78p'
printf '%s\n' '--- changed-file Vale plumbing ---'
rg -n -S 'vale-action|vale |Vale|extract-changed-markdown|changed.*md|\.md' .github/workflows .github/scripts scripts 2>/dev/null | head -120
printf '%s\n' '--- repository nonbreaking-space examples ---'
rg -n -S ' |&`#160`;|U\+00A0' --glob '*.md' --glob '*.mdx' . | head -80
printf '%s\n' '--- all target literals in the file ---'
rg -n -F -e '1MiB' -e '120MiB' dumpling-overview.mdRepository: pingcap/docs Length of output: 15224 🏁 Script executed: #!/bin/bash
set -u
printf '%s\n' '--- nearby Parquet section ---'
cat -n dumpling-overview.md | sed -n '155,175p'
printf '%s\n' '--- targeted diff for dumpling-overview.md ---'
git diff --unified=2 -- dumpling-overview.md | rg -n -C 3 'parquet|MiB|@@' | head -180Repository: pingcap/docs Length of output: 2022 Add nonbreaking spaces to the Parquet size defaults.
Committable replacement-| `--parquet-page-size` | The data page size of Parquet files. The unit must be specified such as `128B`, `64KiB`, `32MiB`, and `1.5GiB`. | 1MiB |
-| `--parquet-row-group-size` | The row group memory limit of Parquet files, which is the flush threshold by accounted in-memory bytes. The unit must be specified such as `128B`, `64KiB`, `32MiB`, and `1.5GiB`. | 120MiB |
+| `--parquet-page-size` | The data page size of Parquet files. The unit must be specified such as `128B`, `64KiB`, `32MiB`, and `1.5GiB`. | 1 MiB |
+| `--parquet-row-group-size` | The row group memory limit of Parquet files, which is the flush threshold by accounted in-memory bytes. The unit must be specified such as `128B`, `64KiB`, `32MiB`, and `1.5GiB`. | 120 MiB |📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Check: vale[failure] 448-448: Raw Output: [failure] 447-447: Raw Output: |
||||||||||
|
|
||||||||||
| ## Output filename template | ||||||||||
|
|
||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: pingcap/docs
Length of output: 7314
🏁 Script executed:
Repository: pingcap/docs
Length of output: 35353
🌐 Web query:
official GitHub Dumpling parquet compression filename snappy.parquet tidb-lightning parser💡 Result:
<source_evidence>
Citations:
🌐 Web query:
site:github.com/pingcap/tidb "snappy.parquet" "parquet-compress"💡 Result:
<source_evidence>
Citations:
🏁 Script executed:
Repository: pingcap/docs
Length of output: 2436
🏁 Script executed:
Repository: pingcap/docs
Length of output: 33228
Clarify the native Parquet filename exception in the TiDB Lightning documentation.
Dumpling emits
test.t1.000000000.snappy.parquet, nottest.t1.000000000.parquet.snappy. TiDB Lightning has a dedicated route for native Parquet compression and matches thesnappy.parquetform before the generic compressed-file route. Keep the Dumpling examples unchanged.The generic pattern in
tidb-lightning/tidb-lightning-data-source.md:27conflicts with this behavior and with its note at line 368. Limit that pattern to CSV and SQL files, or document the native Parquet exception explicitly.