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

Add io_buffer_size to BackupEngineOptions #13236

Closed

Conversation

archang19
Copy link
Contributor

@archang19 archang19 commented Dec 19, 2024

Summary

The RocksDB backup engine code currently derives the IO buffer size based on the following criteria:

  1. If specified, use the rate limiter burst size
  2. Otherwise, use the default size (5 MiB)

We want to be able to explicitly choose the IO size based on the storage backend. We want the new criteria to be:

  1. If specified, use the size in BackupEngineOptions
  2. If specified, use the rate limiter burst size
  3. Otherwise, use the default size (5 MiB)

This PR adds a new option called io_buffer_size to BackupEngineOptions and updates the logic used to set the buffer size.

Test Plan

I added a separate unit test and verified that we can either use the io_buffer_size, rate limiter burst size, or the default size.

I decided to use a TEST_SYNC_POINT_CALLBACK. I considered the alternative of updating the Read implementation of DummySequentialFile / CheckIOOptsSequentialFile to check the value of n. However, that would have considerably complicated the whole test code, and we also do not need to be checking for this in every single test case. I think the TEST_SYNC_POINT_CALLBACK turned out to be quite elegant.

@archang19 archang19 force-pushed the backup-engine-io-buffer-size branch 6 times, most recently from 1316c31 to 82348e9 Compare December 20, 2024 23:14
@archang19 archang19 force-pushed the backup-engine-io-buffer-size branch 2 times, most recently from 147b60f to ac0178c Compare January 2, 2025 17:32
@archang19 archang19 marked this pull request as ready for review January 2, 2025 18:10
@facebook-github-bot
Copy link
Contributor

@archang19 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@pdillinger pdillinger left a comment

Choose a reason for hiding this comment

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

Overall LGTM

: kDefaultCopyFileBufferSize;
size_t buf_size = CalculateIOBufferSize(rate_limiter);
TEST_SYNC_POINT_CALLBACK(
"BackupEngineImpl::CopyOrCreateFile:CalculateIOBufferSize", &buf_size);
Copy link
Contributor

Choose a reason for hiding this comment

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

Sync point is not my favorite here for testing about 1/2 to 2/3rds of the integrated data path of the setting when an existing callback mechanism (FileSystemWrapper / FSWritableFile / FSSequentialFile) could test the full end-to-end buffer size (probably tracking the max buffer size seen in existing TestFs in backup_engine_test). But it's ok.

@archang19 archang19 force-pushed the backup-engine-io-buffer-size branch from a0e7bf6 to fcc26da Compare January 2, 2025 21:39
@facebook-github-bot
Copy link
Contributor

@archang19 has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@archang19 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@archang19 has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@archang19 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@archang19 archang19 force-pushed the backup-engine-io-buffer-size branch from 1bfc7d7 to 5df6b7e Compare January 2, 2025 22:38
@facebook-github-bot
Copy link
Contributor

@archang19 has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@archang19 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@archang19 merged this pull request in f7d32c1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants