Skip to content
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

backupccl: merge 'small' files #66856

Merged
merged 1 commit into from
Jun 24, 2021
Merged

backupccl: merge 'small' files #66856

merged 1 commit into from
Jun 24, 2021

Conversation

dt
Copy link
Member

@dt dt commented Jun 24, 2021

When backing up, each range is asked to export its data to the BACKUP
storage destination. However if a range contains very little data to
backup, which is very often be the case during an incremental backup if
only a handful of rows in that range were modified, the resulting file
may be very small. If a cluster has tens of thousands of ranges, having
each write separate, small files produces a backup made up of tens of
thousands of tiny files. Running such a backup every hour or more often
rapidly produces potentially millions of files very quickly. This adds
up in storage costs, metadata and tracking overhead, etc.

This change adds a setting bulkio.backup.merge_file_size under which a
range will return the file it would have written to the backup storage
destination instead of writing it. This leverages the fact that the
backup process will merge the returned file with other returned files
until it has a file of the desired target size.

Release note (ops change): the new setting bulkio.backup.merge_file_size
allows BACKUP to buffer and merge smaller files to reduce the number of
small individual files created by BACKUP.

@dt dt requested review from pbardea and a team June 24, 2021 17:53
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@miretskiy miretskiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 5 of 5 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @pbardea)

pkg/ccl/backupccl/backup_processor.go Show resolved Hide resolved
pkg/ccl/backupccl/backup_test.go Show resolved Hide resolved
pkg/roachpb/api.proto Outdated Show resolved Hide resolved
@dt dt force-pushed the backup-small branch 2 times, most recently from 3f98d26 to 22f6b76 Compare June 24, 2021 19:55
When backing up, each range is asked to export its data to the BACKUP
storage destination. However if a range contains very little data to
backup, which is very often be the case during an incremental backup if
only a handful of rows in that range were modified, the resulting file
may be very small. If a cluster has tens of thousands of ranges, having
each write separate, small files produces a backup made up of tens of
thousands of tiny files. Running such a backup every hour or more often
rapidly produces potentially millions of files very quickly. This adds
up in storage costs, metadata and tracking overhead, etc.

This change adds a setting bulkio.backup.merge_file_size under which a
range will _return_ the file it would have written to the backup storage
destination instead of writing it. This leverages the fact that the
backup process will merge the returned file with other returned files
until it has a file of the desired target size.

Release note (ops change): the new setting bulkio.backup.merge_file_size
allows BACKUP to buffer and merge smaller files to reduce the number of
small individual files created by BACKUP.
@dt dt requested a review from a team as a code owner June 24, 2021 20:09
@dt
Copy link
Member Author

dt commented Jun 24, 2021

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Jun 24, 2021

Build succeeded:

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.

4 participants