-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
lightning: add store write limiter #35193
Changes from 7 commits
31c89e5
9defbc8
47d0bb5
6a89123
aafe78b
4802250
bca655b
8ec642b
6636cdc
6797a6d
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 |
---|---|---|
|
@@ -532,6 +532,7 @@ type TikvImporter struct { | |
|
||
EngineMemCacheSize ByteSize `toml:"engine-mem-cache-size" json:"engine-mem-cache-size"` | ||
LocalWriterMemCacheSize ByteSize `toml:"local-writer-mem-cache-size" json:"local-writer-mem-cache-size"` | ||
StoreWriteBWLimit ByteSize `toml:"store-write-bwlimit" json:"store-write-bwlimit"` | ||
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. what's maybe 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. @sunzhaoyang ptal too 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.
|
||
} | ||
|
||
type Checkpoint struct { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[tikv-importer] | ||
store-write-bwlimit = "1Mi" | ||
|
||
[mydumper.csv] | ||
header = false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright 2022 PingCAP, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -eux | ||
|
||
mkdir -p "$TEST_DIR/data" | ||
|
||
cat <<EOF >"$TEST_DIR/data/test-schema-create.sql" | ||
CREATE DATABASE test; | ||
EOF | ||
cat <<EOF >"$TEST_DIR/data/test.t-schema.sql" | ||
CREATE TABLE test.t ( | ||
id int, | ||
a int, | ||
b int, | ||
c int | ||
); | ||
EOF | ||
|
||
# Generate 200k rows. Total size is about 5MiB. | ||
set +x | ||
for i in {1..200000}; do | ||
echo "$i,$i,$i,$i" >>"$TEST_DIR/data/test.t.0.csv" | ||
done | ||
set -x | ||
|
||
start=$(date +%s) | ||
run_lightning --backend local -d "$TEST_DIR/data" --config "tests/$TEST_NAME/config.toml" | ||
end=$(date +%s) | ||
take=$((end - start)) | ||
|
||
# The encoded kv size is 10MiB. Usually it should take more than 10s. | ||
if [ $take -lt 10 ]; then | ||
echo "Lightning runs too fast. The write limiter doesn't work." | ||
exit 1 | ||
fi |
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.
maybe adjust them during config.adjust, and add a log
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.
This is an internal implementation.
burst
is not configurable.