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

lightning: add session-vars to config file (#47414) #47500

Open
wants to merge 2 commits into
base: release-6.5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion br/pkg/lightning/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ type DBStore struct {
BuildStatsConcurrency int `toml:"build-stats-concurrency" json:"build-stats-concurrency"`
IndexSerialScanConcurrency int `toml:"index-serial-scan-concurrency" json:"index-serial-scan-concurrency"`
ChecksumTableConcurrency int `toml:"checksum-table-concurrency" json:"checksum-table-concurrency"`
Vars map[string]string `toml:"-" json:"vars"`
Vars map[string]string `toml:"session-vars" json:"vars"`
}

type Config struct {
Expand Down
3 changes: 3 additions & 0 deletions br/tests/lightning_bom_file/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[mydumper.csv]
header = true

[tidb.session-vars]
tidb_enable_clustered_index = "OFF"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CREATE TABLE testtbl (
id INTEGER,
id INTEGER PRIMARY KEY,
val1 VARCHAR(40) NOT NULL,
INDEX `idx_val1` (`val1`)
);
12 changes: 8 additions & 4 deletions br/tests/lightning_bom_file/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ mydir=$(dirname "${BASH_SOURCE[0]}")

original_schema_file="${mydir}/original_data/mytest.testtbl-schema.sql"
original_data_file="${mydir}/original_data/mytest.testtbl.csv"
schema_file="${original_schema_file/original_data/data}"
data_file="${original_data_file/original_data/data}"
mkdir -p "$TEST_DIR/data"
schema_file="$TEST_DIR/data/mytest.testtbl-schema.sql"
data_file="$TEST_DIR/data/mytest.testtbl.csv"

# add the BOM header
printf '\xEF\xBB\xBF' | cat - <( sed '1s/^\xEF\xBB\xBF//' "${original_schema_file}" ) > "${schema_file}"
Expand All @@ -40,16 +41,19 @@ fi

row_count=$( sed '1d' "${data_file}" | wc -l | xargs echo )

run_lightning --backend tidb
run_lightning --backend tidb -d "$TEST_DIR/data"

# Check that everything is correctly imported
run_sql 'SELECT count(*) FROM mytest.testtbl'
check_contains "count(*): ${row_count}"
# Check session variables take effect
run_sql 'show create table mytest.testtbl'
check_contains "NONCLUSTERED"

check_cluster_version 4 0 0 'local backend' || exit 0
run_sql "DROP TABLE mytest.testtbl"

run_lightning --backend local
run_lightning --backend local -d "$TEST_DIR/data"

# Check that everything is correctly imported
run_sql 'SELECT count(*) FROM mytest.testtbl'
Expand Down