-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
93324: ccl/backupccl: add memory monitor to external SST iterators in restore r=lidorcarmel a=rhu713 Previously, there was no limit on the amount of memory that can be used while constructing edternal SST iterators during restore. This patch adds a memory monitor to limit the amount of memory that can be used to construct external SST iterators. If a restore processor fails to acquire enough memory to open the next file for a restore span, it will send the iterator for all of the open files it has accumulated so far, and wait until it can acquire the memory to resume constructing the iterator for the remaining files. The memory limit can be controlled via the new cluster setting `bulkio.restore.per_processor_memory_limit`. Regardless of the setting, however, the amount of memory used will not exceed `COCKROACH_RESTORE_MEM_FRACTION` * `max SQL memory.` The new environment variable `COCKROACH_RESTORE_MEM_FRACTION` defaults to 0.5. Benchmarking using 10 iterators of 100 files each, each file is 24MiB in size. ``` ./dev bench ./pkg/ccl/backupccl/ --filter BenchmarkIteratorMemory/fileCount=100$/iterCount=10$/rows=200000$/enc=false --bench-mem -- --test_env=COCKROACH_GCS_SST_DIR=gs://rui-backup-test/bench --test_env=COCKROACH_S3_SST_DIR=s3://rui-crl/bench (plus credentials environment variables...) GCS unencrypted: 5.0 MiB/file 5246162544 B/op GCS encrypted: 8.9 MiB/file 9404394496 B/op S3 unencrypted: 1.4 MiB/file 1511477488 B/op S3 encrypted: 1.7 MiB/file 1834325232 B/op ``` Fixes: #102722 Release note: None Co-authored-by: Rui Hu <[email protected]>
- Loading branch information
Showing
20 changed files
with
1,113 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,39 @@ | ||
load("//build/bazelutil/unused_checker:unused.bzl", "get_x_data") | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") | ||
|
||
go_library( | ||
name = "backuputils", | ||
srcs = ["utils.go"], | ||
srcs = [ | ||
"memory_backed_quota_pool.go", | ||
"utils.go", | ||
], | ||
importpath = "github.com/cockroachdb/cockroach/pkg/ccl/backupccl/backuputils", | ||
visibility = ["//visibility:public"], | ||
deps = ["//pkg/cloud"], | ||
deps = [ | ||
"//pkg/cloud", | ||
"//pkg/util/mon", | ||
"//pkg/util/quotapool", | ||
"//pkg/util/syncutil", | ||
"@com_github_cockroachdb_errors//:errors", | ||
"@com_github_cockroachdb_redact//:redact", | ||
], | ||
) | ||
|
||
go_test( | ||
name = "backuputils_test", | ||
srcs = ["memory_backed_quota_pool_test.go"], | ||
args = ["-test.timeout=295s"], | ||
embed = [":backuputils"], | ||
tags = ["ccl_test"], | ||
deps = [ | ||
"//pkg/settings/cluster", | ||
"//pkg/util/leaktest", | ||
"//pkg/util/mon", | ||
"//pkg/util/quotapool", | ||
"//pkg/util/syncutil", | ||
"@com_github_cockroachdb_errors//:errors", | ||
"@com_github_stretchr_testify//require", | ||
], | ||
) | ||
|
||
get_x_data(name = "get_x_data") |
Oops, something went wrong.